|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 8 Jul 2004 20:34:46 -0000 Issue 2865
php-general-digest-help
lists.php.net
Date: Thu Jul 08 2004 - 15:34:46 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 8 Jul 2004 20:34:46 -0000 Issue 2865
Topics (messages 189944 through 189993):
Re: Storing website templates in sessions
189944 by: rush
Re: binary data over UDP with PHP?
189945 by: Aidan Lister
Re: Client IP
189946 by: Aidan Lister
189955 by: John Nichel
How to specify compiler options on Win32
189947 by: Richard Davey
189949 by: Tom Rogers
189950 by: Richard Davey
189957 by: Tom Rogers
Re: $_SERVER[HTTP_REFERER]
189948 by: Shaun
189951 by: Christophe Chisogne
189981 by: Justin Patrin
Re: sending attachments
189952 by: Manuel Lemos
Re: post without <form>
189953 by: Manuel Lemos
Does anyone have PHP compiled with --enable-memory-limit?
189954 by: Richard Davey
Common MySQL database function class
189956 by: Keith Lawrence
189973 by: Torsten Roehr
Worried about PECL
189958 by: Peter Clarke
Re: Slideshow using PHP
189959 by: Todd Cary
189976 by: Matthew Sims
189977 by: raditha dissanayake
189993 by: Todd Cary
Re: Malicious SQL
189960 by: Reuben D. Budiardja
189978 by: Philip Olson
MySQL Database Connection Question
189961 by: Harlequin
189963 by: James E Hicks III
189964 by: John Nichel
189966 by: Daniel Kullik
189967 by: Afan Pasalic
189968 by: John Nichel
189969 by: Daniel Kullik
189971 by: Daniel Kullik
189972 by: Afan Pasalic
User Redirection if login fails
189962 by: Harlequin
189965 by: John Nichel
189975 by: Matthew Sims
php mls and realtor.com
189970 by: Edward Peloke
Re: call_user_func and call-time pass-by-reference
189974 by: Andrew S. Nagy
How can I write/read encoded numbers into/from a file?
189979 by: Julio Sergio Santana
189980 by: deseavers.mindspring.com
189982 by: Chris
189983 by: Julio Sergio Santana
189984 by: Julio Sergio Santana
189985 by: Julio Sergio Santana
Link only active letters in alphabetical search
189986 by: barophobia
189987 by: deseavers.mindspring.com
189988 by: Jay Blanchard
189989 by: Matt M.
189991 by: barophobia
189992 by: Jay Blanchard
Authentification Help
189990 by: Mike Tuller
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
"Joe Harman" <joe
cjharman.com> wrote in message
news:000001c46470$f6669810$1a12d943
cjh...
> Hey everyone...
>
> I was curious if anyone out there has some pros and cons to storing a
> website template that is extracted from a mysql db and stored in a
> session... is this an efficient way to do it?
>
> also... does anyone know what the size limitations for a session would
> be?
I guess you could stuck them there if you really wanted to, but there is
some broken feeling about that. Like keeping your motorcycle in dining room,
you can do it, but it is a bit odd.
Keep templates in files, or if you are using Smarty or TemplateTamer in
generated php code.
rush
--
http://www.templatetamer.com/
attached mail follows:
If you're receiving binary data back, this function may interest you:
http://aidan.dotgeek.org/lib/?file=function.hexdump.php
Also, why are you messing with chr etc?
$string = "\x00\x01\xFF";
etc.
"Coder_1024" <coder_1024
hotmail.com> wrote in message
news:20040708022403.82466.qmail
pb1.pair.com...
> Thanks for the feedback. As it turns out, the reason I was getting zero
> data bytes in my UDP packet was that I had declared the packet variable
> outside the function in which I was using it.
>
> $packet = chr(0x01).chr(0x1d).... etc
>
> function doSomething($x)
> {
> // using $packet in here gives you an empty variable.
> }
>
> So I guess it was a very basic PHP language thing I was running into.
Guess
> I've done too much Perl and assumed the variables were accessible in the
> function. :-)
>
>
> "Keith Greene" <hitek
cox.net> wrote in message
> news:6.1.1.1.0.20040707170321.01dda740
pop.west.cox.net...
> > I use the following without problem:
> >
> > $fp = fsockopen("udp://www.server.com", 24250, &$errno,
&$errstr,
> .2);
> > if (!$fp) {
> > $status = "Server not available";
> > } else {
> > $trigger =
> > chr(hexdec('FF')).chr(hexdec('FF')).chr(hexdec('01')).chr(hexdec('00'));
> > fwrite($fp,$trigger); # Send trigger to the
> > status server
> > $junk = fread($fp, 4); # discard echoed
command
> > from status server
> > }
> >
> > Keith
> >
> > At 04:23 PM 7/7/2004, coder_1024 wrote:
> > >I'm trying to send some binary data to a UDP server using PHP. The
> examples
> > >I've been able to find show sending binary data over TCP, or they show
> > >sending text over UDP.
> > >
> > >I'm constructing the messages using the below:
> > >
> > > $text_msg = "Hello, World\r\n";
> > > $binary_msg = chr(0x01).chr(0x02).chr(0x00).chr(0xAD);
> > > $binary_msg_size = 4;
> > >
> > >I've tried a couple methods of sending the data:
> > >
> > > $fp = fsockopen("udp://" . $host,$port,....);
> > > fwrite($fp,$binary_msg,$binary_msg_size);
> > >
> > >and
> > >
> > > $sock = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
> > > socket_sendto($sock,$binary_msg,$binary_msg_size,0,$host,$port);
> > >
> > >In either case, a UDP packet is sent, but with a zero data size. If I
> > >instead send the $text_msg, it works as expected. For some reason
> sending
> > >the binary data doesn't work.
> > >
> > >Does anyone have insight into how to send binary data over UDP using
PHP?
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I use the following script:
http://aidan.dotgeek.org/lib/?file=Visitor.php
As you've been told about 400 times, there's no reliable way to get the
information.
The above script checks if the client connected using a proxy, then falls
back to what the webserver sends.
"Rosen" <rosen
pernikinfo.com> wrote in message
news:20040707225524.46873.qmail
pb1.pair.com...
> Hi,
> How can I get remote IP adress of client?
> I use the fillow script::
>
> $ip=getenv('HTTP_X_FORWARDED_FOR');
> if (!$ip)
> {
> $ip = getenv('REMOTE_ADDR');
> }
>
>
> But sometime it return me "unknown" sa IP adress.
>
> Can someone help me ?
>
> Thanks in advance!
attached mail follows:
John W. Holmes wrote:
> Trust me.
Riiiiigggggghhhhhhhhtttttt. Like we're going to trust the likes of you.
I guess the cheque's in the mail too, eh? ;)
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
attached mail follows:
Hi,
Using the guide on the Zend site
(http://www.zend.com/manual/install.windows.php#install.windows.build)
I have successfully compiled and built the Win32 version of PHP using
Visual C++. For now I am building the CLI version - and it works just
great, but I have what is probably a very basic question - how do you
add the compile time options when building it?
For example I want to build the CLI version with --enable-memory-limit
so I can use the memory_get_usage() function - but I am simply not
sure where to specify this before building the project. I'm guessing
it lurks somewhere in the Project Settings for php4ts_cli?
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde
attached mail follows:
Hi,
Thursday, July 8, 2004, 6:56:17 PM, you wrote:
RD> Hi,
RD> Using the guide on the Zend site
RD> (http://www.zend.com/manual/install.windows.php#install.windows.build)
RD> I have successfully compiled and built the Win32 version of PHP using
RD> Visual C++. For now I am building the CLI version - and it works just
RD> great, but I have what is probably a very basic question - how do you
RD> add the compile time options when building it?
RD> For example I want to build the CLI version with --enable-memory-limit
RD> so I can use the memory_get_usage() function - but I am simply not
RD> sure where to specify this before building the project. I'm guessing
RD> it lurks somewhere in the Project Settings for php4ts_cli?
RD> Best regards,
RD> Richard Davey
RD> --
RD> http://www.launchcode.co.uk - PHP Development Services
RD> "I am not young enough to know everything." - Oscar Wilde
php-x.x.x/main/config_w32.h is where they are set, but I don't think
--enable-memory-limit will work in windows (at least I couldn't get
it to report anything meaningfull :)
--
regards,
Tom
attached mail follows:
Hello Tom,
Thursday, July 8, 2004, 10:27:20 AM, you wrote:
TR> php-x.x.x/main/config_w32.h is where they are set, but I don't think
TR> --enable-memory-limit will work in windows (at least I couldn't get
TR> it to report anything meaningfull :)
I have to admit I did look in there, but couldn't see anything
relating to it (or how to specify it). But if it doesn't work on
Windows anyway then I guess it's not much use! :)
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde
attached mail follows:
Hi,
Thursday, July 8, 2004, 7:38:49 PM, you wrote:
RD> Hello Tom,
RD> I have to admit I did look in there, but couldn't see anything
RD> relating to it (or how to specify it). But if it doesn't work on
RD> Windows anyway then I guess it's not much use! :)
RD> Best regards,
RD> Richard Davey
RD> --
RD> http://www.launchcode.co.uk - PHP Development Services
RD> "I am not young enough to know everything." - Oscar Wilde
You could try adding
#define MEMORY_LIMIT 1
--
regards,
Tom
attached mail follows:
"Gerard Samuel" <php-general
trini0.org> wrote in message
news:200407072012.59616.php-general
trini0.org...
> On Wednesday 07 July 2004 05:43 pm, Shaun wrote:
> > Hi,
> >
> > Can someone tell me why
> >
> > echo '$_SERVER[HTTP_REFERER] = '.$_SERVER[HTTP_REFERER].'<br>';
> >
> > Produces
> >
> > $_SERVER[HTTP_REFERER] =
> >
> > Is this a problem with my server configuration, if so is there a SERVER
> > variable I can use instead?
> >
>
> It could be the server. I never fully investigated this, but IIS 5/5.1
> doesn't report an HTTP REFERER....
> The last time I checked this out, was on w2k/iis5 and winxp/iis5.1 (pre
sp1)
> maybe over a year ago.
> Could someone verify/deny this, so I know that Im not crazy ;)....
Thanks for your replies,
after lots of investigation it appears that it is just my laptop that won't
disply the variable, maybe because I am using Norton Firewall? Whatever the
reason, is there an alternative server variable?
attached mail follows:
Shaun a écrit :
> after lots of investigation it appears that it is just my laptop that won't
> disply the variable, maybe because I am using Norton Firewall?
Possible. The REFERER HTTP field is OPTIONAL
-- See http1.1 spec (rfc2616) or this list archives.
So it's not a field anyone should rely upon.
More and more software (firewall, proxies, privacy tools)
just dont send it, or send it modified
(same thing for the UserAgent field, which can even
be modified on several browsers)
> reason, is there an alternative server variable?
No. It can be empty or even (easily) faked.
Christophe
attached mail follows:
On Thu, 08 Jul 2004 11:49:24 +0200, Christophe Chisogne
<christophe
publicityweb.com> wrote:
> Shaun a écrit :
> > after lots of investigation it appears that it is just my laptop that won't
> > disply the variable, maybe because I am using Norton Firewall?
>
> Possible. The REFERER HTTP field is OPTIONAL
> -- See http1.1 spec (rfc2616) or this list archives.
> So it's not a field anyone should rely upon.
> More and more software (firewall, proxies, privacy tools)
> just dont send it, or send it modified
> (same thing for the UserAgent field, which can even
> be modified on several browsers)
>
> > reason, is there an alternative server variable?
>
> No. It can be empty or even (easily) faked.
>
This is a variable that the client send you explicitly. Some firewall
software blocks sending it. You can even send a fake value. Basically,
you can't rely on it.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
Hello,
On 07/07/2004 08:04 AM, Curlys wrote:
> can some body help me to send an email attachment ( a log file ) from php ?
> Actaually i need a real guide ............plz
You need to compose a multipart/mixed message with a text part that is
your message and the attached part with is your file.
You may want to try this class that simplifies composing complex
messages. It also comes with examples and extensive documentation that
explain how compose the messages properly without much work.
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
attached mail follows:
Hello,
On 07/07/2004 10:49 AM, Josh Close wrote:
> How can I post data without having it submitted from within a form?
>
> With get I can just add it to the url. Is there a php function for this?
If you mean emulating POST form submission to a site of a given URL, you
may want to try this HTTP client class that makes it easy to do that and
comes with an example:
http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
attached mail follows:
Hi all,
Does anyone here have a version of PHP with --enable-memory-limit
compiled into it and a couple of minutes to spare? All I need is for
you to run a very simple script a couple of times and send me the
output. If you've got a PayPal account I'll even throw a few dollars
your way for the trouble if you want. Please contact me off-list.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde
attached mail follows:
Hi there,
I'm a web-developer and I work with PHP as often as I can (it's infinitely
preferable to ASP) and as a result of this I end up coding in lots of
different environments. Our local dev server is a windows machine which acts
differently to the multitude of *nix boxes which our clients run. Some have
safe-mode enabled (apparently a good safety measure for a shared-hosting
solution), some run with magic_quotes on, some with magic_quotes off,
register globals on/off, etc etc ad nauseum. Usually this isn't much of a
problem as I tend to only work on one major project at a time and I can set
up our local windows box to emulate the live server, but it would be very
useful to me if I could ask for your collective knowledge on building an
include file (or class) of common database functions. This class would take
into account whether the server has magic_quotes enabled and cater for it,
different login strings depending on the environment variables (for dev and
live environments) as well as catering for any other strange
platform-dependent niggles that I've left out. It'd also have methods to
fetch:
* just one specific value from the database
* an array of rows from the database
* run an arbitrary query (insert/update/delete) and return success/failure
and optionally populate the identity id/error message/etc.
I hasten to add that I'm not asking for someone to build this for me, but
rather asking for any pointers/tips for things I should watch out for or
links that might help. I've searched extensively for something like this but
haven't found one that does exactly what I want. Am I re-inventing the wheel
here? Does anyone else who works on multiple platforms have these problems?
Many thanks (in advance) for any help,
Regards,
Keith
<http://www.pi-squared.co.za/>
attached mail follows:
"Keith Lawrence" <keith
pi-squared.co.za> wrote in message
news:php.general-189956
news.php.net...
> Hi there,
>
> I'm a web-developer and I work with PHP as often as I can (it's infinitely
> preferable to ASP) and as a result of this I end up coding in lots of
> different environments. Our local dev server is a windows machine which
acts
> differently to the multitude of *nix boxes which our clients run. Some
have
> safe-mode enabled (apparently a good safety measure for a shared-hosting
> solution), some run with magic_quotes on, some with magic_quotes off,
> register globals on/off, etc etc ad nauseum. Usually this isn't much of a
> problem as I tend to only work on one major project at a time and I can
set
> up our local windows box to emulate the live server, but it would be very
> useful to me if I could ask for your collective knowledge on building an
> include file (or class) of common database functions. This class would
take
> into account whether the server has magic_quotes enabled and cater for it,
> different login strings depending on the environment variables (for dev
and
> live environments) as well as catering for any other strange
> platform-dependent niggles that I've left out. It'd also have methods to
> fetch:
> * just one specific value from the database
> * an array of rows from the database
> * run an arbitrary query (insert/update/delete) and return success/failure
> and optionally populate the identity id/error message/etc.
>
> I hasten to add that I'm not asking for someone to build this for me, but
> rather asking for any pointers/tips for things I should watch out for or
> links that might help. I've searched extensively for something like this
but
> haven't found one that does exactly what I want. Am I re-inventing the
wheel
> here? Does anyone else who works on multiple platforms have these
problems?
>
> Many thanks (in advance) for any help,
>
> Regards,
> Keith
Hi Keith,
using a database abstraction layer would be a good start. There are some
good ones in PEAR:
http://pear.php.net/packages.php?catpid=7&catname=Database
Namely PEAR::DB, PEAR::MDB and PEAR::MDB2. They offer the features you are
looking for.
Regards, Torsten Roehr
attached mail follows:
Currently the online manual for php is great.
My concern is that the documentation for PECL extensions is almost
non-existent. Since some php extensions are being moved/replaced by PECL
extensions are we going to get non-existent documentation?
For example:
www.php.net/mime-magic
"This extension has been deprecated as the PECL extension fileinfo
provides the same functionality (and more) in a much cleaner way."
http://pecl.php.net/package/Fileinfo provides no documentation so what
these extra functions are, I have no idea. Worse, I now have no idea how
to do mime_content_type().
www.php.net/mcal
"Note: This extension has been removed as of PHP 5 and moved to the PECL
repository."
There is no mention of mcal on the pecl website.
I appreciate that PECL will more relevant to PHP5, but PHP5 is close is
the documentation close too?
-Peter
attached mail follows:
I do have a JavaScript based "SlideShow", however, I would like to use
PHP rather than JavaScript. Is there a way to "loop" with PHP and
"display" an image without re-displaying the whole page?
Todd
Alex Shi wrote:
> Search google for javascript slideshow script. Javascript slideshow need
> an array of image names, this can be done by php and mysql when dynamically
> generate the page.
>
> Alex Shi
>
>
>>I would like to have images displayed automatically using PHP with a
>>Database and/or an array of images. Is there any sample code available
>>for doing that?
>>
>>Can that be done with Flash and PHP?
>>
>>Todd
attached mail follows:
> I do have a JavaScript based "SlideShow", however, I would like to use
> PHP rather than JavaScript. Is there a way to "loop" with PHP and
> "display" an image without re-displaying the whole page?
>
> Todd
To get a good slideshow you'll need to use client side instructions, aka
javascript. You're probably not going to get it to work so well using PHP
which is server side instructions.
Part of getting the slideshow to work is making the browser switch to the
next image and well, PHP doesn't really make the browser do anything.
--Matthew Sims
--<http://killermookie.org>
attached mail follows:
The best way to do a slide show in my opinion is with SMIL, even though
you need a plug in to view it.. SMIL is what's used in MMS.
you can generate you SMIL with MMS - as we have done in our MMS composer.
--
Raditha Dissanayake.
---------------------------------------------
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
attached mail follows:
Matthew -
<<<
Part of getting the slideshow to work is making the browser switch to the
next image and well, PHP doesn't really make the browser do anything.
>>>
As I was thinking about it before posting this thread, that was my
impression. The problem with my javaScript app is the fact that it
needs to load all of the images.
I am hoping there is some way to load the iamges one-at-a-time; as needed.
Someone told me that there is a way to use Flash and PHP.
Todd
Matthew Sims wrote:
>>I do have a JavaScript based "SlideShow", however, I would like to use
>>PHP rather than JavaScript. Is there a way to "loop" with PHP and
>>"display" an image without re-displaying the whole page?
>>
>>Todd
>
>
> To get a good slideshow you'll need to use client side instructions, aka
> javascript. You're probably not going to get it to work so well using PHP
> which is server side instructions.
>
> Part of getting the slideshow to work is making the browser switch to the
> next image and well, PHP doesn't really make the browser do anything.
>
> --Matthew Sims
> --<http://killermookie.org>
attached mail follows:
On Wednesday 07 July 2004 12:05, Keith Greene wrote:
> on the contrary:
> sql = mysql_query("select * from users where name='".$name."'");
>
> will simply look for a user with a name of "Jim; delete from users;" and
> return no results found.
But I can also enter:
jim'; delete from users
You need to catch if there's a quote in the $name too, and escape that.
RDB
attached mail follows:
> > on the contrary:
> > sql = mysql_query("select * from users where name='".$name."'");
> >
> > will simply look for a user with a name of "Jim; delete from users;" and
> > return no results found.
>
> But I can also enter:
> jim'; delete from users
>
> You need to catch if there's a quote in the $name too, and escape that.
One thing to remember is mysql_query() will execute just one (the first)
query so use of ; won't do anything in the above except break the
query. Still though the point is well taken, be sure to add slashes
(once) and put single quotes around the criteria ($name) and life will be
grand. Quotes around numerical values won't hurt (such as id = '$id')
although it's not required. If you choose not to do that then be sure
it's numerical before use (like cast it as an int, or check
is_numeric(), etc. ...). Some people check for ';' in the request
variable and if found yell at the user, that can be fun. bugs.php.net
does this.
In regards to the controversial magic_quotes_gpc PHP directive, I feel it
should remain on by default but if you know what you're doing then set it
yourself. Scripts that work everywhere should of course work perfectly
with it on or off. php.ini-dist (the default php.ini) has it on while the
php.ini-recommended has it off. You must know what you're doing to use
the 'recommended' version of php.ini. PHP is a newbie friendly language
and newbies are for the most part clueless and don't know what strings or
integers are, or why data should be escaped, or what data validation is or
why it's important. This is why magical quotes exist as without them
just think how many people would keep getting "malicious SQL" in their
code and blame PHP, or how seemingly random SQL syntax errors would crop
up. For these reasons dealing with "Why do I get \' everywhere????" type
questions is worth it, and why magic_quotes_gpc exists as a php.ini
directive.
Regards,
Philip
attached mail follows:
I have a user registration form that asks new users to register. However, Do
I post the MySQLconnection string in the page they are completing or in the
later page that the data is posted to, or both...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
attached mail follows:
On Thursday 08 July 2004 09:59 am, Harlequin wrote:
> I have a user registration form that asks new users to register. However,
> Do I post the MySQLconnection string in the page they are completing or in
> the later page that the data is posted to, or both...?
I don't think I understand your question, but let me take a stab at it anyway.
There should be no reason to pass along the mysql connection ID in a form as
it will be quite useless when the page is submitted because these connections
are dropped when your PHP program ends execution. You will need to make a new
connection to the database in order to store the entered values from a form
submission.
If I didn't get your question right, please be more clear about what you mean
when you say MySQLconnection string.
James Hicks
attached mail follows:
Harlequin wrote:
> I have a user registration form that asks new users to register. However, Do
> I post the MySQLconnection string in the page they are completing or in the
> later page that the data is posted to, or both...?
>
Not sure I follow what you're asking, but you only need to open a
connection to the MySQL server when you want to run queries (select,
insert, update, etc.) against it. If the page with the form on it
doesn't need any mysql data for other parts of the page, then you don't
have to open it there. If you plan on putting the form results into a
db after the user posts it, then you need a connection on that page.
--
John C. Nichel
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
Harlequin wrote:
> I have a user registration form that asks new users to register. However, Do
> I post the MySQLconnection string in the page they are completing or in the
> later page that the data is posted to, or both...?
>
You ought to tell your registration-page to redirect to itself right
after the visitor hit the submit-button of your form.
This should to the trick:
[code]
<form name="form" action="<?php print $_SERVER['PHP_SELF']; ?>"
method="post">
[/code]
Therefore your script will have to check if something has been posted.
[code]
if (!empty($_POST) && isset($_POST['button_name'])) {
// perform validation, insert record into database, etc
}
[/code]
.. might do, while 'button_name' is the name of your form's submit-button.
Note: You should checkout the thread 'Form Submission' started on July
6th since this is appearently not the best way to check if the user hit
the submit-button.
Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
attached mail follows:
July 6th? What are you talking about? Can you please give me more info
about that?
afan
Daniel Kullik wrote:
> Note: You should checkout the thread 'Form Submission' started on July
> 6th since this is appearently not the best way to check if the user
> hit the submit-button.
>
> Daniel
attached mail follows:
Afan Pasalic wrote:
> Daniel Kullik wrote:
>
>> Note: You should checkout the thread 'Form Submission' started on July
>> 6th since this is appearently not the best way to check if the user
>> hit the submit-button.
>>
>> Daniel
>
> July 6th? What are you talking about? Can you please give me more info
> about that?
>
> afan
>
He's saying RTFA.
http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
--
John C. Nichel
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
Afan Pasalic wrote:
> July 6th? What are you talking about? Can you please give me more info
> about that?
>
> afan
>
>
>
> Daniel Kullik wrote:
>
>> Note: You should checkout the thread 'Form Submission' started on July
>> 6th since this is appearently not the best way to check if the user
>> hit the submit-button.
>>
>> Daniel
Hello Afan.
On July 6th 2004 (or 2004-06-07 if you prefer ISO-dates)
shaunthornburgh
hotmail.com started a thread named 'Form Submission'.
That's all.
Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
attached mail follows:
John Nichel wrote:
> Afan Pasalic wrote:
>
>> Daniel Kullik wrote:
>>
>>> Note: You should checkout the thread 'Form Submission' started on
>>> July 6th since this is appearently not the best way to check if the
>>> user hit the submit-button.
>>>
>>> Daniel
>>
>>
>> July 6th? What are you talking about? Can you please give me more info
>> about that?
>>
>> afan
>>
>
> He's saying RTFA.
>
> http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
>
Thanks for that URL, John.
Eventually CVS come to Afan's mind when he read "checkout" and "thread".
Sorry for the confusion.
Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
attached mail follows:
Oh!
:-)
Thanks...
John Nichel wrote:
> Afan Pasalic wrote:
>
>> Daniel Kullik wrote:
>>
>>> Note: You should checkout the thread 'Form Submission' started on
>>> July 6th since this is appearently not the best way to check if the
>>> user hit the submit-button.
>>>
>>> Daniel
>>
>>
>> July 6th? What are you talking about? Can you please give me more
>> info about that?
>>
>> afan
>>
>
> He's saying RTFA.
>
> http://marc.theaimsgroup.com/?l=php-general&m=108910994407822&w=2
>
attached mail follows:
Hi again.
My code simply asks for a username and password but even if they insert
incorrect details the called page is displayed.
How can I get them to be redirected to another page if their login
information is incorrect...?
echo "<p><h2>registerd users login here please...</p></h2>";
echo "<form action = 'members/index.php' method='POST'>";
echo "<pre>UserID:\t\t<input type = 'text' name = 'TXT_UserID'></pre>";
echo "<br><br>";
echo "<pre>Password:\t\t<input type = 'password' name =
'TXT_UserPassword'></pre>";
echo "<br>";
echo "<pre>\t\t<input type='submit' value='Submit Details'</pre>";
echo "</form>";
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
attached mail follows:
Harlequin wrote:
> Hi again.
>
> My code simply asks for a username and password but even if they insert
> incorrect details the called page is displayed.
>
> How can I get them to be redirected to another page if their login
> information is incorrect...?
How are you checking the result? From a db? If so, run your query
before any output to the browser on the page where your form is posted
too (ex. SELECT * FROM users WHERE name = '$name' &&
password='$password'). If your query returns no results, redirect them
with the header() function.
--
John C. Nichel
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
> Hi again.
>
> My code simply asks for a username and password but even if they insert
> incorrect details the called page is displayed.
>
> How can I get them to be redirected to another page if their login
> information is incorrect...?
>
> echo "<p><h2>registerd users login here please...</p></h2>";
> echo "<form action = 'members/index.php' method='POST'>";
> echo "<pre>UserID:\t\t<input type = 'text' name = 'TXT_UserID'></pre>";
> echo "<br><br>";
> echo "<pre>Password:\t\t<input type = 'password' name =
> 'TXT_UserPassword'></pre>";
> echo "<br>";
> echo "<pre>\t\t<input type='submit' value='Submit Details'</pre>";
> echo "</form>";
>
> -----------------------------
> Michael Mason
What I usually do is set the form action to the same page as the above
code is applied to. Then I add an if statement at the top that checks the
login and redirects you to another page if login is successful. I think
you might want to give a name to your submit button as well, something
easy like name='submit'.
Then something like this at the top of the page:
if (isset($_POST["submit"])) {
...get user's password from database...
if ($_POST["password"] == $db["password"]) {
header("Location:members/index.php");
exit;
}
}
So if the login fails, they'll still be sitting at the login page. The
above code needs to be set before any HTML code, else the redirect won't
work.
http://us4.php.net/manual/en/function.header.php
--Matthew Sims
--<http://killermookie.org>
attached mail follows:
I have a site where the user currently enters their data into a local db,
then goes to another site and enters it for the state mls, then uses
realtor.com to enter it for that mls, they want one form where they can
enter the date and have it go to all three. Has anyone worked with
interfacing with other mls databases? This will be done through php.
Thanks,
Eddie
attached mail follows:
Great, i must have done something wrong, it works for me now.
Thanks for all your help :)
Andrew
Tom Rogers wrote:
>Hi,
>
>Thursday, July 8, 2004, 3:38:41 AM, you wrote:
>
>AN> Hmm ... this still echos 0 and not 1. I am using 4.3.7 with all
>AN> warnings on.
>
>AN> Does anyone know how to use this function or anything similiar with
>AN> passing by refernce. Since the call-time pass by reference is
>AN> deprecated, this practice is no longer valid, but there must be a work
>AN> around?
>
>AN> Thanks for any assistance
>AN> Andrew
>
>Strange as it works for me (http://fred.kwikin.com/user.php) with this
>code exactly:
>
><?php
>function fun($arg) {
> $arg++;
>}
>$var = 0;
>echo "Before:$var<br>";
>call_user_func_array("fun", array(&$var));
>echo "After:$var<br>";
>?>
>
>What version of PHP are you using?
>
>
>
>
attached mail follows:
I'm just starting with PHP, and I've been browsing the whole manual to
find how to solve the following problem:
1. An integer number is internally represented in 4 bytes. Say, for
instance, number 65 is represented by 0x00000041, that is the string
"\0\0\0\0x41", and not the string "65".
2. How can I write this representation into a file and then read back it
from the file?
Do you have any idea about this?
Thank you,
Sergio.
attached mail follows:
http://us4.php.net/manual/en/function.base64-decode.php
-----Original Message-----
From: Julio Sergio Santana <ssantana
tlaloc.imta.mx>
Sent: Jul 8, 2004 9:44 AM
To: php-general
lists.php.net
Subject: [PHP] How can I write/read encoded numbers into/from a file?
I'm just starting with PHP, and I've been browsing the whole manual to
find how to solve the following problem:
1. An integer number is internally represented in 4 bytes. Say, for
instance, number 65 is represented by 0x00000041, that is the string
"\0\0\0\0x41", and not the string "65".
2. How can I write this representation into a file and then read back it
from the file?
Do you have any idea about this?
Thank you,
Sergio.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Are you trying read the string '\0\0\0\0x41' from a file? or are you
trying to read these 4 bytes from a file: 00000041 ?
If the latter:
The pack and unpack functions are designed to do this (and more). You
could also manually do it yourself with something like this:
$sBuff = "\0\0\0\0x41"; // Read the data into a var
$iAnswer = ord($sBuff{0}) | ord($sBuff{1}) << 8 | ord($sBuff{2}) << 16
| ord($sBuff{3}) << 24;
// Get the numerical value of each byte, then shift the bytes to get the
4 byte number. (Little Endian)
Chris
Julio Sergio Santana wrote:
> I'm just starting with PHP, and I've been browsing the whole manual to
> find how to solve the following problem:
>
> 1. An integer number is internally represented in 4 bytes. Say, for
> instance, number 65 is represented by 0x00000041, that is the string
> "\0\0\0\0x41", and not the string "65".
> 2. How can I write this representation into a file and then read back
> it from the file?
>
> Do you have any idea about this?
>
> Thank you,
>
>
> Sergio.
>
attached mail follows:
I tried the following and it didn't work:
<?
$i = base64_decode("\0\0\0A"); // I also tried
// $i = base64_decode("\0\0\0\0x41")
// and it didn't work either.
echo "***$i***\n";
?>
X-Powered-By: PHP/4.1.2
Content-type: text/html
******
It was supposed to output:
***65***
deseavers
mindspring.com wrote:
> http://us4.php.net/manual/en/function.base64-decode.php
>
>
> -----Original Message-----
> From: Julio Sergio Santana <ssantana
tlaloc.imta.mx>
> Sent: Jul 8, 2004 9:44 AM
> To: php-general
lists.php.net
> Subject: [PHP] How can I write/read encoded numbers into/from a file?
>
> I'm just starting with PHP, and I've been browsing the whole manual to
> find how to solve the following problem:
>
> 1. An integer number is internally represented in 4 bytes. Say, for
> instance, number 65 is represented by 0x00000041, that is the string
> "\0\0\0\0x41", and not the string "65".
> 2. How can I write this representation into a file and then read back it
> from the file?
>
> Do you have any idea about this?
>
> Thank you,
>
>
> Sergio.
>
attached mail follows:
Thank you Chris. I finally got the solution to my problem using the
pack/unpack functions as you adviced me. The solution is:
<?
$i = 65;
$s = pack("l", $i);
echo strlen($s) . "\n";
echo "***$s***\n";
?>
X-Powered-By: PHP/4.1.2
Content-type: text/html
4
***A*** // This is "\0\0\0A"
Chris wrote:
> Are you trying read the string '\0\0\0\0x41' from a file? or are you
> trying to read these 4 bytes from a file: 00000041 ?
>
> If the latter:
> The pack and unpack functions are designed to do this (and more). You
> could also manually do it yourself with something like this:
>
> $sBuff = "\0\0\0\0x41"; // Read the data into a var
> $iAnswer = ord($sBuff{0}) | ord($sBuff{1}) << 8 | ord($sBuff{2}) << 16
> | ord($sBuff{3}) << 24;
> // Get the numerical value of each byte, then shift the bytes to get the
> 4 byte number. (Little Endian)
>
> Chris
>
> Julio Sergio Santana wrote:
>
>> I'm just starting with PHP, and I've been browsing the whole manual to
>> find how to solve the following problem:
>>
>> 1. An integer number is internally represented in 4 bytes. Say, for
>> instance, number 65 is represented by 0x00000041, that is the string
>> "\0\0\0\0x41", and not the string "65".
>> 2. How can I write this representation into a file and then read back
>> it from the file?
>>
>> Do you have any idea about this?
>>
>> Thank you,
>>
>>
>> Sergio.
>>
attached mail follows:
Thank you Chris. I finally got the solution to my problem using the
pack/unpack functions as you adviced me. The solution is:
<?
$i = 65;
$s = pack("l", $i);
echo strlen($s) . "\n";
echo "***$s***\n";
?>
X-Powered-By: PHP/4.1.2
Content-type: text/html
4
***A*** // This is "\0\0\0A"
Chris wrote:
> Are you trying read the string '\0\0\0\0x41' from a file? or are you
> trying to read these 4 bytes from a file: 00000041 ?
>
> If the latter:
> The pack and unpack functions are designed to do this (and more). You
> could also manually do it yourself with something like this:
>
> $sBuff = "\0\0\0\0x41"; // Read the data into a var
> $iAnswer = ord($sBuff{0}) | ord($sBuff{1}) << 8 | ord($sBuff{2}) << 16
> | ord($sBuff{3}) << 24;
> // Get the numerical value of each byte, then shift the bytes to get the
> 4 byte number. (Little Endian)
>
> Chris
>
> Julio Sergio Santana wrote:
>
>> I'm just starting with PHP, and I've been browsing the whole manual to
>> find how to solve the following problem:
>>
>> 1. An integer number is internally represented in 4 bytes. Say, for
>> instance, number 65 is represented by 0x00000041, that is the string
>> "\0\0\0\0x41", and not the string "65".
>> 2. How can I write this representation into a file and then read back
>> it from the file?
>>
>> Do you have any idea about this?
>>
>> Thank you,
>>
>>
>> Sergio.
>>
attached mail follows:
hello.
in an effort to more easily find products in the cart i'm building
i've given the ability to the user to click a letter from the alphabet
to search for all products whose product id starts with that letter.
currently each letter is hyper linked but i'd like to only link the
letters that have an occurrence in the database. in other words, if
there are no products in the database that start with the letter 'Z'
then i don't want it to have a hyper link.
i'm writing to the list to share my solution to this problem and
hopefully find a better way to do it (if one exists).
here is my solution:
1. pull a list of products from the database
2. truncate each product id down to it's first letter
3. remove all the duplicates
4. use this list to build the links.
as i loop through the alphabet i will only write a link for those
letters that occur in modified list. everything else will just be a
non-linked letter.
it's a pretty easy solution (concerning the logic behind it) but i
don't know if it's the best one and i haven't been able to come up
with anything else.
thanks,
chris.
attached mail follows:
I doubt this function is going to make your script more efficient, but you could also make use of the array_intersect () function.
-----Original Message-----
From: barophobia <barophobia
gmail.com>
Sent: Jul 8, 2004 10:47 AM
To: php-general <php-general
lists.php.net>
Subject: [PHP] Link only active letters in alphabetical search
hello.
in an effort to more easily find products in the cart i'm building
i've given the ability to the user to click a letter from the alphabet
to search for all products whose product id starts with that letter.
currently each letter is hyper linked but i'd like to only link the
letters that have an occurrence in the database. in other words, if
there are no products in the database that start with the letter 'Z'
then i don't want it to have a hyper link.
i'm writing to the list to share my solution to this problem and
hopefully find a better way to do it (if one exists).
here is my solution:
1. pull a list of products from the database
2. truncate each product id down to it's first letter
3. remove all the duplicates
4. use this list to build the links.
as i loop through the alphabet i will only write a link for those
letters that occur in modified list. everything else will just be a
non-linked letter.
it's a pretty easy solution (concerning the logic behind it) but i
don't know if it's the best one and i haven't been able to come up
with anything else.
thanks,
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
[snip]
currently each letter is hyper linked but i'd like to only link the
letters that have an occurrence in the database. in other words, if
there are no products in the database that start with the letter 'Z'
then i don't want it to have a hyper link.
[/snip]
Do it with SQL
SELECT DISTINCT(SUBSTRING(`productName`, 1, 1)) FROM `productTable`
will give you only one of each of the starting letters that actually
occur in your database.
attached mail follows:
> 1. pull a list of products from the database
> 2. truncate each product id down to it's first letter
> 3. remove all the duplicates
> 4. use this list to build the links.
I would let sql do some of the work.
select count(*) from products where product_name like 'A%'
if count does not return 0 you have products that start with A
attached mail follows:
On Thu, 8 Jul 2004 13:14:50 -0500, Jay Blanchard
<jay.blanchard
niicommunications.com> wrote:
> Do it with SQL
>
> SELECT DISTINCT(SUBSTRING(`productName`, 1, 1)) FROM `productTable`
>
> will give you only one of each of the starting letters that actually
> occur in your database.
good job. that works great. it's *much* faster now.
thanks!
chris.
p.s. do you use backticks in all your qeuries?
attached mail follows:
[snip]
p.s. do you use backticks in all your qeuries?
[/snip]
It's just a good habit! :)
attached mail follows:
I have created a script that authenticates to an Active Directory
server. This script works when I try to login, but the problem is that
I have to bind to be able to get "my" dn to be able to authenticate,
but I need authenticate first to be able to get "my" dn. Chicken before
the egg problem.
In the ldap_bind(), I have entered "my" dn to be able to authenticate
for now, but with this I am the only person that would be able to
login.
I could bind to the server twice, once to get an individuals "dn" , set
the variable, and then once I have the "user's" dn I could bind again
as that user, but this seems like it would cause a lot of overhead.
Does anyone have a better way to do this than bind twice?
$dn = "OU=Anoka-Hennepin,DC=ah,DC=isd11";
$filter = "(samaccountname=" . $username . "*)";
$ad = ldap_connect("ldap://172.22.1.20")
or die("Couldn't connect to AD!");
$bd = ldap_bind($ad, "CN=Tuller\,
Mike,OU=Staff,OU=LCDC,OU=Anoka-Hennepin,DC=ah,DC=isd11",$password)
or die("Couldn't bind to AD!");
$result = ldap_search($ad, $dn, $filter);
$entries = ldap_get_entries($ad, $result);
for ($i=0; $i<$entries["count"]; $i++)
{
echo $entries[$i]["dn"];
}
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]