[PHP] strange error
I'm getting this error on a php based ticket system we have. I don't see this on the old server running php4. This new server is running php5. PHP_Fatal_error:__Cannot_use_object_of_type_PEAR_Error_as_array_in_/srv/www/ virtual/support/mailparser.php_on_line_300/ The code in that section looks like this... function firstemail($addrs) { $name=""; $structure = Mail_RFC822::parseAddressList($addrs); $ret= $structure[0]->mailbox."@".$structure[0]->host; ### line 300 is here... if ($ret=="@localhost") $ret=""; else $name=$structure[0]->personal; return array($ret,$name); } Any idea what may be the issue here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] libmm.so.14 SOLVED
> -Original Message- > From: Daniel Brown [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 23, 2007 4:10 PM > To: Jeff Mckeon > Cc: php-general@lists.php.net > Subject: Re: [PHP] libmm.so.14 > > On 10/23/07, Jeff Mckeon <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > > From: Jeff Mckeon [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, October 23, 2007 10:52 AM > > > To: 'Daniel Brown' > > > Cc: php-general@lists.php.net > > > Subject: RE: [PHP] libmm.so.14 > > > > > > > -Original Message- > > > > From: Daniel Brown [mailto:[EMAIL PROTECTED] > > > > Sent: Tuesday, October 23, 2007 10:47 AM > > > > To: Jeff Mckeon > > > > Cc: php-general@lists.php.net > > > > Subject: Re: [PHP] libmm.so.14 > > > > > > > > On 10/23/07, Jeff Mckeon <[EMAIL PROTECTED]> wrote: > > > > > Hey all, > > > > > > > > > > Setting up a php based ticket system on a new OpenSuse 10.3 > 64bit > > > > system. > > > > > > > > > > The ticket sys requires qmail so I had to uninstall postfix and > > > > install > > > > > qmail. > > > > > > > > > > Qmail injects emails into this ticket sys with the following > > > line... > > > > > > > > > > /usr/bin/php -q /srv/www/virtual/support/mailpipe.php > > > > > > > > > > I now get this error however: > > > > > > > > > > /usr/bin/php: error while loading shared libraries: > libmm.so.14: > > > > cannot open > > > > > shared object file: No such file or directory > > > > > > > > > > Libmm.so.14 is installed in: > > > > > > > > > > /usr/lib64/libmm.so.14 > > > > > > > > > > Any idea what it is I'm missing? > > > > > > > > > > Version PHP5 > > > > > > > > > > Thanks, > > > > > > > > > > jeff > > > > > > > > > > -- > > > > > PHP General Mailing List (http://www.php.net/) > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > Check to see where PHP is searching for the extensions. > Chances > > > > are, all you'll need to do is symlink it from the /usr/lib64/ > > > > directory to wherever PHP is expecting to find it. > > > > > > > > Also, be sure it really is still there. When's the last time > you > > > > did a `locate -u` on your server (if that's the method you used)? > It > > > > could be showing an old slocatedb. > > > > > > > > -- > > > > Daniel P. Brown > > > > [office] (570-) 587-7080 Ext. 272 > > > > [mobile] (570-) 766-8107 > > > > > > > > Give a man a fish, he'll eat for a day. Then you'll find out he > was > > > > allergic and is hospitalized. See? No good deed goes > unpunished > > > > > > Tried that, > > > > > > I did a simlink to /usr/lib but it complained that: > > > > > > /usr/bin/php: error while loading shared libraries: libmm.so.14: > wrong > > > ELF > > > class: ELFCLASS64 > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > Ok, removed php and libmm14 and re-installed. Now command line php > works > > but Apache2 is no longer serving php pages. > > > > Re-installed apache2 checked all the config files but I can't seem to > make > > it work. When you go to the site with a php page it offers it as a > > download instead of handing the file off to php to process... UGH!!! > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > 1.) What parameters did you run ./configure with when building PHP > (or did you build automatically with cPanel, etc.)? > 2.) Did you add/uncomment the module entry in httpd.conf? > 3.) Did you restart Apache after everything else was done? > 4.) When attempting to restart Apache, are there any errors? > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 > > Give a man a fish, he'll eat for a day. Then you'll find out he was > allergic and is hospitalized. See? No good deed goes unpunished > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php /etc/sysconfig/apache2 was missing php5 init's module list... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] libmm.so.14
> -Original Message- > From: Jeff Mckeon [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 23, 2007 10:52 AM > To: 'Daniel Brown' > Cc: php-general@lists.php.net > Subject: RE: [PHP] libmm.so.14 > > > -Original Message- > > From: Daniel Brown [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, October 23, 2007 10:47 AM > > To: Jeff Mckeon > > Cc: php-general@lists.php.net > > Subject: Re: [PHP] libmm.so.14 > > > > On 10/23/07, Jeff Mckeon <[EMAIL PROTECTED]> wrote: > > > Hey all, > > > > > > Setting up a php based ticket system on a new OpenSuse 10.3 64bit > > system. > > > > > > The ticket sys requires qmail so I had to uninstall postfix and > > install > > > qmail. > > > > > > Qmail injects emails into this ticket sys with the following > line... > > > > > > /usr/bin/php -q /srv/www/virtual/support/mailpipe.php > > > > > > I now get this error however: > > > > > > /usr/bin/php: error while loading shared libraries: libmm.so.14: > > cannot open > > > shared object file: No such file or directory > > > > > > Libmm.so.14 is installed in: > > > > > > /usr/lib64/libmm.so.14 > > > > > > Any idea what it is I'm missing? > > > > > > Version PHP5 > > > > > > Thanks, > > > > > > jeff > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > Check to see where PHP is searching for the extensions. Chances > > are, all you'll need to do is symlink it from the /usr/lib64/ > > directory to wherever PHP is expecting to find it. > > > > Also, be sure it really is still there. When's the last time you > > did a `locate -u` on your server (if that's the method you used)? It > > could be showing an old slocatedb. > > > > -- > > Daniel P. Brown > > [office] (570-) 587-7080 Ext. 272 > > [mobile] (570-) 766-8107 > > > > Give a man a fish, he'll eat for a day. Then you'll find out he was > > allergic and is hospitalized. See? No good deed goes unpunished > > Tried that, > > I did a simlink to /usr/lib but it complained that: > > /usr/bin/php: error while loading shared libraries: libmm.so.14: wrong > ELF > class: ELFCLASS64 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php Ok, removed php and libmm14 and re-installed. Now command line php works but Apache2 is no longer serving php pages. Re-installed apache2 checked all the config files but I can't seem to make it work. When you go to the site with a php page it offers it as a download instead of handing the file off to php to process... UGH!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] libmm.so.14
> -Original Message- > From: Daniel Brown [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 23, 2007 10:47 AM > To: Jeff Mckeon > Cc: php-general@lists.php.net > Subject: Re: [PHP] libmm.so.14 > > On 10/23/07, Jeff Mckeon <[EMAIL PROTECTED]> wrote: > > Hey all, > > > > Setting up a php based ticket system on a new OpenSuse 10.3 64bit > system. > > > > The ticket sys requires qmail so I had to uninstall postfix and > install > > qmail. > > > > Qmail injects emails into this ticket sys with the following line... > > > > /usr/bin/php -q /srv/www/virtual/support/mailpipe.php > > > > I now get this error however: > > > > /usr/bin/php: error while loading shared libraries: libmm.so.14: > cannot open > > shared object file: No such file or directory > > > > Libmm.so.14 is installed in: > > > > /usr/lib64/libmm.so.14 > > > > Any idea what it is I'm missing? > > > > Version PHP5 > > > > Thanks, > > > > jeff > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > Check to see where PHP is searching for the extensions. Chances > are, all you'll need to do is symlink it from the /usr/lib64/ > directory to wherever PHP is expecting to find it. > > Also, be sure it really is still there. When's the last time you > did a `locate -u` on your server (if that's the method you used)? It > could be showing an old slocatedb. > > -- > Daniel P. Brown > [office] (570-) 587-7080 Ext. 272 > [mobile] (570-) 766-8107 > > Give a man a fish, he'll eat for a day. Then you'll find out he was > allergic and is hospitalized. See? No good deed goes unpunished Tried that, I did a simlink to /usr/lib but it complained that: /usr/bin/php: error while loading shared libraries: libmm.so.14: wrong ELF class: ELFCLASS64 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] libmm.so.14
Hey all, Setting up a php based ticket system on a new OpenSuse 10.3 64bit system. The ticket sys requires qmail so I had to uninstall postfix and install qmail. Qmail injects emails into this ticket sys with the following line... /usr/bin/php -q /srv/www/virtual/support/mailpipe.php I now get this error however: /usr/bin/php: error while loading shared libraries: libmm.so.14: cannot open shared object file: No such file or directory Libmm.so.14 is installed in: /usr/lib64/libmm.so.14 Any idea what it is I'm missing? Version PHP5 Thanks, jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] "!" in front of a variable?
Ok, the variable is boolean and that does make sense. Thanks for all the replies. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
What is it you like about Zend Studio? Jeff > -Original Message- > From: David Grant [mailto:[EMAIL PROTECTED] > Sent: Tuesday, December 06, 2005 09:19 > To: Jeff McKeon > Cc: php > Subject: Re: [PHP] What software do you use for writing PHP? > > > Jeff, > > Jeff McKeon wrote: > > Forever now I've been using Frontpage for all my web work including > > php. I'm sure there's better software out there that is > more suited to > > writing and editing PHP pages. What do you all use? > > I use Zend Studio 5, but there are plenty of other (cheaper) > options. Take a look at the following link for a list of > editors with reviews. > http://www.php-editors.com/review/ Cheers, David Grant -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What software do you use for writing PHP?
Hey all, Forever now I've been using Frontpage for all my web work including php. I'm sure there's better software out there that is more suited to writing and editing PHP pages. What do you all use? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upgrading on RH ES3 [SOLVED]
> -Original Message- > From: Jeff McKeon > Sent: Friday, December 02, 2005 15:18 > To: php > Subject: RE: [PHP] Upgrading on RH ES3 > > > > -Original Message- > > From: Kristen G. Thorson [mailto:[EMAIL PROTECTED] > > Sent: Friday, December 02, 2005 14:50 > > To: Jeff McKeon > > Cc: php > > Subject: Re: [PHP] Upgrading on RH ES3 > > > > > > Jeff McKeon wrote: > > > > >I've got a server with RedHat ES3 running. It has PHP 4.3.2 > > installed > > >but for an application I want to install I need a min of > > 4.3.9. This > > >server also runs apache2.0. > > > > > >I can't find RPMs for RH ES3 so I downloaded the source > for PHP4.4.1 > > >figuring I would just compile myself. Problem is, the > INSTALL file > > >gives instructions based on the idea that you don't already have > > >Apache2 or an earlier ver of PHP Installed already. Since > > Apache2 was > > >installed via RPM originally the INSTALL instruction for PHP with > > >Apache2 prob won't work. > > > > > >./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql > > > > > >It's the: > > > > > >--with-apxs2=/usr/local/apache2/bin/apxs > > > > > >Switch that has got me scratching my head. > > /usr/local/apache2/ doesn't > > >exist and I can't find apxs anywhere on the sys. > > > > > >Can I just configure with ./configure --with-mysql?? > > > > > >Thanks, > > > > > >Jeff > > > > > > > > > > > > > I believe you need the httpd-devel rpm to get apxs2. > > > > > > kgt > > > > Interesting. Would the current ver of php run if I didn't > have httpd-devel installed? What exactly does the switch > --with-apxs2=/usr/local/apache2/bin/apxs do? > > Currently PHP 4.3.2 runs find on this system. > > -- Kristin was correct, I needed to install the rpm for httpd-devel. Thanks Kristin! -Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upgrading on RH ES3
> -Original Message- > From: Kristen G. Thorson [mailto:[EMAIL PROTECTED] > Sent: Friday, December 02, 2005 14:50 > To: Jeff McKeon > Cc: php > Subject: Re: [PHP] Upgrading on RH ES3 > > > Jeff McKeon wrote: > > >I've got a server with RedHat ES3 running. It has PHP 4.3.2 > installed > >but for an application I want to install I need a min of > 4.3.9. This > >server also runs apache2.0. > > > >I can't find RPMs for RH ES3 so I downloaded the source for PHP4.4.1 > >figuring I would just compile myself. Problem is, the INSTALL file > >gives instructions based on the idea that you don't already have > >Apache2 or an earlier ver of PHP Installed already. Since > Apache2 was > >installed via RPM originally the INSTALL instruction for PHP with > >Apache2 prob won't work. > > > >./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql > > > >It's the: > > > >--with-apxs2=/usr/local/apache2/bin/apxs > > > >Switch that has got me scratching my head. > /usr/local/apache2/ doesn't > >exist and I can't find apxs anywhere on the sys. > > > >Can I just configure with ./configure --with-mysql?? > > > >Thanks, > > > >Jeff > > > > > > > > I believe you need the httpd-devel rpm to get apxs2. > > > kgt > Interesting. Would the current ver of php run if I didn't have httpd-devel installed? What exactly does the switch --with-apxs2=/usr/local/apache2/bin/apxs do? Currently PHP 4.3.2 runs find on this system. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upgrading on RH ES3
I've got a server with RedHat ES3 running. It has PHP 4.3.2 installed but for an application I want to install I need a min of 4.3.9. This server also runs apache2.0. I can't find RPMs for RH ES3 so I downloaded the source for PHP4.4.1 figuring I would just compile myself. Problem is, the INSTALL file gives instructions based on the idea that you don't already have Apache2 or an earlier ver of PHP Installed already. Since Apache2 was installed via RPM originally the INSTALL instruction for PHP with Apache2 prob won't work. ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql It's the: --with-apxs2=/usr/local/apache2/bin/apxs Switch that has got me scratching my head. /usr/local/apache2/ doesn't exist and I can't find apxs anywhere on the sys. Can I just configure with ./configure --with-mysql?? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
That won't work. I don't want the users mapping a drive on their local machine. I tried mapping it on the server running the IIS and doing as you suggest, but it doesn't work. Jeff > -Original Message- > From: Clive Zagno [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 10:04 PM > To: php > Subject: Re: [PHP] Copy to network share > > > its on my local machine, in your case it will your w2k box. > > clive > > Jeff McKeon wrote: > > Is that drive mapped on your local machine or on the web server? > > > > Jeff > > > > > >>-Original Message- > >>From: Clive Zagno [mailto:[EMAIL PROTECTED] > >>Sent: Wednesday, June 01, 2005 8:31 PM > >>To: Jeff McKeon; php > >>Subject: Re: [PHP] Copy to network share > >> > >> > >>sorry I ment to send to email to the list > >> > >>I tried the code bellow on my windows machine. I have a > >>mapped network > >>drive on my windows machine (i: drive) that links to a samba > >>share (my > >>htdocs directory on my linux dev machine). It worked fine. > >> > >>echo getcwd(); > >>chdir('i:'); > >>echo ""; > >>echo getcwd(); > >> > >>clive > >> > >> > >> > >>Jeff McKeon wrote: > >> > >>>Yes, doesn't work either > >>> > >>>Jeffrey S. McKeon > >>>Manager of Information Technology > >>>Telaurus Communications LLC > >>>[EMAIL PROTECTED] > >>>+1 (973) 889-8990 ex 209 > >>> > >>> > >>> > >>> > >>>>-Original Message- > >>>>From: Clive Zagno [mailto:[EMAIL PROTECTED] > >>>>Sent: Wednesday, June 01, 2005 8:19 PM > >>>>To: Jeff McKeon > >>>>Subject: Re: [PHP] Copy to network share > >>>> > >>>> > >>>>Hi > >>>> > >>>>jave you tried creating a mapped network drive on windows? > >>>> > >>>>clive > >>>> > >>>> > >>>>Jeff McKeon wrote: > >>>> > >>>> > >>>>>I've got PHP 4.3 running on a Win2k IIS 5.0 web server. > I need to > >>>>>upload a file and then copy it to a samba share (share > >>>> > >>>>level security) > >>>> > >>>> > >>>>>on a linux box across the network. > >>>>> > >>>>>I can > >>>>> > >>>>>$dirhandle = opendir(server\\share); Readdir($dirhandle); > >>>>> > >>>>>With no problem but I can't changed to the that dir to copy the > >>>>>uploaded files to it. > >>>>> > >>>>>I've tried > >>>>> > >>>>>Chdir(server//share); > >>>>> > >>>>>Chdir(server\\share); > >>>>> > >>>>>But it always returns: > >>>>> > >>>>>Warning: chdir(): No such file or directory (errno 2) > >>>>> > >>>>>Is what I'm trying to do possible and if so, how? > >>>>> > >>>>>Many thanks, > >>>>> > >>>>>Jeff > >>>>> > >>>> > >>>> > >>> > >>-- > >>PHP General Mailing List (http://www.php.net/) > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
Is that drive mapped on your local machine or on the web server? Jeff > -Original Message- > From: Clive Zagno [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 8:31 PM > To: Jeff McKeon; php > Subject: Re: [PHP] Copy to network share > > > sorry I ment to send to email to the list > > I tried the code bellow on my windows machine. I have a > mapped network > drive on my windows machine (i: drive) that links to a samba > share (my > htdocs directory on my linux dev machine). It worked fine. > > echo getcwd(); > chdir('i:'); > echo ""; > echo getcwd(); > > clive > > > > Jeff McKeon wrote: > > Yes, doesn't work either > > > > Jeffrey S. McKeon > > Manager of Information Technology > > Telaurus Communications LLC > > [EMAIL PROTECTED] > > +1 (973) 889-8990 ex 209 > > > > > > > >>-Original Message- > >>From: Clive Zagno [mailto:[EMAIL PROTECTED] > >>Sent: Wednesday, June 01, 2005 8:19 PM > >>To: Jeff McKeon > >>Subject: Re: [PHP] Copy to network share > >> > >> > >>Hi > >> > >>jave you tried creating a mapped network drive on windows? > >> > >>clive > >> > >> > >>Jeff McKeon wrote: > >> > >>>I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to > >>>upload a file and then copy it to a samba share (share > >> > >>level security) > >> > >>>on a linux box across the network. > >>> > >>>I can > >>> > >>>$dirhandle = opendir(server\\share); Readdir($dirhandle); > >>> > >>>With no problem but I can't changed to the that dir to copy the > >>>uploaded files to it. > >>> > >>>I've tried > >>> > >>>Chdir(server//share); > >>> > >>>Chdir(server\\share); > >>> > >>>But it always returns: > >>> > >>>Warning: chdir(): No such file or directory (errno 2) > >>> > >>>Is what I'm trying to do possible and if so, how? > >>> > >>>Many thanks, > >>> > >>>Jeff > >>> > >> > >> > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
All, The syntax is correct... It's not a quotes problem. I have the path in quotes in my actual code. Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 > -Original Message- > From: Andy Pieters [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 9:34 AM > To: php-general@lists.php.net > Subject: Re: [PHP] Copy to network share > > > On Wednesday 01 June 2005 14:42, Jeff McKeon wrote: > > > > $dirhandle = opendir(server\\share); > > Readdir($dirhandle); > > > > Chdir(server//share); > > > > Chdir(server\\share); > > > > > Warning: chdir(): No such file or directory (errno 2) > > > > Is what I'm trying to do possible and if so, how? > > You should put the dirname in quotes > > Like $dirhandle=opendir("Server\\Share"); > > > Regards > > > Andy > > -- > Registered Linux User Number 379093 > -- --BEGIN GEEK CODE BLOCK- > Version: 3.1 > GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++ > L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) > PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) > D+(+++) G(+) > e>$@ h++(*) r-->++ y--()> > -- ---END GEEK CODE BLOCK-- > -- > Check out these few php utilities that I released > under the GPL2 and that are meant for use with a > php cli binary: > http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy to network share
I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File_get_contents()
Because I was unclear on how file_get_contents() worked... :o) The php manual is a little vague on the topic. Best Reguards, Jeff McKeon IT Manager Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 > -Original Message- > From: Josip Dzolonga [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 07, 2005 8:11 AM > To: Jeff McKeon > Cc: php-general@lists.php.net > Subject: Re: [PHP] File_get_contents() > > > Jeff McKeon wrote: > > >Does anyone know if it's possible to have > file_get_contents() accept a > >file handle? > > > > > Why would you need that ? > > -- > Josip Dzolonga > http://josip.dotgeek.org > > jdzolonga[at]gmail.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File_get_contents()
Thanks!!! > -Original Message- > From: Franklin van de Meent [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 07, 2005 7:34 AM > To: php-general@lists.php.net > Subject: Re: [PHP] File_get_contents() > > > If you have set allow_url_fopen to On in your php.ini, > file_get_contents('php://stdin'); should work > > > On Apr 7, 2005 2:21 PM, Jeff McKeon <[EMAIL PROTECTED]> wrote: > > > > Sorry, > > > > What I'm actually doing is this. > > > > $handle=fopen("php//stdin/","r"); > > file_get_contents($handle); > > > > I should have put that in the original post, my bad. > > > > Now that I look at it, does anyone think this would work... > > > > file_get_contents("php//stdin/"); > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File_get_contents()
> > > -Original Message- > > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > > Sent: 7 April 2005 1:03 pm > > To: php-general@lists.php.net > > Subject: [PHP] File_get_contents() > > > > > > Does anyone know if it's possible to have > file_get_contents() accept a > > file handle? > > > > $handle=fopen("/tmp/file","r"); > > file_get_contents($handle); > > > > This doesn't seem to work for me, it generates an error about first > > parameter needing to be a string. > > > > I've tried: > > > > file_get_contents('{$handle}'); > > > > But that doesn't work either... > > > > Thanks, > > > > jeff > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -Original Message- > From: George Pitcher [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 07, 2005 7:17 AM > To: Jeff McKeon > Subject: RE: [PHP] File_get_contents() > > > Jeff, > > Do you need to give it a handle? You can just point > 'file_get_contents' to the file, unopened. > > eg: file_get_contents("/tmp/file"); > > 'file_get_contents' can only read the contents so there's no > requirement to set a 'read' option. > > George > Sorry, What I'm actually doing is this. $handle=fopen("php//stdin/","r"); file_get_contents($handle); I should have put that in the original post, my bad. Now that I look at it, does anyone think this would work... file_get_contents("php//stdin/"); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File_get_contents()
Does anyone know if it's possible to have file_get_contents() accept a file handle? $handle=fopen("/tmp/file","r"); file_get_contents($handle); This doesn't seem to work for me, it generates an error about first parameter needing to be a string. I've tried: file_get_contents('{$handle}'); But that doesn't work either... Thanks, jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Tool to answer emails
www.eforcer.com It's a fairly cheap but very good ticket system that can auto inject emails into it or retrieve them from a pop account. Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 > -Original Message- > From: Daniel Baughman [mailto:[EMAIL PROTECTED] > Sent: Monday, April 04, 2005 7:57 PM > To: php-general@lists.php.net > Subject: [PHP] PHP Tool to answer emails > > > Hi all, > > > > I am looking for a php tool that will provide email tracking > and a web interface to an email box. Pretty much, we get > lots of emails directed to an administrative email account > (most of the valid emails) that need response. To the point > that one person is getting over whelmed. > > > > It would be nice if someone had a tool already made that > would check the box, download the email, mark the receipt > time, then present them to be answered on a web site for > employees, document the answer, etc. etc.. > > > > Anyone know of anything? > > > > > > Dan Baughman > > IT Technician > > Professional Bull Riders, Inc. > > 719-471-3008 x 3161 > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Piping email into a php script
Running PHP 4.3.9, apache, mysql, qmail I know it's possible to pipe an incoming mail message to a script in qmial by creating a .qmail file for the user like: |script What I'd like to do is pipe incoming mail for a specific user into a php script that parses it out (using mailparse I imagine) and puts the pieces into a database table. On PHP.net I see an example like this on the function page for Mailparse: [SNIP] [SNIP] This looks like it will work so long as I put the required database interface code in the "foreach" section. However I'm a little stuck on how to actually pipe the file into the script so that it winds up in the $buffer variable. Can anyone give me a clue as to how I can do this? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD Module
I've been searching the net all moring for this. Can anyone give me a link were I can find information on how to compile PHP with GD module support? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re:[PHP] Magic-quotes
So now the big question which will undoubtly spark a lot of opinions (I hope). We use apache/php/mysql based sites for internal management of our systems and would now like to give our customers direct access to manage their accounts via the web. Naturally this raises security concerns. >From the PHP perspective, is Apache/PHP(as Module)/MySQL a secure enough platform to use for a public website that will access a production database? Opinions? Thoughts? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Magic-quotes
> -Original Message- > From: Robert Cummings [mailto:[EMAIL PROTECTED] > Sent: Monday, December 06, 2004 1:45 PM > To: Jeff McKeon > Cc: PHP-General > Subject: Re: [PHP] Magic-quotes > > > On Mon, 2004-12-06 at 12:57, Jeff McKeon wrote: > > Does having magic-quotes=on prevent an attacker from using > a urlized > > sql inject query? > > Somewhat, but I think magic_quotes=off is the preferred style > since magic quotes are a big headache for portability. At any > rate, understanding what you are doing and acting accordingly > will provide you with better security. There is no "magic > pill" for security. > > Cheers, > Rob. > Portability is not an objective here per say. I'm aware of many of the security issues surrounding PHP, just trying to understand the specifics of each one so that I can weigh the plus/minus of it to my needs. Assuming I have no portability needs and have magic_quotes=on, can you elaborate on "somewhat?" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Magic-quotes
Does having magic-quotes=on prevent an attacker from using a urlized sql inject query? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Just prove's the saying "Make something idiot proof and someone will invent a better idiot" Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:20 AM To: [EMAIL PROTECTED] Subject: [PHP] UNSUBSCRIBE Thank you, Denise Holland ITM - Network Support 703-358-1823 [EMAIL PROTECTED] __ Thank you, Denise Holland ITM - Network Support 703-358-1823 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Searching My Database
It sounds like what you need to do is create several different queries based upon what the user selects from a form.. For instance... Form fields: A,B,C,D (Drop downs are best for these field entries because you can control them, if not it's just a little tougher.) IF(isset($_POST['A'])) { $whereA = "&& Blah = ".$_POST['A']; } IF(isset($_POST['B'])) { $whereB = "&& Bloh = ".$_POST['B']; } IF(isset($_POST['C'])) { $whereC = "&& Blih >= ".$_POST['C']; } IF(isset($_POST['D'])) { $whereD = "&& Bluh = ".$_POST['D']; } $query = "select * from table where something = somthingelse $whereA $whereB $whereC $whereD"; This is the general idea. If there is no $_POST['B'] then $whereB will be nothing and not interfer. You can expand the if statements above to include settings for grouping etc.. Someone out there prob has a better way but that's generally how I do it. Just a note, with mysql you can use a $_POST[] type variable directly in a query if you surround it with {} So... $query = "Select * from table where field1 = '{$_POST['blah']}'"; Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: David Arkell [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 9:35 AM To: Harlequin; [EMAIL PROTECTED] Subject: RE: [PHP] Searching My Database Maybe what you want is if (isset($_POST['WorkPermit'])) { $WorkPermit = $_POST['WorkPermit']; // do the select statement } else echo "no search"; } -Original Message- From: Harlequin [mailto:[EMAIL PROTECTED] Sent: 29 September 2004 08:15 To: [EMAIL PROTECTED] Subject: [PHP] Searching My Database Morning everyone. I've read around the subject of searching and although using the FULLTEXT capability of MySQL might be the proper way of doing this I feel it's somewhat limited and have decided to use a simple select procedure. I'm sure there's a better way of doing this, as I'm quite new to MySQL and even newer to searches, However - here's my conundrum: I'm declaring variables at the top of my query like so: Code: $WorkPermit == '" . $_POST["WorkPermit"] . "'; And then execute the query like so: Code: SELECT * FROM MembersData WHERE `Work_Permit_Rqd` LIKE '$WorkPermit' But I have many other fields that the searcher can use. What do I do if they leave this field blank...? I appreciate that I should be using the MATCH function but I'm not entirely happy with the way it searches. What I need to do is actually omit a field (s) from the search if the value the searcher submitted was NULL. For example: Search field X and Y and Z and if x or Y are null continue... Am I explaining this OK...? Any suggestions gratefully received. -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ DDB London - Effectiveness Agency of the Year DDB Worldwide - Global Network of the Year The Information given in the above email and / or attachment is provided without warranty of any kind, either expressed or implied on the part of the writer or the Agency. __ This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.messagelabs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Call to external function
> > OnLoad is probably occuring after your you're 'stop' call. > Onload generally will be called when the document gets fully > loaded. Instead put the 'go' call in the of your document. > > > > function('go'); > > ... > > > function('stop') > > > > Weird that works when the site is on an apache server but doesn't when it's on a MS IIS server. Actually the apache server is the reason I needed this functionalitly. When the site is on a MS IIS server the little flag in IE keeps waving while the php script runs. In Apache, it doesn't. If you don't look at the status bar in IE it and see that it still says "loading http://blahblah"; appears that the page has already loaded... jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Call to external function
> > No... PHP and JavaScript are executing at different time and > at different place. Besides, they are executed by different programs. > > Are you trying to measure execution time of a query?? > > Look at: > http://www.php.net/microtime No, I'm trying to get a little animation on the left frame to start when a query begins a pull (when the page begins to load) and then stop the animation when the page and data are fully loaded. The top part of the page loads, and then the table containing the data from the mysql pull takes a while. I want something to show the user that the server is still "thinking". Jeff McKeon IT Manager Telaurus Communications LLC [EMAIL PROTECTED] (973) 889-8990 ex 209 ***The information contained in this communication is confidential. It is intended only for the sole use of the recipient named above and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication, or any of its contents or attachments, is expressly prohibited. If you have received this communication in error, please re-send it to the sender and delete the original message, and any copy of it, from your computer system. Thank You.*** > -Original Message- > From: William Lovaton [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 12:39 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Call to external function > > > No... PHP and JavaScript are executing at different time and > at different place. Besides, they are executed by different programs. > > Are you trying to measure execution time of a query?? > > Look at: > http://www.php.net/microtime > > > -William > > > El vie, 23-04-2004 a las 09:09, Jeff McKeon escribió: > > Is there a way in PHP to make a call to a javascript funtion? > > > > I have a javascript that I want to start when an sql query > begins and > > stop when the php code is done. Is this possible? > > > > Thanks, > > > > Jeff > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OK SQL experts...
> >> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR > >> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND > >> 'status' = 'active'; Longshot but try to remove the ' ' from around the field names in the where statement.. Or SELECT * FROM My_Table WHERE field_1 like '%$keyword%' && status = 'active' || field_2 like '%$keyword%' && status = 'active' || field_3 like '%$keyword%' && status = 'active' Jeff > -Original Message- > From: Brian Dunning [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 11:30 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] OK SQL experts... > > > It gives the same error when I run it in phpmyadmin. > > > On Apr 23, 2004, at 8:34 AM, Edward Peloke wrote: > > > does it just return the error when running in the php page? If you > > pull it > > out can you run it in mysql without errors? > > > > -Original Message- > > From: Brian Dunning [mailto:[EMAIL PROTECTED] > > Sent: Friday, April 23, 2004 11:23 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] OK SQL experts... > > > > > > I tried it both ways - didn't make any difference > (phpmyadmin adds the > > single quotes when I was trying to use its sql function to > debug, so I > > figured what the hell)... > > > > > > On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote: > > > >> why are the table and field names surrounded by single quotes? > >> > >> -Original Message- > >> From: Brian Dunning [mailto:[EMAIL PROTECTED] > >> Sent: Friday, April 23, 2004 11:19 AM > >> To: [EMAIL PROTECTED] > >> Subject: [PHP] OK SQL experts... > >> > >> > >> I STFW and RTFM and I still can't figure out why this > returns a 1064 > >> parse error: > >> > >> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR > >> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND > >> 'status' = 'active'; > >> > >> Anyone? TIA! > >> > >> - B1ff Lamer > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > >> > > - Brian > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > - Brian > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Call to external function
> > [snip] > Is this possible? > [/snip] > > Anything is possible! > > Have you considered echoing the javascript code out via PHP? > Yes, but I can't seem to get the right javascript code figured out. I have the script start when the page loads with an onload=function('go') in the tag. But I need someway to turn it off... A simple: Echo "function('stop')"; at the end of the page doesn't seem to work. Should it? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Call to external function
Is there a way in PHP to make a call to a javascript funtion? I have a javascript that I want to start when an sql query begins and stop when the php code is done. Is this possible? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Activate function in another frame
> > JavaScript is your friend. > Yeah I thought it would probably involve some javascript. I'm just not very good at it and not sure how to refernce the other window in a frameset. I know there is a way, I just don't know the mechanics of it. Jeff > -Original Message- > From: Jay Blanchard [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 22, 2004 9:20 AM > To: Jeff McKeon; [EMAIL PROTECTED] > Subject: RE: [PHP] Activate function in another frame > > > [snip] > Is there a way to start a process in the menuframe as soon as > a page in the main frame begins to load and then kill it when > the main page is finished loading? [/snip] > > JavaScript is your friend. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Activate function in another frame
My PHP website displays data from our database. Sometimes the sql pulls take a while. I'd like to give some visual aid to the user that the script is still working. The site is made up of two frames, a left side frame that contains the menu and a main frame that all the pages load into. Is there a way to start a process in the menuframe as soon as a page in the main frame begins to load and then kill it when the main page is finished loading? The idea here is to put some kind of function with an animated gif or progress bar in the left side frame page and start it running as a page is loading in the main frame, then stop the function after the page in the main frame has finished loading. Thanks! Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upload file form SOLVED
The problem is solved. /etc/httpd/conf.d/php.conf the parameter LimitRequestBody is set to 524288 by default. Jeff > -Original Message- > From: Jeff McKeon > Sent: Tuesday, April 20, 2004 10:48 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Upload file form > > > > -Original Message- > > From: Jeff McKeon > > Sent: Tuesday, April 20, 2004 10:21 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Upload file form > > > > > > Ok, not exactly pure PHP problem but I hope someone here has > > seen this before.. > > > > I'm got an upload form on a webpage, here's the code: > > > > SNIP > > > > ?> > > Select the file type and browse for that file. The press > > 'Upload'. The file will be uploaded to the server. No changes > > in the database are done during this step. > > > > > ACTION=""> Form action: > > Select CDR file type: > > > value='1:Stratos'>Stratos > > MVS > > Xantic > > > > > > > > Browse for the file > > > > > > > TYPE="HIDDEN" NAME="uid" VALUE="[OpSup]jsm"> CDR File: > TYPE="FILE" NAME="file1" SIZE="80"> > TYPE="SUBMIT" VALUE="Upload"> > > > > > > > SNIP > > > > I'm running this page on Redhat Linux 9 with an Apache ver 2 > > webserver. The site itself is a virtualName site (All virutal > > sites share the same IP address). > > > > When I browse for the tile and select it, then press the > > submit button, Instead of getting a delay as the file > > uploads, I get an instant error page from the browers: > > > > The page cannot be displayed: Cannot file server or DNS Error > > > > Any ideas? > > > > It appears that it may be a filesize issue. I made a small > text file and it uploaded fine, a 13MB csv however causes the problem. > > In php.ini > > I've set the Max_file_uplode = 20M > > But still have the problem. > > Thanks, > > Jeff > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upload file form
> -Original Message- > From: Jeff McKeon > Sent: Tuesday, April 20, 2004 10:21 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Upload file form > > > Ok, not exactly pure PHP problem but I hope someone here has > seen this before.. > > I'm got an upload form on a webpage, here's the code: > > SNIP > > ?> > Select the file type and browse for that file. The press > 'Upload'. The file will be uploaded to the server. No changes > in the database are done during this step. > > ACTION=""> Form action: > Select CDR file type: > value='1:Stratos'>Stratos > MVS > Xantic > > > > Browse for the file > > > TYPE="HIDDEN" NAME="uid" VALUE="[OpSup]jsm"> CDR File: TYPE="FILE" NAME="file1" SIZE="80"> TYPE="SUBMIT" VALUE="Upload"> > > > SNIP > > I'm running this page on Redhat Linux 9 with an Apache ver 2 > webserver. The site itself is a virtualName site (All virutal > sites share the same IP address). > > When I browse for the tile and select it, then press the > submit button, Instead of getting a delay as the file > uploads, I get an instant error page from the browers: > > The page cannot be displayed: Cannot file server or DNS Error > > Any ideas? > It appears that it may be a filesize issue. I made a small text file and it uploaded fine, a 13MB csv however causes the problem. In php.ini I've set the Max_file_uplode = 20M But still have the problem. Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload file form
Ok, not exactly pure PHP problem but I hope someone here has seen this before.. I'm got an upload form on a webpage, here's the code: SNIP ?> Select the file type and browse for that file. The press 'Upload'. The file will be uploaded to the server. No changes in the database are done during this step. Form action: Select CDR file type: Stratos MVS Xantic Browse for the file CDR File: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Preg_match_all problem
Can anyone see why I'm getting this error message: "Warning: No ending delimiter '^' found in C:\Inetpub\wwwMIS_DEV\import_mvs.inc.php on line 126" >From this line: if(preg_match_all("^([00])?.*$",$called,$found)) { substring($called,2,9); } I basically have a phone bill that sometimes has the phone number preceeded by "00" and sometimes not. When it has the "00" I want to trim it with the substring command. Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File upload progress
> > I posted about this the other day. I was directed to look at > megaupload http://www.raditha.com/megaupload/ > > It works pretty well, I believe it uses Apache::Request to > get the raw post info. > Unfortunately, the web server being used is IIS on a Windows Server, not Apache > Issues in general: > Whenever this issue comes up people will ask why you need the > functionality? I have a client that is in the print industry > who receives 50+Meg files. I know for a fact that PHP can add > this functionality internally, but thus far have chosen not > too. In a perfect world it would have been part of the HTTP > spec and all browsers would POST the total byte size and > generate a meter just like with downloads. > > Does anyone else think its time to rewrite all the protocols? > > Sorry for the rant, stuff like this bugs the hell out of me. > > Steve > > > > -Original Message- > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 06, 2004 4:40 PM > To: [EMAIL PROTECTED] > Subject: [PHP] File upload progress > > > Does anyone know of a way to display the %complete of a file > upload using a form (POST) method? > > In other words, I have a form for uploading files to the > server. The files are pretty large, 50,000+ lines and it > takes a good 3-4 minutes to upload. Is there any way to show > the progress of this upload on the page? > > Thanks, > > Jeff > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File upload progress
> -Original Message- > From: Steve Murphy [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 06, 2004 4:58 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] File upload progress > > > I posted about this the other day. I was directed to look at > megaupload http://www.raditha.com/megaupload/ > > It works pretty well, I believe it uses Apache::Request to > get the raw post info. > > Issues in general: > Whenever this issue comes up people will ask why you need the > functionality? I have a client that is in the print industry > who receives 50+Meg files. I know for a fact that PHP can add > this functionality internally, but thus far have chosen not > too. In a perfect world it would have been part of the HTTP > spec and all browsers would POST the total byte size and > generate a meter just like with downloads. > > Does anyone else think its time to rewrite all the protocols? > > Sorry for the rant, stuff like this bugs the hell out of me. > Steve, I agree with you there. For tech savy people not having the progress bar or indicator for file uploads isn't a big deal. For the average "dumb user" however it's a necessity. I have users tell me all the time that my PHP pages don't work only to find out that they put in a query parameter that caused a huge database pull and they didn't know that as long as that little flag in IE is still waving, it's still working... > Steve > > > > -Original Message- > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 06, 2004 4:40 PM > To: [EMAIL PROTECTED] > Subject: [PHP] File upload progress > > > Does anyone know of a way to display the %complete of a file > upload using a form (POST) method? > > In other words, I have a form for uploading files to the > server. The files are pretty large, 50,000+ lines and it > takes a good 3-4 minutes to upload. Is there any way to show > the progress of this upload on the page? > > Thanks, > > Jeff > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload progress
Does anyone know of a way to display the %complete of a file upload using a form (POST) method? In other words, I have a form for uploading files to the server. The files are pretty large, 50,000+ lines and it takes a good 3-4 minutes to upload. Is there any way to show the progress of this upload on the page? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Ereg problems
> -Original Message- > From: Curt Zirzow [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 25, 2004 6:55 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Ereg problems > > > On Thu, 25 Mar 2004 18:31:02 -0500, Jeff McKeon > <[EMAIL PROTECTED]> > wrote: > > > Having some problems with ereg() > > > > [begin code] > > > > $string="Credit adjusted: $-1.32 to $48.68" > > > > ereg("([\\$(\\$-)][0-9]+\.[0-9]+)",$data[2],$found); > > > > While(list($index,$hits)=each($found)) > > { > > echo "$index , $hits"; > > } > > [end code] > > you assigned $string but used $data[2]? > whoops, that was a leftover from the actual app that was parsing a field pulled from a database query. Forgot to correct that when I posted. > > I would suggest using pcre instead of Posix: > > preg_match_all('($-?[0-9]+\.[0-9]+)', $string, $found); > print_r($found); > That produces: Array ( [0] => Array ( ) ) 0 , Array > > Curt. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ereg problems
Having some problems with ereg() [begin code] $string="Credit adjusted: $-1.32 to $48.68" ereg("([\\$(\\$-)][0-9]+\.[0-9]+)",$data[2],$found); While(list($index,$hits)=each($found)) { echo "$index , $hits"; } [end code] Returns 0 , $48.68 1 , $48.68 Am I doing something wrong with my regex or is there a problem here. What I need is all the dollar amounts pulled out (with a negative sign if there). Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Stupid question
Ewe... OOP Ok, I guess I'll have to learn OOP. Thanks for the info! Jeff > -Original Message- > From: Jordan S. Jones [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 17, 2004 4:02 PM > To: Jeff McKeon > Subject: Re: [PHP] Stupid question > > > That has to deal with Object Oriented programming, and instead of > fumbling my way through trying to explain it, I will point you to the > PHP documents that deal with this. > > Overview: > http://www.php.net/manual/en/language.oop.php > > OO Functions/what not: http://www.php.net/manual/en/ref.classobj.php > > Jordan S. Jones > > Jeff McKeon wrote: > > >I've been using PHP for about 6 months and I'm ok with it > but I'm now > >starting to get into more advanced stuff and inheriting project that > >other people have coded. One of the major stumpers I have > is any line > >of code that contains: > > > >$this-> > > > >What does this do? I know it has something to do with classes but > >can't quite get my head around it. > > > >Thanks, > > > >Jeff > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stupid question
I've been using PHP for about 6 months and I'm ok with it but I'm now starting to get into more advanced stuff and inheriting project that other people have coded. One of the major stumpers I have is any line of code that contains: $this-> What does this do? I know it has something to do with classes but can't quite get my head around it. Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session management
Here's how I do it. User table in mysql UserID, username, password, admin, read, write 1001, John, *#&(@&(@, 0, 1, 0 1002, betty, KD)&#(&S, 1, 1, 1 Create a login form. Get their username and password, Run a query to pull the record where username and password match If the username is in the table and the password is correct then $_SESSION['userid'] = UserID (pulled from db query) $_SESSION['admin'] = admin $_SESSION['read'] = read $_SESSION['write'] = write Then create a function to check permissions based on the session variable. For instance if a page has a form for editing information, before loading the form check to see if the Current $_SESSION['write'] variable is set to '1', if so load the form, if not then don't. May not be the best way of doing things but it works well for me. Jeff McKeon IT Manager Telaurus Communications LLC [EMAIL PROTECTED] (973) 889-8990 ex 209 ***The information contained in this communication is confidential. It is intended only for the sole use of the recipient named above and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication, or any of its contents or attachments, is expressly prohibited. If you have received this communication in error, please re-send it to the sender and delete the original message, and any copy of it, from your computer system. Thank You.*** > -Original Message- > From: ajay [mailto:[EMAIL PROTECTED] > Sent: Friday, January 30, 2004 12:56 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] session management > > > hi! > > well i do have a MySQL database. The scenario is this, i dont > want to use cookies or do any URL rewriting. i'm looking for > something that mirrors J2EE's Session object that contains > information about the user, their security level(user/admin > etc) and this information can then be verified before each > request. There would ofcourse be an expiry on the object. Is > there a prewritten framework/class to handle this? > > thanks > > regards > > -- > ajay > --- > Who Dares Wins > > - > This mail sent through IMP: www-mail.usyd.edu.au > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions not working.
Figured it out, I think. PHP doesn't like the underscore in my website name. http://site_dev.foo.com/ doesn't work but http://192.168.2.50/ does. If I rename the site in DNS to siteDEV.foo.com then it works fine. Any ideas why? -Original Message----- From: Jeff McKeon Sent: Thursday, January 29, 2004 2:48 PM To: Jeff McKeon; Gryffyn, Trevor; [EMAIL PROTECTED] Subject: RE: [PHP] Sessions not working. Ok, there seems to be some confusion about my setup so here it is again.. I have 1 physical server runing win2k server with IIS-5 I have 4 virtual web servers configured in IIS-5, each with it's own IP address. Site1,Site2,Site1DEV,Site2DEV All using the same php.ini and all set up identically in IIS (as far as I can tell). Site1 has no problems saving or passing $_session[] variables between pages. Site1DEV, currently and exact copy of Site1, will not pass $_session[] variables between pages. Session_test.php "; echo "PHP Session Is Set!"; echo "The session is set! The PHPSESSID is: $sid Text = $text and userid = $userid"; echo "link"; echo ""; } else { echo ""; echo "PHP Session Is NOT Set!"; echo "The session is NOT set! Check your server configuration or version."; echo ""; } ?> Session_test2.php On Site1 this works fine. You get the sessionID and a link to session_test2.php. When you follow the link, session_test2.php displays the contents of the $_SESSION['user'] variable. On Site1DEV however, you see the sessionID on session_test.php and the $_SESSION['user'] variable, but when you follow the link to session_test2.php, the contents of the $_SESSION['user'] are blank. What could be missing here in my server setup? Thanks, jeff -Original Message- From: Jeff McKeon Sent: Thursday, January 29, 2004 11:49 AM To: Gryffyn, Trevor; [EMAIL PROTECTED] Subject: RE: [PHP] Sessions not working. Further info. If I echo the session_id() onto the page I do get an id returned. So (correct me if I'm wrong) the session has started correctly with the session_start() at the top of the page. It just doesn't seem to save any of the session variables I set, or if they are set, it can't retrieve them. I get this error when trying to grab the $session['userid'] variable... Notice: Undefined index: userid in C:\Inetpub\wwwOpSupDev\main.php on line 37 -Original Message- From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 9:19 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Sessions not working. Random thought.. Did you check your PHP.INI on the 'bad' server to make sure that it's configured the same as the 'good' server? Some things to check: Session.use_cookies = 1 Session.auto_start = 0 // This is the first one I'd check. If you have it set to =1 on the good server and aren't doing a session_start(), that could do it I think There are a bunch of other Session related parameters in PHP.INI.. Default timeout value.. If that's set too low, the session might vaporize before you get a chance to see the info, etc. Good luck! -TG > -Original Message- > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 28, 2004 7:44 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Sessions not working. > > > Pulling my hair out here. > > I've got an IIS5 webserver running a php website just fine. > > I created another web for a dev version of the first website. > Installed PHP ect... > When I load up the old websites files on the new site sessions won't > work on the new site. > > For some reason on the new site's phpinfo.php page, there is no > HTTP_COOKIE variable set under the "environmental" section. > > Also, under the PHP Variables section, there is no > _REQUEST["PHPSESSID"] or _COOKIE["PHPSESSID"] variable. > > What have I missed!??? > > Here is a section of the phpinfo() for both sites. > > Good Site: > > Environment > Variable Value > ALLUSERSPROFILE C:\Documents and Settings\All Users > CommonProgramFiles C:\Program Files\Common Files > COMPUTERNAME WS02TC07927 > ComSpec C:\WINNT\system32\cmd.exe > CONTENT_LENGTH 0 > GATEWAY_INTERFACE CGI/1.1 > HTTPS off > HTTP_ACCEPT */* > HTTP_ACCEPT_LANGUAGE en-us > HTTP_CONNECTION Keep-Alive > HTTP_HOST opsup.telaurus.net > HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) > HTTP_COOKIE PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f > HTTP_ACCEPT_ENCODING gzip, deflate > INSTANCE_ID 3 > LOCAL_ADDR 10.16.1.21 > NUMBER_OF_PROCESSORS 1 > Os2LibPath C:\WINNT\system32\os2\dll; > OS Windows_NT > Path C:\WINN
RE: [PHP] Sessions not working.
Ok, there seems to be some confusion about my setup so here it is again.. I have 1 physical server runing win2k server with IIS-5 I have 4 virtual web servers configured in IIS-5, each with it's own IP address. Site1,Site2,Site1DEV,Site2DEV All using the same php.ini and all set up identically in IIS (as far as I can tell). Site1 has no problems saving or passing $_session[] variables between pages. Site1DEV, currently and exact copy of Site1, will not pass $_session[] variables between pages. Session_test.php "; echo "PHP Session Is Set!"; echo "The session is set! The PHPSESSID is: $sid Text = $text and userid = $userid"; echo "link"; echo ""; } else { echo ""; echo "PHP Session Is NOT Set!"; echo "The session is NOT set! Check your server configuration or version."; echo ""; } ?> Session_test2.php On Site1 this works fine. You get the sessionID and a link to session_test2.php. When you follow the link, session_test2.php displays the contents of the $_SESSION['user'] variable. On Site1DEV however, you see the sessionID on session_test.php and the $_SESSION['user'] variable, but when you follow the link to session_test2.php, the contents of the $_SESSION['user'] are blank. What could be missing here in my server setup? Thanks, jeff -Original Message- From: Jeff McKeon Sent: Thursday, January 29, 2004 11:49 AM To: Gryffyn, Trevor; [EMAIL PROTECTED] Subject: RE: [PHP] Sessions not working. Further info. If I echo the session_id() onto the page I do get an id returned. So (correct me if I'm wrong) the session has started correctly with the session_start() at the top of the page. It just doesn't seem to save any of the session variables I set, or if they are set, it can't retrieve them. I get this error when trying to grab the $session['userid'] variable... Notice: Undefined index: userid in C:\Inetpub\wwwOpSupDev\main.php on line 37 -Original Message- From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 9:19 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Sessions not working. Random thought.. Did you check your PHP.INI on the 'bad' server to make sure that it's configured the same as the 'good' server? Some things to check: Session.use_cookies = 1 Session.auto_start = 0 // This is the first one I'd check. If you have it set to =1 on the good server and aren't doing a session_start(), that could do it I think There are a bunch of other Session related parameters in PHP.INI.. Default timeout value.. If that's set too low, the session might vaporize before you get a chance to see the info, etc. Good luck! -TG > -Original Message- > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 28, 2004 7:44 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Sessions not working. > > > Pulling my hair out here. > > I've got an IIS5 webserver running a php website just fine. > > I created another web for a dev version of the first website. > Installed PHP ect... > When I load up the old websites files on the new site sessions won't > work on the new site. > > For some reason on the new site's phpinfo.php page, there is no > HTTP_COOKIE variable set under the "environmental" section. > > Also, under the PHP Variables section, there is no > _REQUEST["PHPSESSID"] or _COOKIE["PHPSESSID"] variable. > > What have I missed!??? > > Here is a section of the phpinfo() for both sites. > > Good Site: > > Environment > Variable Value > ALLUSERSPROFILE C:\Documents and Settings\All Users > CommonProgramFiles C:\Program Files\Common Files > COMPUTERNAME WS02TC07927 > ComSpec C:\WINNT\system32\cmd.exe > CONTENT_LENGTH 0 > GATEWAY_INTERFACE CGI/1.1 > HTTPS off > HTTP_ACCEPT */* > HTTP_ACCEPT_LANGUAGE en-us > HTTP_CONNECTION Keep-Alive > HTTP_HOST opsup.telaurus.net > HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) > HTTP_COOKIE PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f > HTTP_ACCEPT_ENCODING gzip, deflate > INSTANCE_ID 3 > LOCAL_ADDR 10.16.1.21 > NUMBER_OF_PROCESSORS 1 > Os2LibPath C:\WINNT\system32\os2\dll; > OS Windows_NT > Path C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem > PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > PATH_INFO /phpinfo.php > PATH_TRANSLATED C:\Inetpub\wwwOpSup\phpinfo.php > PROCESSOR_ARCHITECTURE x86 > PROCESSOR_IDENTIFIER x86 Family 6 Model 8 Stepping 10, GenuineIntel > PROCESSOR_LEVEL 6 > PROCESSOR_REVISION 080a > ProgramFiles C:\Program Files > REMOTE_ADDR 10.16
RE: [PHP] Sessions not working.
Further info. If I echo the session_id() onto the page I do get an id returned. So (correct me if I'm wrong) the session has started correctly with the session_start() at the top of the page. It just doesn't seem to save any of the session variables I set, or if they are set, it can't retrieve them. I get this error when trying to grab the $session['userid'] variable... Notice: Undefined index: userid in C:\Inetpub\wwwOpSupDev\main.php on line 37 -Original Message- From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 9:19 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Sessions not working. Random thought.. Did you check your PHP.INI on the 'bad' server to make sure that it's configured the same as the 'good' server? Some things to check: Session.use_cookies = 1 Session.auto_start = 0 // This is the first one I'd check. If you have it set to =1 on the good server and aren't doing a session_start(), that could do it I think There are a bunch of other Session related parameters in PHP.INI.. Default timeout value.. If that's set too low, the session might vaporize before you get a chance to see the info, etc. Good luck! -TG > -Original Message- > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 28, 2004 7:44 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Sessions not working. > > > Pulling my hair out here. > > I've got an IIS5 webserver running a php website just fine. > > I created another web for a dev version of the first website. > Installed > PHP ect... > When I load up the old websites files on the new site sessions won't > work on the new site. > > For some reason on the new site's phpinfo.php page, there is no > HTTP_COOKIE variable set under the "environmental" section. > > Also, under the PHP Variables section, there is no > _REQUEST["PHPSESSID"] > or _COOKIE["PHPSESSID"] variable. > > What have I missed!??? > > Here is a section of the phpinfo() for both sites. > > Good Site: > > Environment > Variable Value > ALLUSERSPROFILE C:\Documents and Settings\All Users > CommonProgramFiles C:\Program Files\Common Files > COMPUTERNAME WS02TC07927 > ComSpec C:\WINNT\system32\cmd.exe > CONTENT_LENGTH 0 > GATEWAY_INTERFACE CGI/1.1 > HTTPS off > HTTP_ACCEPT */* > HTTP_ACCEPT_LANGUAGE en-us > HTTP_CONNECTION Keep-Alive > HTTP_HOST opsup.telaurus.net > HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) > HTTP_COOKIE PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f > HTTP_ACCEPT_ENCODING gzip, deflate > INSTANCE_ID 3 > LOCAL_ADDR 10.16.1.21 > NUMBER_OF_PROCESSORS 1 > Os2LibPath C:\WINNT\system32\os2\dll; > OS Windows_NT > Path C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem > PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > PATH_INFO /phpinfo.php > PATH_TRANSLATED C:\Inetpub\wwwOpSup\phpinfo.php > PROCESSOR_ARCHITECTURE x86 > PROCESSOR_IDENTIFIER x86 Family 6 Model 8 Stepping 10, GenuineIntel > PROCESSOR_LEVEL 6 > PROCESSOR_REVISION 080a > ProgramFiles C:\Program Files > REMOTE_ADDR 10.16.2.55 > REMOTE_HOST 10.16.2.55 > REQUEST_METHOD GET > SCRIPT_NAME /phpinfo.php > SERVER_NAME opsup.telaurus.net > SERVER_PORT 80 > SERVER_PORT_SECURE 0 > SERVER_PROTOCOL HTTP/1.1 > SERVER_SOFTWARE Microsoft-IIS/5.0 > SystemDrive C: > SystemRoot C:\WINNT > TEMP C:\WINNT\TEMP > TMP C:\WINNT\TEMP > USERPROFILE C:\Documents and Settings\NetShowServices > windir C:\WINNT > > > PHP Variables > Variable Value > _REQUEST["PHPSESSID"] ed09aa7b20d4032a3553c16a8f4a782f > _COOKIE["PHPSESSID"] ed09aa7b20d4032a3553c16a8f4a782f > _SERVER["ALLUSERSPROFILE"] C:\\Documents and Settings\\All Users > _SERVER["CommonProgramFiles"] C:\\Program Files\\Common Files > _SERVER["COMPUTERNAME"] WS02TC07927 > _SERVER["ComSpec"] C:\\WINNT\\system32\\cmd.exe > _SERVER["CONTENT_LENGTH"] 0 > _SERVER["GATEWAY_INTERFACE"] CGI/1.1 > _SERVER["HTTPS"] off > _SERVER["HTTP_ACCEPT"] */* > _SERVER["HTTP_ACCEPT_LANGUAGE"] en-us > _SERVER["HTTP_CONNECTION"] Keep-Alive > _SERVER["HTTP_HOST"] opsup.telaurus.net > _SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 6.0; > Windows NT > 5.1) > _SERVER["HTTP_COOKIE"] PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f > _SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate > _SERVER["INSTANCE_ID"] 3 > _SERVER["L
RE: [PHP] Sessions not working.
They are the same physical server using the same php.ini Just different "logical" web servers set up in IIS5. In otherwords, each webserver on the system has it's own IP address. -Original Message- From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 9:19 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Sessions not working. Random thought.. Did you check your PHP.INI on the 'bad' server to make sure that it's configured the same as the 'good' server? Some things to check: Session.use_cookies = 1 Session.auto_start = 0 // This is the first one I'd check. If you have it set to =1 on the good server and aren't doing a session_start(), that could do it I think There are a bunch of other Session related parameters in PHP.INI.. Default timeout value.. If that's set too low, the session might vaporize before you get a chance to see the info, etc. Good luck! -TG > -Original Message- > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 28, 2004 7:44 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Sessions not working. > > > Pulling my hair out here. > > I've got an IIS5 webserver running a php website just fine. > > I created another web for a dev version of the first website. > Installed > PHP ect... > When I load up the old websites files on the new site sessions won't > work on the new site. > > For some reason on the new site's phpinfo.php page, there is no > HTTP_COOKIE variable set under the "environmental" section. > > Also, under the PHP Variables section, there is no > _REQUEST["PHPSESSID"] > or _COOKIE["PHPSESSID"] variable. > > What have I missed!??? > > Here is a section of the phpinfo() for both sites. > > Good Site: > > Environment > Variable Value > ALLUSERSPROFILE C:\Documents and Settings\All Users > CommonProgramFiles C:\Program Files\Common Files > COMPUTERNAME WS02TC07927 > ComSpec C:\WINNT\system32\cmd.exe > CONTENT_LENGTH 0 > GATEWAY_INTERFACE CGI/1.1 > HTTPS off > HTTP_ACCEPT */* > HTTP_ACCEPT_LANGUAGE en-us > HTTP_CONNECTION Keep-Alive > HTTP_HOST opsup.telaurus.net > HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) > HTTP_COOKIE PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f > HTTP_ACCEPT_ENCODING gzip, deflate > INSTANCE_ID 3 > LOCAL_ADDR 10.16.1.21 > NUMBER_OF_PROCESSORS 1 > Os2LibPath C:\WINNT\system32\os2\dll; > OS Windows_NT > Path C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem > PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > PATH_INFO /phpinfo.php > PATH_TRANSLATED C:\Inetpub\wwwOpSup\phpinfo.php > PROCESSOR_ARCHITECTURE x86 > PROCESSOR_IDENTIFIER x86 Family 6 Model 8 Stepping 10, GenuineIntel > PROCESSOR_LEVEL 6 > PROCESSOR_REVISION 080a > ProgramFiles C:\Program Files > REMOTE_ADDR 10.16.2.55 > REMOTE_HOST 10.16.2.55 > REQUEST_METHOD GET > SCRIPT_NAME /phpinfo.php > SERVER_NAME opsup.telaurus.net > SERVER_PORT 80 > SERVER_PORT_SECURE 0 > SERVER_PROTOCOL HTTP/1.1 > SERVER_SOFTWARE Microsoft-IIS/5.0 > SystemDrive C: > SystemRoot C:\WINNT > TEMP C:\WINNT\TEMP > TMP C:\WINNT\TEMP > USERPROFILE C:\Documents and Settings\NetShowServices > windir C:\WINNT > > > PHP Variables > Variable Value > _REQUEST["PHPSESSID"] ed09aa7b20d4032a3553c16a8f4a782f > _COOKIE["PHPSESSID"] ed09aa7b20d4032a3553c16a8f4a782f > _SERVER["ALLUSERSPROFILE"] C:\\Documents and Settings\\All Users > _SERVER["CommonProgramFiles"] C:\\Program Files\\Common Files > _SERVER["COMPUTERNAME"] WS02TC07927 > _SERVER["ComSpec"] C:\\WINNT\\system32\\cmd.exe > _SERVER["CONTENT_LENGTH"] 0 > _SERVER["GATEWAY_INTERFACE"] CGI/1.1 > _SERVER["HTTPS"] off > _SERVER["HTTP_ACCEPT"] */* > _SERVER["HTTP_ACCEPT_LANGUAGE"] en-us > _SERVER["HTTP_CONNECTION"] Keep-Alive > _SERVER["HTTP_HOST"] opsup.telaurus.net > _SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 6.0; > Windows NT > 5.1) > _SERVER["HTTP_COOKIE"] PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f > _SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate > _SERVER["INSTANCE_ID"] 3 > _SERVER["LOCAL_ADDR"] 10.16.1.21 > _SERVER["NUMBER_OF_PROCESSORS"] 1 > _SERVER["Os2LibPath"] C:\\WINNT\\system32\\os2\\dll; > _SERVER["OS"] Windows_NT > _SERVER["Path"] > C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem
[PHP] Sessions not working.
0 _SERVER["SERVER_PROTOCOL"] HTTP/1.1 _SERVER["SERVER_SOFTWARE"] Microsoft-IIS/5.0 _SERVER["SystemDrive"] C: _SERVER["SystemRoot"] C:\\WINNT _SERVER["TEMP"] C:\\WINNT\\TEMP _SERVER["TMP"] C:\\WINNT\\TEMP _SERVER["USERPROFILE"] C:\\Documents and Settings\\NetShowServices _SERVER["windir"] C:\\WINNT _SERVER["PHP_SELF"] /phpinfo.php _SERVER["argv"] Array ( ) _SERVER["argc"] 0 _ENV["ALLUSERSPROFILE"] C:\\Documents and Settings\\All Users _ENV["CommonProgramFiles"] C:\\Program Files\\Common Files _ENV["COMPUTERNAME"] WS02TC07927 _ENV["ComSpec"] C:\\WINNT\\system32\\cmd.exe _ENV["CONTENT_LENGTH"] 0 _ENV["GATEWAY_INTERFACE"] CGI/1.1 _ENV["HTTPS"] off _ENV["HTTP_ACCEPT"] */* _ENV["HTTP_ACCEPT_LANGUAGE"] en-us _ENV["HTTP_CONNECTION"] Keep-Alive _ENV["HTTP_HOST"] opsup_dev.telaurus.net _ENV["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) _ENV["HTTP_ACCEPT_ENCODING"] gzip, deflate _ENV["INSTANCE_ID"] 6 _ENV["LOCAL_ADDR"] 10.16.1.24 _ENV["NUMBER_OF_PROCESSORS"] 1 _ENV["Os2LibPath"] C:\\WINNT\\system32\\os2\\dll; _ENV["OS"] Windows_NT _ENV["Path"] C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem _ENV["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH _ENV["PATH_INFO"] /phpinfo.php _ENV["PATH_TRANSLATED"] C:\\Inetpub\\wwwOpSupDev\\phpinfo.php _ENV["PROCESSOR_ARCHITECTURE"] x86 _ENV["PROCESSOR_IDENTIFIER"] x86 Family 6 Model 8 Stepping 10, GenuineIntel _ENV["PROCESSOR_LEVEL"] 6 _ENV["PROCESSOR_REVISION"] 080a _ENV["ProgramFiles"] C:\\Program Files _ENV["REMOTE_ADDR"] 10.16.2.55 _ENV["REMOTE_HOST"] 10.16.2.55 _ENV["REQUEST_METHOD"] GET _ENV["SCRIPT_NAME"] /phpinfo.php _ENV["SERVER_NAME"] opsup_dev.telaurus.net _ENV["SERVER_PORT"] 80 _ENV["SERVER_PORT_SECURE"] 0 _ENV["SERVER_PROTOCOL"] HTTP/1.1 _ENV["SERVER_SOFTWARE"] Microsoft-IIS/5.0 _ENV["SystemDrive"] C: _ENV["SystemRoot"] C:\\WINNT _ENV["TEMP"] C:\\WINNT\\TEMP _ENV["TMP"] C:\\WINNT\\TEMP _ENV["USERPROFILE"] C:\\Documents and Settings\\NetShowServices _ENV["windir"] C:\\WINNT Jeff McKeon IT Manager Telaurus Communications LLC [EMAIL PROTECTED] (973) 889-8990 ex 209 ***The information contained in this communication is confidential. It is intended only for the sole use of the recipient named above and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication, or any of its contents or attachments, is expressly prohibited. If you have received this communication in error, please re-send it to the sender and delete the original message, and any copy of it, from your computer system. Thank You.*** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Operator question
In PHP, what does the operator "-=" do? I can't find a ref to it's function in the online manual or any books I have. Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mulitple selects from form drop down box
Is it possible to have a form "Drop down box" that allows multiple selects? I know the form field itself exists, but It only seems to return the last item selected and not all of them. Note in the code below the line: [code] ship1 ship2 ship3 [code] All this returns is: "Form info: ship2" Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] retrieving ENUM description from MySQL
Here's an example of how to get the ENUM into a drop down list in a web form. I use it all the time.. [code] /* Get_Enum : Retreives the "enum" options from an "enum" type field in a MySql Database */ function Get_enum($table,$field,$db,$link) { mysql_select_db($db,$link); $result = mysql_query("show columns from $table like '$field'", $link); $query_data = mysql_fetch_array($result); if(eregi("('.*')", $query_data["Type"], $match)) { $enum_str = ereg_replace("'", "", $match[1]); $enum_options = explode(',', $enum_str); } array_push($enum_options, $query_data["Default"]); return $enum_options; } //Note: db_connect() (not shown) is a function created to make a database connection... $var"; ?> [code] Hope this helps... Jeff > -Original Message- > From: Alan Lord [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2003 12:12 PM > To: [EMAIL PROTECTED] > Subject: [PHP] retrieving ENUM description from MySQL > > > Hi all, > > This is a bit wierd so don't flame please. > > Imagine a database table, field defined as ENUM with a list > of allowed types such as "Mr", "Mrs", "Miss", "Dr", "Prof", > etc - you get the idea. > > I've read the MySQL manual and by using > > SHOW COLUMNS FROM "table_name" LIKE "enum_column_name"; > > I can get a result. > > But the string of ENUMs is not an array. It is returned as a > string with all types in one string. > > Anyone got any ideas about how to retrieve it in a better way > - else I'll need to start exploding the string... > > Thanks in advance > > Al > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Counting elements in an array
Jason Wong wrote: > On Wednesday 19 November 2003 23:24, Jeff McKeon wrote: >> How would I count the number of elements in an array that had a >> certain value? >> >> In other words, if I have >> >> $fruit = array(orange,orange,apple,bananna,orange,apple,pear); >> >> How could I get the number of elements from $fruit where the value is >> "orange"? > > array_count_values() > That gives me: Warning: array_count_values(): Can only count STRING and INTEGER values! The values of the array elements should be integer. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Counting elements in an array
How would I count the number of elements in an array that had a certain value? In other words, if I have $fruit = array(orange,orange,apple,bananna,orange,apple,pear); How could I get the number of elements from $fruit where the value is "orange"? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] An array as an element of a function
Thanks all.. Jeff > -Original Message- > From: Marek Kilimajer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 18, 2003 10:30 AM > To: Jeff McKeon > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] An array as an element of a function > > > Jeff McKeon wrote: > > > Is it possible to pass an array as an elemtent of a function?? > Yes > > > > > Something like this: > > > > $array1=array(1,2,3,4); > > $array2=array(a,b,c,d); > > > > Function Somefunction($var1,$var2) > > { > > someprocess using $array1 and array2; > > } > > > > Somefunction($array1,$array2); > This is the right way. > > > > > Or does something special have to be done? > No. > > > > > Thanks, > > > > Jeff > > > > You could have tried it yourself. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] An array as an element of a function
Sorry, bad choice of words. By element I meant parameter. Jeff > -Original Message- > From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 18, 2003 10:35 AM > To: Jeff McKeon; [EMAIL PROTECTED] > Subject: Re: [PHP] An array as an element of a function > > > Hi, > What do you mean by element of a function? usually functions take > parametes (also known as arguments). elements are members of > an array. > In other words a collection of elements make up an array. > > > > > Jeff McKeon wrote: > > >Is it possible to pass an array as an elemtent of a function?? > > > >Something like this: > > > >$array1=array(1,2,3,4); > >$array2=array(a,b,c,d); > > > >Function Somefunction($var1,$var2) > >{ > > someprocess using $array1 and array2; > >} > > > >Somefunction($array1,$array2); > > > >Or does something special have to be done? > > > >Thanks, > > > >Jeff > > > > > > > > > -- > Raditha Dissanayake. > -- > -- > http://www.radinks.com/sftp/ | > http://www.raditha.com/megaupload > Lean and mean Secure FTP > applet with | Mega Upload - PHP file uploader Graphical User > Inteface. Just 150 KB | with progress bar. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] An array as an element of a function
Is it possible to pass an array as an elemtent of a function?? Something like this: $array1=array(1,2,3,4); $array2=array(a,b,c,d); Function Somefunction($var1,$var2) { someprocess using $array1 and array2; } Somefunction($array1,$array2); Or does something special have to be done? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Communicating with remote server
Matt Palermo wrote: > I am writing a desktop application using PHP-GTK. I would > like this program to be able to connect to a remote server, > call some functions that I specify, and return the right > information (most likely from a MySQL db). I have access to > the server, so I can create any and all functions that I > want, but I don't know how to connect to the remote server > page and get all the results. I am new to cross-server > comunication programming, so if anyone knows of a very > detailed and easy to learn tutorial please send me the link. > I would appreciate any help you are willing to offer. > > Thanks, > > Matt For mysql queries I use this... function db_connect($dbhost,$dbname,$dbuser,$dbpass) { global $MYSQL_ERRNO, $MYSQL_ERROR; $link = mysql_connect($dbhost,$dbname,$dbuser,$dbpass); if (!$link_id) { $MYSQL_ERRNO = 0; $MYSQL_ERROR = "Connection failed to the host $dbhost"; return 0; } else if(empty($dbname) && !mysql_select_db($dbname)) { $MYSQL_ERRNO = mysql_errno(); $MYSQL_ERROR = mysql_error(); return 0; } else return $link; } $link_id=db_connect(dbname,db_user_name,db_user_pass); Mysql_select_db(dbname, $link_id); $query="select * from tablename"; $result=mysql_query($query); While ($query_data=mysql_fetch_row($result)) { echo $query_data[0],$query_data[1],$query_data[2],etc } Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: From form to an array
Jay Blanchard wrote: > [snip] > Ok, now on submit of this second form I want to take field1 > from each line and put it into $array1 and field2 from each > line and put it into $arrray2. > [/snip] > > Form 1's info would have to be held as hidden fields in Form > 2's construction. An example ... > > /* formOne.php */ > > > > > Jay, Sorry but I don't follow what your doing here. Form one doesn't need an array, it only has one piece of data, the number of rows that form2 should have. > /* nextForm.php */ > > > > " method="POST"> Does that make more sense or am I just not understanding what your trying to do? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: From form to an array
DvDmanDT wrote: > Hmm... Intresting... Like... Hmm.. Name the elements of the > second form like name="array2[LINE_NUM]"> > > Then turn on register_globals, then you'll very automaticly > have $array1 and $array2.. Sorry register_globals are off and not getting turned on... e=swen http://securityresponse.symantec.com/avcenter/venc/data/[EMAIL PROTECTED] ml ## "Jeff McKeon" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] . Is it possible to pass the values of a form directly into an array? I have a multi level, dynamic form. The first level (first form actually) askes how many levels there are and gives you a field to enter in that number. Then upon submit of form1 it creates a new form (form2) that contains 2 fields for each level (the number of levels was entered in form1). So if you entered 2 in the first form, you'd be given another form with 2 lines, each containing 2 fields. Ok, now on submit of this second form I want to take field1 from each line and put it into $array1 and field2 from each line and put it into $arrray2. Then pass those array's to a function as elements. Any idea how I can do this? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jeff McKeon IT Manager Telaurus Communications LLC [EMAIL PROTECTED] (973) 889-8990 ex 209 ***The information contained in this communication is confidential. It is intended only for the sole use of the recipient named above and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication, or any of its contents or attachments, is expressly prohibited. If you have received this communication in error, please re-send it to the sender and delete the original message, and any copy of it, from your computer system. Thank You.*** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] From form to an array
Jay Blanchard wrote: > [snip] > Is it possible to pass the values of a form directly into an array? > [/snip] > > Each form is passed to an array already. Dependent upon form > method (GET or POST) the form values are in the $_GET or > $_POST array (newer versions of PHP). > > Start here > http://us3.php.net/manual/en/language.variable> s.predefined.php Yes but $_POST[] array contains ALL the fields using an index of their names. I need the entries for field1 in one array and the entries for field2 in another. In a later function I need to move through the arrays incrementing their index with every pass. This can only be done if the array index numeric as opposed to "named" right? The field names in the form are like this Tier1,price1 Tier2,price2 Tier3,price3 These are built automatcally and I need all the "Tier" values in one array and all the "Price" values in another. [code snip begin] Enter the upper size limit and price for each Tier Tier Limit Tier Price Email Size [code snip end] Jeff McKeon IT Manager Telaurus Communications LLC [EMAIL PROTECTED] (973) 889-8990 ex 209 ***The information contained in this communication is confidential. It is intended only for the sole use of the recipient named above and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication, or any of its contents or attachments, is expressly prohibited. If you have received this communication in error, please re-send it to the sender and delete the original message, and any copy of it, from your computer system. Thank You.*** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] From form to an array
Is it possible to pass the values of a form directly into an array? I have a multi level, dynamic form. The first level (first form actually) askes how many levels there are and gives you a field to enter in that number. Then upon submit of form1 it creates a new form (form2) that contains 2 fields for each level (the number of levels was entered in form1). So if you entered 2 in the first form, you'd be given another form with 2 lines, each containing 2 fields. Ok, now on submit of this second form I want to take field1 from each line and put it into $array1 and field2 from each line and put it into $arrray2. Then pass those array's to a function as elements. Any idea how I can do this? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multiple values in a form option field
Thanks Pablo, I wound up with this... NONE $query_data1[1]"; } ?> Then I simply do: $array = explode(":",$_POST['customer']); Then when I do the database update I just need to put $array[0], $array[1] into the fields in the database. Thanks, Jeff > -Original Message- > From: Pablo Gosse [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 13, 2003 3:27 PM > To: Jeff McKeon; [EMAIL PROTECTED] > Subject: RE: [PHP] Multiple values in a form option field > > > On Thursday, November 13, Jeff wrote: > > [snip]What I now need to do is store not only the userID but > the email address as well. Is there a way using a form to > store 2 values using one drop down box? So basically I want > to store the userID and the Email address to a variable in > the form so that both may be written to different fields in > the database later.[/snip] > > Hi Jeff. For this you'll need to use javascript and hidden > form fields. I've had to do this in a few places in my CMS > and it's not too difficult. > > The Javascript will be something like this: > > > <!-- > // x is the select list in question > function setEmail(x) > { > var users = new Array(); > <?php > $count = 0; > foreach ($users as $id=>$user) > { > echo 'users['.$count.'] = '.$id.';'; > $count++; > } > ?> > > for (i=0;i<x.length;i++) > { > if (x.options[i].selected) hiddenidfield.value = > users[i]; > } > } > //--> > > > One thing to make sure of is that you are looping through > your results in the same order both when you create the > javascript array inside the function, and also when creating > the select list. > > Then in your form have a hidden input as follows: > > > > And for the select list, use the onchange attribute to set > the value of the hidden input field (onchange="setEmail(this);"). > > You'll obviously need to update hiddenidfield.value with the > proper reference to this input in the elements collection for > this form. > > I'm writing this off the top of my head, so if there are any > problems let me know. It should be pretty close though as I > had to do just what you asked a few times recently. > > Cheers, > Pablo > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple values in a form option field
I have a php page that has a web form on it. I do a query to populate the options in a drop down box in the form. [code] $query_data1[1]"; } ?> [code] $query_data1[0] is a userID number $query_data1[1] is the user's Email address So when the user selects an email addres from the drop down box, the userID is stored and later writen to a database. What I now need to do is store not only the userID but the email address as well. Is there a way using a form to store 2 values using one drop down box? So basically I want to store the userID and the Email address to a variable in the form so that both may be written to different fields in the database later. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing array variables in a GET
I looked at the page you suggested but it vauge at best. Basically from what I've gathered using serialize with an array screws up the pointers in the array. Is this true? What I've done is this but it doesn't seem to be working... Pull data (two fields) from a mysql table and put the results into two arrays, one for each field Query results for field 1 -> Array1[] Query results for field 2 -> Array2[] Then I create a variable with the imploded data from the arrays $var1=implode(":", $Array1); $var2=implode(":", $Array2); Then serialize the variables... $varSER1=serialize($var1); $varSER2=serialize($var2); Then pass the variables in the url via a GET. It doesn't work however Jeff > -Original Message- > From: Wouter van Vliet [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 22, 2003 1:06 PM > To: Jeff McKeon; [EMAIL PROTECTED] > Subject: RE: [PHP] Passing array variables in a GET > > > Take a look at > http://nl.php.net/manual/en/function.serialize.php and > http://nl.php.net/manual/en/function.unseriali> ze.php. Or if > the keys don't matter and the array has just > one level (strange, I know there's a different term for that, > totally cannot find it in my memory :S) you can consider > join() and split(). > > Wouter > > -Original Message- > From: Jeff McKeon [mailto:[EMAIL PROTECTED] > Sent: Wednesday 22 October 2003 18:59 > To: [EMAIL PROTECTED] > Subject: [PHP] Passing array variables in a GET > > Is this possible??? > > $blah[]=(a, b, c); > > link > > So basically I have a page that need an array to perform some > function. Can I pass that array variable (and thus it's data) > to it from another page? > > Thanks, > > Jeff > > -- > PHP General Mailing List (http://www.php.net/) To > unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing array variables in a GET
Is this possible??? $blah[]=(a, b, c); link So basically I have a page that need an array to perform some function. Can I pass that array variable (and thus it's data) to it from another page? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting elapsed time
Is there a simple way (a built in function) to get the elapsed time between two given timestamps (-MM-DD HH:MM:SS)? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Echo $PHP_SELF not working
So you're saying I had register_globals set to ON on my dev server!? CRAP!!! I thought I was working with it off! Now I have to redevelop it all and change all my $variables from forms to $_POST['variable']? Even when they post to the same page with "action=''"?? Jeff > -Original Message- > From: Paul van Schayck [mailto:[EMAIL PROTECTED] > Sent: Friday, October 10, 2003 8:24 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Echo $PHP_SELF not working > > > Hello, > Here we go again ;) > > [EMAIL PROTECTED] (Jeff McKeon) wrote > > I've just published a new website and something is wrong. > I suspect > > the PHP.ini on the server but I can't seem to find anything. > > register_globals is on off. Which is a good idea, keep it there! > > > > On the dev server "ECHO $PHP_SELF" seems to work but not on the > > production one. Any ideas what I've missed? > http://nl2.php.net/manual/en/reserved.variables.php#reserved.variables.s erv er echo $_SERVER['PHP_SELF']; Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Echo $PHP_SELF not working
I've just published a new website and something is wrong. I suspect the PHP.ini on the server but I can't seem to find anything. The line: Doesn't seem to work. If I look at the "view source" from the web browser I see this.. On the development server I see this... On the dev server "ECHO $PHP_SELF" seems to work but not on the production one. Any ideas what I've missed? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Global varialbes in functions
Sorry, I just figured it out. The third function was getting it's data from a form submit using post and I didn't include a hidden input field with the $_GET[''] variable as a value. Jeff > -Original Message----- > From: Jeff McKeon > Sent: Saturday, October 04, 2003 11:35 AM > To: php > Subject: [PHP] Global varialbes in functions > > > I've got a page that is passed the global variable > 'ticketnumber' in the url. > > In my first two functions on the page I can call this > variable using $_GET['ticketid'] no problem. > > However on the third funtion I get an undefined index error > for 'ticketid' > > Anyone know why? > > Thanks, > > Jeff > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Global varialbes in functions
I've got a page that is passed the global variable 'ticketnumber' in the url. In my first two functions on the page I can call this variable using $_GET['ticketid'] no problem. However on the third funtion I get an undefined index error for 'ticketid' Anyone know why? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User Authentication Continued....
Good advice! Thanks! Jeff > -Original Message- > From: Chris Shiflett [mailto:[EMAIL PROTECTED] > Sent: Friday, October 03, 2003 5:19 PM > To: Jeff McKeon; php > Subject: RE: [PHP] User Authentication Continued > > > > --- Jeff McKeon <[EMAIL PROTECTED]> wrote: > > > $query="SELECT * from tickets where VesselID='$_GET['vesselid']' > > > order by Status DESC, Created ASC"; > > > > $query = "select * from tickets where vesselid = > '{$_GET['vesselid']}' > > order by status desc, created asc"; > > > > Note the curly braces. > > I am trying to start making a conscious effort to alert > people to potential security risks associated with certain > examples. So, I should have mentioned that constructing an > SQL statement with client data is terrible. While my example > was only meant to illustrate how to interpolate arrays within > a string, I do not want anyone to copy/paste this code and > create a security vulnerability. > > So, what should really be done is something like this: > > 1. Validate $_GET['vesselid'] > 2. If it is valid, $clean['vesselid'] = $_GET['vesselid'] > 3. Construct the SQL statement using $clean['vesselid'] > > Hope that helps. > > Chris > > = > My Blog > http://shiflett.org/ > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User Authentication Continued....
One more mystery solved. Thanks one and all Jeff > -Original Message- > From: Robert Cummings [mailto:[EMAIL PROTECTED] > Sent: Friday, October 03, 2003 4:55 PM > To: Jeff McKeon > Cc: PHP-General; [EMAIL PROTECTED] > Subject: RE: [PHP] User Authentication Continued > > > On Fri, 2003-10-03 at 16:44, Jeff McKeon wrote: > > Actually, here's the problem I get with using global variables in a > > mysql_query string.. > > > > [error begin] > > PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, > > expecting T_STRING or T_VARIABLE or T_NUM_STRING [error end] > > > > [code begin] > > $query="SELECT * from tickets where > VesselID='$_GET['vesselid']' order > > by Status DESC, Created ASC"; [code end] > > The following will work: > > $query= > "SELECT * " >."FROM tickets " >."WHERE VesselID='".$_GET['vesselid']."' " >."ORDER BY Status DESC, Created ASC"; > > Cheers, > Rob. > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | a > | powerful, scalable system for accessing system services | such as > | forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User Authentication Continued....
Actually, here's the problem I get with using global variables in a mysql_query string.. [error begin] PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING [error end] [code begin] $query="SELECT * from tickets where VesselID='$_GET['vesselid']' order by Status DESC, Created ASC"; [code end] Jeff > -Original Message- > From: Chris Shiflett [mailto:[EMAIL PROTECTED] > Sent: Friday, October 03, 2003 3:45 PM > To: Jeff McKeon; php > Subject: Re: [PHP] User Authentication Continued > > > --- Jeff McKeon <[EMAIL PROTECTED]> wrote: > > The problem I'm having is with the $_GET variables. I guess I'm not > > declaring them correctly. Do I need to set them as soon as the page > > loads, and outside of any functions like so.. > > > > [code start] > > $custid = $_GET['custid']; > > $custname = $_GET['custname']; > > [code end] > > > > Or do I need to declare them in each funtion? > > > > [code start] > > Function blah(){ > > global $custname, $custid; > > > > $custid = $_GET['custid']; > > $custname = $_GET['custname']; > > DO SOME STUFF > > } > > $_GET is a superglobal, which just means that it is always > available everywhere. If you assign $custname to > $_GET['custname'], you now have a regular global variable (if > the assignment is done outside a function) or a local > variable (if the assignment is done within a function). > > So, either just use $_GET['custname'] everywhere you need it, > or work with the variable scope like you would have to if it > was anything else. For example: > > 1. $foo = $_GET['foo']; > 2. $foo = 'bar'; > > The variable scope of $foo would be the same, regardless of > which of those assignments were made. > > Hope that helps. > > Chris > > = > My Blog > http://shiflett.org/ > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
Yes, I'm the one creating the accounts in the database, users can't create their own accounts nor do they have permissions to create new users. Thanks! Jeff > -Original Message- > From: Chris Shiflett [mailto:[EMAIL PROTECTED] > Sent: Friday, October 03, 2003 3:09 PM > To: Jeff McKeon; php > Subject: RE: [PHP] User authentication > > > --- Jeff McKeon <[EMAIL PROTECTED]> wrote: > > Well both variables $userid and $userpassword are bounced off of a > > user database table, if the username/password don't match then the > > session variables are cleared with a session_destroy() > call. Is that > > a good enough validation? > > Yes, as long as you realize that you have now shifted the > trust to those values in the database. As long as there is no > way for a user to inject malicious code during the > registration process (or however the username and password > end up in the database), then that part should be fine. > > Hope that helps. > > Chris > > = > My Blog > http://shiflett.org/ > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] User Authentication Continued....
Ok, I've got the user authentication thing down and now I'm continuing to build my trouble ticket tracking system. So from a "customer profile" page there is a link to "Open Ticket" which brings up a page to open a trouble ticket. [html code] HREF=./open_ticket.php?custid=$custid&custname=$custname [html code] The user is validated for permissions and timeout based on the $_SESSION variables established before the "open ticket"" page is loaded. I then have a form that they fill in with the minimum info to create a new ticket. Some info is passed to the open ticket page from the customer profile page via a GET method and enterred into hidden form fields. [html code] HREF=./open_ticket.php?custid=$custid&custname=$custname [html code] On the "open ticket" page I have 2 functions, the first is a form for entering in the ticket info, the second is a function to take the information and update the database with it when the form is submitted, then reload the page with a display of the ticket info. The problem I'm having is with the $_GET variables. I guess I'm not declaring them correctly. Do I need to set them as soon as the page loads, and outside of any functions like so.. [code start] $custid = $_GET['custid']; $custname = $_GET['custname']; [code end] Or do I need to declare them in each funtion? [code start] Function blah(){ global $custname, $custid; $custid = $_GET['custid']; $custname = $_GET['custname']; DO SOME STUFF } Function foo(){ global $custname, $custid; $custid = $_GET['custid']; $custname = $_GET['custname']; DO SOME STUFF } [code end] Or am I way off and there is another way of doing it? Also I've noticed that when I do an mysql_query("select name from foo where name='$somevariable'") I cannot use $_GET['somevariable'] or $_POST['somevariable'] in the sql string, I find I need to do a $name = $_GET['somevariable'] first and then use $name. Why is this? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
> --- Jeff McKeon <[EMAIL PROTECTED]> wrote: > > $_SESSION['userid'] = $userid; > > $_SESSION['userpassword'] = $userpassword; > > [snip] > > > Anything look wrong or insecure with all of this? > > The only thing that catches my attention is your assignments > for $_SESSION['userid'] and $_SESSION['userpassword']. I > assume you are performing some strict data validation on > $userid and $userpassword before this assignment, right? If > not, this presents a significant risk, because $_SESSION is a > trusted array (it comes from the server, not the client). > > Hope that helps. > > Chris Well both variables $userid and $userpassword are bounced off of a user database table, if the username/password don't match then the session variables are cleared with a session_destroy() call. Is that a good enough validation? [code begin] session_start(); if(!isset($userid)) { login_form(); exit; } else { $_SESSION['userid'] = $userid; $_SESSION['userpassword'] = $userpassword; $username = auth_user($userid, $userpassword); if(!$username) { echo "user " . $userid . $userpassword . " Authorization failed. " . "You must enter a valid userid and password combo. " . "Click on the following link to try again.\n"; echo "login"; echo "If you do not have login, please contact Operations to obtain one.\n"; session_destroy(); exit; } else echo "welcome, $username!"; echo gmmktime(); echo "Continue"; echo "Ticket"; } function auth_user($userid, $userpassword) { global $default_dbname, $user_tablename; $link_id = db_connect($default_dbname); $query = "SELECT username FROM $user_tablename WHERE userid = '$userid' && userpassword = password('$userpassword')"; $result = mysql_query($query); if(!mysql_num_rows($result)) return 0; else { $stamp = gmmktime(); $query2 = "update $user_tablename set idle_time = $stamp where userid = '$userid'"; $result2 = mysql_query($query2); $query3 = "select CanEdit from $user_tablename where userid = '$userid'"; $result3 = mysql_query($query3); $query_data3 = mysql_fetch_row($result3); $_SESSION['CanEdit'] = $query_data3[0]; $query_data=mysql_fetch_row($result); return $query_data[0]; } } [code end] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
> Hi, > > > > (2) I would advise not mixing $_SESSION and > > > session_register() -- it's problematical in some situations. Just > > > stick to using the $_SESSION array. > > > > I'm not quite sure what you mean here, can you give an example or > > elaborate. Sorry, real newbie here... :o) > > $_SESSION['userid'] = 254; > > Where 254 is, that is the value you want to assign it. > Its just an array. Think of it more as a global variable > accross the entire site. > > -Dan Joseph So I've replaced my session_register("userid", "userpassword"); With $_SESSION['userid'] = $userid; $_SESSION['userpassword'] = $userpassword; And my: session_unregister("userid"); session_unregister("userpassword"); With Session_destroy(); I've also added a field to the user table called "CanEdit" that is set to "1" or "0". When the authentication function is called, I run a query that updates the users idle timestamp, get's his/her CanEdit value and stores it to $_SESSION['CanEdit'], and returns the username. [code begin] function auth_user($userid, $userpassword) { global $default_dbname, $user_tablename; $link_id = db_connect($default_dbname); $query = "SELECT username FROM $user_tablename WHERE userid = '$userid' && userpassword = password('$userpassword')"; $result = mysql_query($query); if(!mysql_num_rows($result)) return 0; else { //set idle timestamp (using unixtime) $stamp = gmmktime(); $query2 = "update $user_tablename set idle_time = $stamp where userid = '$userid'"; $result2 = mysql_query($query2); //get the users "CanEdit" value $query3 = "select CanEdit from $user_tablename where userid = '$userid'"; $result3 = mysql_query($query3); $query_data3 = mysql_fetch_row($result3); $_SESSION['CanEdit'] = $query_data3[0]; //Return the users name to the calling page $query_data=mysql_fetch_row($result); return $query_data[0]; } } [code end] Then when any new page loads it first checks to see if the user has a "CanEdit" value of "1", if not it boots them back to the page they came from, if so it runs a query to check their idle timestamp and subtrack it from the current unixtimestamp to find the difference. If it's greater than X they are booted back to the login screen, if it's less than X the page is loaded.. Anything look wrong or insecure with all of this? Thanks for all the help!!! jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
include"punctuation"; Jeff > -Original Message- > From: Didier McGillis [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 2:36 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] User authentication > > > for those of you who are writing apps and looking at this and > you have > customers adding things to their session such as a cart or > something else > and you destroy the session the information that they were > keeping in their > session would be lost so if you dont want pissed off > customers calling > saying they lost something after leaving their desk for a few > minutes then > you want to make sure that the information such as cart or > whatever is > stored elsewhere and has their user id tied to it. So when > your laying out > your site, and your destroying sessions make sure that unless > that is the > designed intent (such as login information) that your arent > destroying > something more imporatant like someones shopping cart filling > with $3000 > worth of merch, yes I know with exchange rate thats only > worth $.25 to > Americans. > > > >Yes. session_destroy(). > > > >-- > >Jason Wong -> Gremlins Associates -> www.gremlins.biz > >Open Source Software Systems Integrators > >* Web Design & Hosting * Internet & Intranet Applications > Development * > >-- > >Search the list archives before you post > >http://marc.theaimsgroup.com/?l=php-general > >-- > >/* > >"How do I love thee? My accumulator overflows." > >*/ > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > _ > Protect your PC - get McAfee.com VirusScan Online > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
> Hi, > > > What is stored in the date_out column? Is that one of the > colums in > > your own created table or a standard one? > > That's the SQL table that I use to track sessions. Its > one I created. I have a functon that does a simple SQL query: > > SELECT date_out FROM sessions WHERE user_id = 12 > > Then I check to see if if date_out != -00-00 > 00:00:00 and log them out if it doesn't. This method is both > good and bad. (1) I have a master log of all user logins. > (2) I can force a user to log out. Overall, it was just more > work on the sessions. I guess I'd recommend this method if > you have to keep strong security in mind. > So when a user logs in you write a user_id and datestamp to a field in your sessions table. Every time the person accesses a page you update the datestamp in that record. Then you run a function that checks every X minutes if the timestamp is older than X minutes and if so you log the person out? Is this correct? How exactly do you log them out? By issuing a command to clear the session variables saved during login, thus causing function on each page that checks for valid login to fail? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
> > On 02 October 2003 17:27, Jeff McKeon wrote: > > > Ok, > > > > I've got a login page that has these funtions to set the userid and > > password to session variables > > > > [code start] > > session_start(); > > if(!isset($userid)) { > > login_form(); > > exit; > > } > > else { > > session_register("userid", "userpassword"); > > $username = auth_user($userid, $userpassword); > > if(!$username) { > > session_unregister("userid"); > > session_unregister("userpassword"); > > echo "Authorization failed. " . > > "You must enter a valid userid and password > > combo. " . > > "Click on the following link to try > > again.\n"; > > echo "login"; > > echo "If you do not have login, please contact > > Operations to obtain one.\n"; > > exit; > > } > > else echo "welcome, $username!"; > > } > > [code end] > > > > I then have a simple test page with the following code... > > > > [code start] > > > include "./register_functions.php"; > > > > if($_SESSION['userid'] == 'bob'){ > > Echo $_SESSION['userid']; > > Echo"Access Denied Bobby boy!!!"; > > } > > else { > > echo"OK, since it's not Bob, it's ok"; > > } > > html_footer(); > > [code end] > > > > The problem is that the $_SESSION['userid'] doesn't return > anything on > > this page.. Am I not calling the session variable correctly or not > > storing it correctly? In my php.ini I have globals turned > off. Does > > this effect it? > > (1) I don't see a session_start() on the second page (unless > it's in register_functions.php?). > OK, including session_start(); at the top of the test_auth.php page worked. > (2) I would advise not mixing $_SESSION and > session_register() -- it's problematical in some situations. > Just stick to using the $_SESSION array. > I'm not quite sure what you mean here, can you give an example or elaborate. Sorry, real newbie here... :o) Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
Ok, I've got a login page that has these funtions to set the userid and password to session variables [code start] session_start(); if(!isset($userid)) { login_form(); exit; } else { session_register("userid", "userpassword"); $username = auth_user($userid, $userpassword); if(!$username) { session_unregister("userid"); session_unregister("userpassword"); echo "Authorization failed. " . "You must enter a valid userid and password combo. " . "Click on the following link to try again.\n"; echo "login"; echo "If you do not have login, please contact Operations to obtain one.\n"; exit; } else echo "welcome, $username!"; } [code end] I then have a simple test page with the following code... [code start] -Original Message- > From: Dan Joseph [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 11:39 AM > To: php > Subject: RE: [PHP] User authentication > > > Hi, > > > What is stored in the date_out column? Is that one of the > colums in > > your own created table or a standard one? > > That's the SQL table that I use to track sessions. Its > one I created. I have a functon that does a simple SQL query: > > SELECT date_out FROM sessions WHERE user_id = 12 > > Then I check to see if if date_out != -00-00 > 00:00:00 and log them out if it doesn't. This method is both > good and bad. (1) I have a master log of all user logins. > (2) I can force a user to log out. Overall, it was just more > work on the sessions. I guess I'd recommend this method if > you have to keep strong security in mind. > > -Dan Joseph > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
What is stored in the date_out column? Is that one of the colums in your own created table or a standard one? Jeff > -Original Message- > From: Dan Joseph [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 11:34 AM > To: php > Subject: RE: [PHP] User authentication > > > Hi, > > > How do you check for idle? I suppose there is a built in variable > > that you check against the value in the table. How do I pull up or > > refer to session variables? > > Additionally, I also check to see if the date_out > column in my sessions table is -00-00 00:00:00, if not, I > boot 'em and do a session_destroy();. > > -Dan Joseph > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
Thanks for the advise! It's a big help. I'll go play now and come back with more intelligent questions later! Jeff > -Original Message- > From: Dan Joseph [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 11:32 AM > To: Jeff McKeon; Dan Joseph; php > Subject: RE: [PHP] User authentication > > > Hi, > > > That's great help and exactly what I'd like to do timeouts > and all. I > > now just need to figure out he mechanics of the code for it > and get a > > better understanding of sessions. I'm thinking in the user > table I'll > > have a bunch of boolean fields for different permissions > that apply to > > different pages etc. To keep it simple at first I'll just have two > > permissions "read only" and "edit". Read only users will not be > > allowed to access pages where they can edit data. > > > > How do you check for idle? I suppose there is a built in variable > > that you check against the value in the table. How do I pull up or > > refer to session variables? > > Sessions are stored in the $_SESSION array. A simple > check would be: > > if ($_SESSION['user_id'] == "" || > is_null($_SESSION['user_id'])) redirect_to_index_function(); > > Where 'user_id' is, that would be the name of the > session you created. Just insert that at the top of each page > (might be best suited in an include file). > > -Dan Joseph > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User authentication
Dan, That's great help and exactly what I'd like to do timeouts and all. I now just need to figure out he mechanics of the code for it and get a better understanding of sessions. I'm thinking in the user table I'll have a bunch of boolean fields for different permissions that apply to different pages etc. To keep it simple at first I'll just have two permissions "read only" and "edit". Read only users will not be allowed to access pages where they can edit data. How do you check for idle? I suppose there is a built in variable that you check against the value in the table. How do I pull up or refer to session variables? Thank, Jeff > -Original Message- > From: Dan Joseph [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 11:15 AM > To: php > Subject: RE: [PHP] User authentication > > > Hi, > > > I'm not quite sure how to do this however so I'm looking > for advise to > > point me in the right direction. I suspect, that once > validated via > > the login page, I need to store the users permissions in a session > > variable and then before each page loads, check to see if > the page's > > permission requierments match the user requirements stored in the > > session's variable. Is this correct? Are there any security risks > > with this as this sight may one day be internet accessable. > If this > > isn't the correct approach, what is? > > Yes, you will need to set some session variables to > hold any information you want to check. Make sure you do not > store sensitive information in those though. In a site I > just built, we are only storing the user's name, user id > number, and access level. The site then checks every 60 > seconds to see if they are idle. I track the session login > times in a mysql table, and have it do the math on how long > they've been idle. This isn't really a common method from > what I've seen though, and your security requirements might > be a bit different. Our client wants the the site to log the > EU out if they've been idle for 15 minutes. Some people just > let PHP time out the session, then when they go to click on > something, it boots them back to the login page. > > Just remember to check for an active session each time > a secure page loads. Otherwise you'll have people bypassing > login page. > > For restricting what is shown on the page, there are > many methods. IF structures, etc, just make sure are > checking their access against what is shown. > > Does that help? > > -Dan Joseph > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] User authentication
Hey all, I'm building a website that will pull data from mysql db. No problem there. I've got a page to create users and store their info in a user table on another db. What I want to be able to do is have a user log in and then only have access to view information that his profile allows. I'm not quite sure how to do this however so I'm looking for advise to point me in the right direction. I suspect, that once validated via the login page, I need to store the users permissions in a session variable and then before each page loads, check to see if the page's permission requierments match the user requirements stored in the session's variable. Is this correct? Are there any security risks with this as this sight may one day be internet accessable. If this isn't the correct approach, what is? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session_start() problem
Hey all, I'm working out of a book teaching myself PHP4 here and I've got this code from a login web page... [begin code] session_start(); if(!isset($userid)) { login_form(); exit; } else { session_regisister("userid", "userpassword"); if(!$username) { session_unregister("userid"); session_unregister("userpassword"); echo "Authorization failed. " . "You must enter a valid userid and password combo. " . "Click on teh following link to try again.\n"; echo "login"; echo "If you do not have login, please contact Operations to obtain one.\n"; exit; } else echo "welcome, $username!"; } [end code] The page puts up a for with fields for username, password etc. nothing crazy, but when I open the page I get the following error displayed (before data is entered into the form and subitted). [begin error] PHP Warning: session_start(): open(/tmp\sess_d7d909aa6e85cf5489a50f6e42f03b12, O_RDWR) failed: No such file or directory (2) in c:\inetpub\wwwroot\auth_user.php on line 54 PHP Warning: Unknown(): open(/tmp\sess_d7d909aa6e85cf5489a50f6e42f03b12, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 [end error] Not sure what I did wrong except to think that PHP is trying to write the session id file to a directory that doesn't exist "/tmp." This is running on a MS IIS server. If I'm correct in my assessment, where do I set the default location for session data? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IIS Ports
can't you just beat up your brother? It won't fix your pc but it will probably make you feel better. :o) Chances are your bro is no genious and just using scripts (script kiddie) that other people write for known exploits. If this is the case, then you probably haven't been keeping up with your MS updates. What connection did he get to your pc/server though? was he inside the network or coming in from the internet. If he came in from the internet, what kind of connection are you running (cable, DSL etc)? Do you have a hardware firewall between the internet and your network? If not, you should. I make all my friend's/family who have cable/DSL modems spend the money and install them. Very often they've asked me to install them and just for gigles I turn on logging. Usually I see port scans within 10 minutes of the firewall coming up on the cable/DSL modem. Pretty scary. Whether your running MS or Linux, you should check for patches and updates EVERY DAY for all your systems and especially those acting as servers of any kind. There are also plenty of books on hacking that you can read to familarize yourself with the techniques of hacking. This will help you understand what's going on and better equip your network to deal with it. There are also many books on "box hardening" AKA firewalling. If your going to runs servers available on the internet, I suggest you read up on these things. good luck. -Original Message- From: Stephen Craton [mailto:[EMAIL PROTECTED] Sent: Sat 9/27/2003 4:31 PM To: PHP List Cc: Subject: [PHP] IIS Ports This is kind of off topic but kind of not, it's your call. My brother came home this weekend from college this weekend acting all cool since he has been learning to hack. He was telling us (the family) how he did random port penetration on the home network and he said my computer was the most vulnerable with around 25 ports open. I didn't really care until about an hour later he hacked into my computer and then reset it causing me to loose all my important information. I told my dad and my brother promptly lied about anything of the sort. What I want to know.since I know the majority of my ports open are from IIS.is how I can close these. I only need my local server accessible by just my computer but the entire network too.just not the network. I thought the ports would just be open on my computer and not the hardware firewall and everything. I went ahead and turned on the Windows XP firewall but I've heard it really sucks. So is there any way of closing the IIS ports so my brother, and any other hacker, can't get in here and cause havoc? Thanks, Stephen Craton http://www.melchior.us -- http://www.melchior.us/portfolio
RE: [PHP] str_pad
Thanks all! This is definitely one of the most helpfull mailing lists I belong to. Jeff > -Original Message- > From: Nitin [mailto:[EMAIL PROTECTED] > Sent: Friday, September 26, 2003 11:26 AM > To: Jeff McKeon; php > Subject: Re: [PHP] str_pad > > > It gives > > dbranch_no field in > $line array > > "$line->dbranch_no" replaces the value of 'dbranch_no' field > stored in '$line' array. > > Enjoy > Nitin > > - Original Message - > From: "Jeff McKeon" <[EMAIL PROTECTED]> > To: "Nitin" <[EMAIL PROTECTED]>; "Chris Grigor" > <[EMAIL PROTECTED]>; "php" <[EMAIL PROTECTED]> > Sent: Friday, September 26, 2003 8:30 PM > Subject: RE: [PHP] str_pad > > > > Just learning PHP and figuring out all the syntax and > stuff. Anyway I > > had a question about the code example in this post... > > > > What does the "->" do in: > > > > $dbranch = str_pad($line->dbranch_no, 6, '', STR_PAD_LEFT); > > > > Is dbranch_no a "class" I don't know about? > > > > Thanks, > > > > Jeff > > > > > > > -Original Message- > > > From: Nitin [mailto:[EMAIL PROTECTED] > > > Sent: Friday, September 26, 2003 8:05 AM > > > To: Chris Grigor; php > > > Subject: Re: [PHP] str_pad > > > > > > > > > of course, you can specify the optional argument > STR_PAD_LEFT like: > > > > > > $dbranch = str_pad($line->dbranch_no, 6, '', STR_PAD_LEFT); > > > > > > Enjoy, > > > Nitin > > > > > > > > > - Original Message - > > > From: "Chris Grigor" <[EMAIL PROTECTED]> > > > To: "php" <[EMAIL PROTECTED]> > > > Sent: Friday, September 26, 2003 4:49 PM > > > Subject: [PHP] str_pad > > > > > > > > > This should be quite an easy task for some... > > > > > > say for example $line->dbranch has a value of 3 > > > I know that 3 spaces will be added on to the end of $dbranch > > > > > > > > > $dbranch = str_pad($line->dbranch_no, 6); > > > > > > so the value of $dbranch should look like "3 " > > > > > > Is there anyway to right justify the 3 using str_pad .. example > > > still put the 3 spaces in but at the beginning??? > > > so it looks like " 3" > > > > > > > > > Chris > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] str_pad
Just learning PHP and figuring out all the syntax and stuff. Anyway I had a question about the code example in this post... What does the "->" do in: $dbranch = str_pad($line->dbranch_no, 6, '', STR_PAD_LEFT); Is dbranch_no a "class" I don't know about? Thanks, Jeff > -Original Message- > From: Nitin [mailto:[EMAIL PROTECTED] > Sent: Friday, September 26, 2003 8:05 AM > To: Chris Grigor; php > Subject: Re: [PHP] str_pad > > > of course, you can specify the optional argument STR_PAD_LEFT like: > > $dbranch = str_pad($line->dbranch_no, 6, '', STR_PAD_LEFT); > > Enjoy, > Nitin > > > - Original Message - > From: "Chris Grigor" <[EMAIL PROTECTED]> > To: "php" <[EMAIL PROTECTED]> > Sent: Friday, September 26, 2003 4:49 PM > Subject: [PHP] str_pad > > > This should be quite an easy task for some... > > say for example $line->dbranch has a value of 3 > I know that 3 spaces will be added on to the end of $dbranch > > > $dbranch = str_pad($line->dbranch_no, 6); > > so the value of $dbranch should look like "3 " > > Is there anyway to right justify the 3 using str_pad .. > example still put the 3 spaces in but at the beginning??? > so it looks like " 3" > > > Chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What to use?
Correct me if I'm wrong please, but I think number_format() has the adverse effect of changing the value type from numeric to char and therefore baring you from using it in mathematical equation later in the script. Anyway that's what it seemed to do to me when I used it on results from a MySQL query... Jeff > -Original Message- > From: Tyler Lane [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 4:20 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] What to use? > > > round() > and number_format() are what i would suggest using. > > On Thu, 2003-09-25 at 13:01, Ryan A wrote: > > Hi, > > I am running a query on the database to get the avg of a > few fields, I > > am getting a result something like this: > > > > 5. > > 4. > > 5. > > > > I dont want to use such big averages and want to cut the last to > > digits off so it will be something like: 5.00 > > 4.00 > > 44.23 > > etc > > > > I visited the manual and had a look at a few functions like trim, > > rtrim,ltrim,chop,explode etcwhich one is right for me? most of > > them are dealing with whitespace so it does not make much > sense right > > now with my current output > > > > Please help. > > > > Thanks, > > -Ryan > > > > > > > > > > We will slaughter you all! - The Iraqi (Dis)information > ministers site > > http://MrSahaf.com > -- > Tyler Lane <[EMAIL PROTECTED]> > Lyrical Communications > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Understanding code.. again
Thanks all! Jeff > -Original Message- > From: Chris Sherwood [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 4:15 PM > To: Jeff McKeon; [EMAIL PROTECTED] > Subject: Re: [PHP] Understanding code.. again > > > Yes the null is ignored when a var is passed > > <-- SNIP--> > Ok, so if an argument is supplied to the function, the "= > null" is ignored? > > Jeff > <-- snip --> > > chris > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Understanding code.. again
Ok, so if an argument is supplied to the function, the "= null" is ignored? Jeff > -Original Message- > From: Brad Pauly [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 4:09 PM > To: Jeff McKeon > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Understanding code.. again > > > Jeff McKeon wrote: > > Function Showmessage($msgvar = null) > > { > > echo $msgvar; > > } > > ?> > > --snip-- > > > > What is the purpose in the function def of "($msgvar = > null)"?? Why > > not just "function showmessage($msgvar)"?? > > That sets a default value for $msgvar so you can call the function > without an argument and it will not raise an error. > > - Brad > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Understanding code.. again
In the following code... --snip-- --snip-- What is the purpose in the function def of "($msgvar = null)"?? Why not just "function showmessage($msgvar)"?? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Reading Form Buttons
If(isset($_post['update'])) { do something; } If(isset($_POST['delete'])) { do something; } Jeff > -Original Message- > From: Dan J. Rychlik [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 3:35 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Reading Form Buttons > > > Hello, > > I cant figure this one out. In one form I have two button > that needs to trigger their respective functions. > > > > In php, how would I read the values or the names of the > buttons pressed? > > -Dan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timezones and Daylight Savings Time
What if you set the server to use UTC and then used the clients local system setting to offset it for each client? So the server would have it's time at UTC and a client in the Eastern US would be at -4. You could then detect the web client timezone setting and adjust as needed? This is just a logic suggestion, I have no idea if it's possible with code but I would imagin it would be.. Jeff > -Original Message- > From: J J [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 12:56 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Timezones and Daylight Savings Time > > > Got a client site in Thailand that is about 13 hours > different from the Web Server time so with any > date/time stamping I need to add the 13 hours. > However, when it comes time for DST, I'd hate to have > to code for that or remember to manually change the > time stamping. > > Is there some kind of automated function that > determines the time zone of one location to another > and stamps the correct time -- with or without DST? > > > I guess otherwise you'd have to do something like: > if > Oct 31st and < April XX { time+12 } else { > time+13 > > Obviously not the correct code but that's the idea. > Am I off base here? Is there a simpler method or > something I'm not thinking of? > > If the server was dedicated I would just fix the > server time to be Thailand time, but it's a shared > server and I can't do that. > > Thanks in advance! > > > __ > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help understanding code...
Thanks for the reply. What about he use of '!' with the strcmp() command. As I understand it, strcmp compairs two strings and returns <0 if str1 is less than str2, returns 0 if they are equal and returns >0 if str1 is greater than str2. At least that's what the PHP online manual says. How does the '!' "NOT" switch work with this? Is it saying If str1 and str2 are not equal? Or is it saying If str1 and str2 are not compared? Thanks, Jeff > -Original Message- > From: Jonathan Villa [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 12:50 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Help understanding code... > > > ! means not, for example $yes != $no > > Regarding the (xxx) ? x : x; > Your assumption is correct > > I use it alot, but sometimes it's still better to use if/else > statements > > On Thu, 2003-09-25 at 11:47, Jeff McKeon wrote: > > I've just picked up a more advanced book on PHP and it has a lot of > > example code in it. I understand most of it but some things > I'm seeing > > I don't understand. Like the following... > > > > code: > > > -- > -- > > > > > > $couponcode = (! empty($_REQUEST['couponcode'])) ? > > $_REQUEST['couponcode'] : NULL; > > > -- > > -- > > > > > > I think this is saying: > > > > If the global variable couponcode is not empty, then the variable > > '$couponcode' is equal to "$_REQUEST['couponcode']" > otherwise it gets > > a "NULL" value. > > > > What's throwing me is the use of the "!" and "?" and ":" > > > > If What I suspect is correct, I've never seen an if-then statement > > like this. If it is a replacement for an IF-Then statement > then it's > > much cleaner and I'd like to use it. > > > > another one is: > > > > > > code: > > > -- > -- > > > > IF (!strcmp($operator, '+')) { > > $result = $num1 + $num2 > > } > > > -- > -- > > > > > > I've looked up strcmp() and know it's used to compair two > strings. The > > $operator variable in the script that this was taken from is set to > > either "-", "+", "*" or "/". What I don't understand here > is what the > > "!" in front of strcmp() means. > > > > Can anyone break down the code for me and explain the parts? > > > > thanks, > > > > Jeff > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help understanding code...
I've just picked up a more advanced book on PHP and it has a lot of example code in it. I understand most of it but some things I'm seeing I don't understand. Like the following... code: $couponcode = (! empty($_REQUEST['couponcode'])) ? $_REQUEST['couponcode'] : NULL; I think this is saying: If the global variable couponcode is not empty, then the variable '$couponcode' is equal to "$_REQUEST['couponcode']" otherwise it gets a "NULL" value. What's throwing me is the use of the "!" and "?" and ":" If What I suspect is correct, I've never seen an if-then statement like this. If it is a replacement for an IF-Then statement then it's much cleaner and I'd like to use it. another one is: code: IF (!strcmp($operator, '+')) { $result = $num1 + $num2 } I've looked up strcmp() and know it's used to compair two strings. The $operator variable in the script that this was taken from is set to either "-", "+", "*" or "/". What I don't understand here is what the "!" in front of strcmp() means. Can anyone break down the code for me and explain the parts? thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php