[PHP] Extracting string from shell_exec call
Hello all. I have a function that executes the unzip command. function test_unzip($command) { $stdout = shell_exec($command); echo $stdout; } This is the content of $stdout after calling it with $command = unzip ./email/test.zip; Archive: ./email/test.zip inflating: ./txt/test.txt What I want to do is to extract the value(s) after inflating, so that I can check what was extracted from the zip. The reason why I cannot use the PHP zip functions is that I have to use a different decompressing utility other than unzip which outputs a different thing. Depending on what is output then I can decide what tool to use. So I need to extract test.txt from the string above. How can I do it? Sometimes the unzip utility is not compatible with the zip file because it might be proprietary. Therefore I will call pkzipc instead of unzip. Whenever I have the string from executing unzip : Archive: proprietary.zip skipping: proprietary.txt `shrink' method not supported Now, instead of inflating I have skiping because I cannot unzip this zip file with the free unzip utility, instead I call pkzipc and I then suceed: pkunzip proprietary.zip PKZIP(R) Version 6.0 FAST! Compression Utility for Linux X86 Copyright 1989-2002 PKWARE Inc. All Rights Reserved. Evaluation Version PKZIP Reg. U.S. Pat. and Tm. Off. Patent No. 5,051,745 Extracting files from .ZIP: pv0551.zip Unshrinking: proprietary.txt Therefore, what I need help with is to analyze the $stdout variable: If that contains inflating I need to know what was decompressed. If contains skipping then I must call this function using pkzipc instead. Then I must extract whatever value after Unshrinking: Can anyone help? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Printing using php script CRON
Vern wrote: I get: # wget -O -q http://www.comp-wiz.com/index.html | lpr -P hp1300n What I wrote was wget -O -q - http://www.domain.com/file.php | lpr -P hp1300n You forgot - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] We give you $200 bonus at Casino Zeal!
Hi, I have a special offer available for you at our casino. $20 to try our internet casino, no deposit is necessary! At the casino software's cashier enter bonus code: FR93P $200 bonus on your first deposit! At the casino software's cashier enter bonus code: FMJKU Allow us to show you our quality operation, fast payouts, generous bonuses, and super friendly around-the-clock customer support. Click here: http://bigbonus-casino.com Best regards, Jamie Zawinsky No thanks: http://bigbonus-casino.com/u/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extracting string from shell_exec call
C.F. Scheidecker Antunes wrote: Hello all. I have a function that executes the unzip command. .. What I want to do is to extract the value(s) after inflating, so that I can check what was extracted from the zip. You can do so with regular expresson but a more simple aproach may be to use the split command the split up the output from the shell command into an array. then you can do a string comparision on each element - less elegent but easier to master if you are not familiar with regular expressions. -- 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 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP editor that doesn't require installation
Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Edit locally and FTP manually. Or get some kind of mounted FTP filesystemdoesn't Windows XP have something like this built in? As far as I know, but there is great program that does that. WebDrive. A true little gem I may add. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing PEAR on Windows
Hi Matt (et al), I've added the c:\www\pear path to both the windows path and also the path in the php.ini file. However it's still coming up with the same error. Is there a way of putting in a temporary path in the go-pear.php file? Nunners Quoting Matt M. [EMAIL PROTECTED]: Warning: main(PEAR.php): failed to open stream: No such file or directory in C:\ www\pear\Archive\Tar.php on line 21 Fatal error: main(): Failed opening required 'PEAR.php' (include_path='/C:\DOCUM E~1\ADMINI~1.DEV\LOCALS~1\Temp\gop1.tmp') in C:\www\pear\Archive\Tar.php on line 21 pear is requiring that PEAR.php be included in the script and it can't find it. I think adding C:\www\pear\ to your include path might solve this problem -- 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] For Loop Problems
Hello Everyone, I'm building a hotel management system and I can't seem to figure out why my for() loop doesn't work the way it should. I'm using patTemplate to create the HTML Template (I like using it and I don't want to start a pro/con template war). Here is the script: for ($j = 0; $j 32; $j++) { for ($i = 0; $i count($num_days); $i++) { $template-addVar(room_num, ROOM_NUM, '101'); $template-addVar(room_type, ROOM_TYPE, 'NQQ'); $template-addVar(guest_NameRate, GUEST_NAME, 'NAVID YAR'); $template-addVar(guest_NameRate, GUEST_ID, 'fname'); $template-addVar(guest_NameRate, CLASS_GUEST, 'fname'); $template-addVar(guest_NameRate, ROOM_RATE, '49.95'); $template-parseTemplate(guest_NameRate, a); } $template-parseTemplate(guest_row, a); } This inner for() loop works great. It creates a SINGLE row with 7 columns of data (one column for each day of the week). However, the outer for() loop does not work like it should. I want it to display 32 rows of 7 columns per row. But what happens is that on every row after the first row it appends 7 more columns at the end of each row. So row 2 will have 14 columns, row 3 will have 21 columns, row 4 will have 28 columns, and so on. I can't figure out why this is. Either it's something new in PHP5 or I'm doing something really stupid. I am sending a PDF attachment of a snapshot showing a hint, made purely with HTML, of what I am trying to achieve. If anyone can help me it would be greatly appreciated. Thanks guys. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieving Stored Values for Dropdown Menu
Hi all. I'm trying to retrieve values from a previously selected dropdown menu. For text I simply use value=$Whatever But for dropdowns I can't do this - has anyone else come across this before...? -- - 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
Re: [PHP] For Loop Problems
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] for ($j = 0; $j 32; $j++) { for ($i = 0; $i count($num_days); $i++) { $template-addVar(room_num, ROOM_NUM, '101'); $template-addVar(room_type, ROOM_TYPE, 'NQQ'); $template-addVar(guest_NameRate, GUEST_NAME, 'NAVID YAR'); $template-addVar(guest_NameRate, GUEST_ID, 'fname'); $template-addVar(guest_NameRate, CLASS_GUEST, 'fname'); $template-addVar(guest_NameRate, ROOM_RATE, '49.95'); $template-parseTemplate(guest_NameRate, a); } $template-parseTemplate(guest_row, a); } This inner for() loop works great. It creates a SINGLE row with 7 columns of data (one column for each day of the week). However, the outer for() loop does not work like it should. I want it to display 32 rows of 7 columns per row. But what happens is that on every row after the first row it appends 7 more columns at the end of each row. So row 2 will have 14 columns, row 3 will have 21 columns, row 4 will have 28 columns, and so on. I can't figure out why this is. Either it's something new in PHP5 or I'm doing something really stupid. I am sending a PDF attachment of a snapshot showing a hint, made purely with HTML, of what I am trying to achieve. If anyone can help me it would be greatly appreciated. Thanks guys. I seriously doubt that php has problems to execute for loop correctly, you are probably missusing your template system. Say what does a stand for in: $template-parseTemplate(guest_NameRate, a); if it stands for append, than maybe in second pass through the loop you add 7 fiends to allready existing 7, in 3. pass you add 7 more to 14 existing, etc.. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieving Stored Values for Dropdown Menu
On Wed, 28 Jul 2004 20:49, Harlequin wrote: Hi all. I'm trying to retrieve values from a previously selected dropdown menu. For text I simply use value=$Whatever But for dropdowns I can't do this - has anyone else come across this before...? Surprisingly, yes. If the dropdown has multiple selections, name it as an array - listoptions[] -- David Robley I get mail I exist. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Accessing a variable from inside a local function
Would anyone know how to resolve this scope problem? Or is this possibly something PHP can't (yet) do? The problem is to access a variable in a function foo from a function local to foo. - - - function foo($var_foo) { $my_foo_local = 10; //How can I reach this from inside function bar(...? function bar($var_bar) { return $my_foo_local+$var_bar+1; // Doesn't work, can't see $my_foo_local } return bar($var_foo)+1; } if (foo(0)==12) echo Yes! I did it!; else echo Nope. Sorry; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing PEAR on Windows
[EMAIL PROTECTED] wrote: Hi Matt (et al), I've added the c:\www\pear path to both the windows path and also the path in the php.ini file. However it's still coming up with the same error. Is there a way of putting in a temporary path in the go-pear.php file? Yes... ini_set('include_path', 'yourpath'). When I installed PHP5 I had a slight problem... my existing pear installation (with different path etc. from PHP4) was changing the path every time that it ran. If you are also upgrading, it could happen at several points: Your environment variables (PHP_INSTALL_DIR, others) Your pear.bat file Your PEAR.php file Rogue php.ini file (perhaps in system root) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop Problems
[EMAIL PROTECTED] wrote: Hello Everyone, I'm building a hotel management system and I can't seem to figure out why my for() loop doesn't work the way it should. I'm using patTemplate to create the HTML Template (I like using it and I don't want to start a pro/con template war). Here is the script: for ($j = 0; $j 32; $j++) { for ($i = 0; $i count($num_days); $i++) { $template-addVar(room_num, ROOM_NUM, '101'); $template-addVar(room_type, ROOM_TYPE, 'NQQ'); $template-addVar(guest_NameRate, GUEST_NAME, 'NAVID YAR'); $template-addVar(guest_NameRate, GUEST_ID, 'fname'); $template-addVar(guest_NameRate, CLASS_GUEST, 'fname'); $template-addVar(guest_NameRate, ROOM_RATE, '49.95'); $template-parseTemplate(guest_NameRate, a); } I'm not aware of what patTemplate does, but my guess is that when you addVar() each time it is just pushing each variable into an array. In other words, you keep adding 7 elements onto the end of an array WITHOUT removing old elements. There is probably a removeVar method or something similar to help you with this. If not, then you probably need to have a different template variable for each row and then populate those template variables with 1 week's data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Accessing a variable from inside a local function
Something like this is probably better handled by a class. Then you can access class properties to do what you want. Class yourclass { function foo() { $this-my_foo_local = 10; } function bar($var_bar) { return $this-my_foo_local+$var_bar+1; } } $object = new yourclass(); $object-foo(); echo $object-bar(12); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieving Stored Values for Dropdown Menu
OK David. But here's the conundrum: a User has already selected a value which is stored in the database. Can I Display a range of option tags but make the one the user selected previously as the default...? ??? -- - Michael Mason Arras People www.arraspeople.co.uk - David Robley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 28 Jul 2004 20:49, Harlequin wrote: Hi all. I'm trying to retrieve values from a previously selected dropdown menu. For text I simply use value=$Whatever But for dropdowns I can't do this - has anyone else come across this before...? Surprisingly, yes. If the dropdown has multiple selections, name it as an array - listoptions[] -- David Robley I get mail I exist. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Accessing a variable from inside a local function
Thanks for the good suggestion, a fully usable workaround if a cleaner thing doesn't surface. And for your response time.. well, I have had slower answers in phone-conversations... :-) At 06:37 PM 7/28/2004, Jason Barnett wrote: Something like this is probably better handled by a class. Then you can access class properties to do what you want. Class yourclass { function foo() { $this-my_foo_local = 10; } function bar($var_bar) { return $this-my_foo_local+$var_bar+1; } } $object = new yourclass(); $object-foo(); echo $object-bar(12); -- 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] Re: Retrieving Stored Values for Dropdown Menu
On 28 July 2004 12:50, Harlequin wrote: OK David. But here's the conundrum: a User has already selected a value which is stored in the database. Can I Display a range of option tags but make the one the user selected previously as the default...? That's been asked and answered many times on this list -- why not search the archives? Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Accessing a variable from inside a local function
On 28 July 2004 12:29, Frank Munch wrote: Would anyone know how to resolve this scope problem? Or is this possibly something PHP can't (yet) do? The problem is to access a variable in a function foo from a function local to foo. Actually, your problem is that the function bar is *not* local to foo. Even though PHP lets you declare functions lexically within the scope of other functions, semantically they are still global functions and have no access whatsoever to the enclosing function. - - - function foo($var_foo) { $my_foo_local = 10; //How can I reach this from inside function bar(...? function bar($var_bar) { return $my_foo_local+$var_bar+1; // Doesn't work, can't see $my_foo_local } return bar($var_foo)+1; } if (foo(0)==12) echo Yes! I did it!; else echo Nope. Sorry; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] WAHT about gd 2.0.28 and Gif support?
Hi, i saw that 07/21/04, gd 2.0.28 has been released with gif support enabled again (reading and creating). Since the beggining of the month, the Unisys licence for Gif usage is not necessary anymore. So maybe this question has already been asked, but I didn't find it (sorry), will next version PHP 5.0.1 use this new GD library and have gif support? Thanks ;-) Romain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR Spreadsheet_excel_writer problem
Hi I have a class the utilizes the excel writer package but I'm having a few problems with it on my production server. My development server is a Windows XP Pro box running PHP version 4.3.5. On this box I dont get any problems and my class generates a valid excel document. My production server is a FreeBSD box running PHP version 4.3.4. With this box my class will create a excel document but when I go to open the file up, it comes back and tells me the file is unreadable as it is 0 bytes in size. I know the sql query I'm running is returning data as I can create a tabbed delimited excel document from it. Can anyone help me with this or point me in the right direction, as its driving me mad. Thanks Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Accessing a variable from inside a local function
At 07:39 PM 7/28/2004, Ford, Mike [LSS] wrote: Actually, your problem is that the function bar is *not* local to foo. Even though PHP lets you declare functions lexically within the scope of other functions snip Ouch! Thanks! Got that much wiser! So for keeping the namespace cleaner using classes is the only way. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I return the error
Hi I have this function below - if it reurns false I want to also return the error so I can print it in my calling function. Can I do this? Cheers Matt function fileUpload($file) { if ($file['type'] == image/gif || $file['type'] == image/pjpeg){ if (@copy ($file['tmp_name'], images/ . $file['name'])) return true; }else { return false; } }
[PHP] php.net bug tracking tool?
Which bug tracking tool is php.net using? I know it sounds stupid, but even as I can look at the source on php.net, I can't find any documentation- is this package available for download somewhere? Thanks, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I return the error
Matthew Oatham wrote: Hi I have this function below - if it reurns false I want to also return the error so I can print it in my calling function. Can I do this? Cheers Matt function fileUpload($file) { if ($file['type'] == image/gif || $file['type'] == image/pjpeg){ if (@copy ($file['tmp_name'], images/ . $file['name'])) return true; }else { return false; } } $error = ; function fileUpload($file) { global $error; if ($file['type'] == image/gif || $file['type'] == image/pjpeg){ if (@copy ($file['tmp_name'], images/ . $file['name'])) return true; }else { $error = Something went wrong; return false; } } if ( ! fileUpload ( $file ) ) { echo ( $error ); } Course, there are numerous other ways of doing this. I persoanlly use two custom functions to handle/display errors. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I return the error
what about returning the error the copy function would have thrown ? Thanks - Original Message - From: John Nichel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 3:00 PM Subject: Re: [PHP] How do I return the error Matthew Oatham wrote: Hi I have this function below - if it reurns false I want to also return the error so I can print it in my calling function. Can I do this? Cheers Matt function fileUpload($file) { if ($file['type'] == image/gif || $file['type'] == image/pjpeg){ if (@copy ($file['tmp_name'], images/ . $file['name'])) return true; }else { return false; } } $error = ; function fileUpload($file) { global $error; if ($file['type'] == image/gif || $file['type'] == image/pjpeg){ if (@copy ($file['tmp_name'], images/ . $file['name'])) return true; }else { $error = Something went wrong; return false; } } if ( ! fileUpload ( $file ) ) { echo ( $error ); } Course, there are numerous other ways of doing this. I persoanlly use two custom functions to handle/display errors. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] How do I return the error
Matthew Oatham wrote: what about returning the error the copy function would have thrown ? Thanks http://us4.php.net/copy It only returns true or false. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] document changes
Hello, I'm looking for an application that would allow easy documentation of changes to a system, device or application. This would be used to record changes made for future reference. It would simply have categories that would contain a particular device or system and under that device or system would be information on changes that have been made. Kind of like a change log used for new releases of applications. Is anyone aware of an existing application written in PHP and MySQL? Thanks, -- Rod Green [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie image manipulation question
I'm just about to dive into image uploading resizing for the first time. Do I need Imagemagick for this, or are PHP's Image tags adequate? All I want to do is let the user upload a graphic, and have PHP automatically scale it to a couple of desired sizes, and name them, pretty basic stuff. I don't suppose there is an example or tutorial of this process anywhere, geared toward B1FF the n00b? Obviously this has been done a thousand times before... Thanks for any clueing-in, - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie image manipulation question
On Wednesday 28 July 2004 23:05, Brian Dunning wrote: I'm just about to dive into image uploading resizing for the first time. Do I need Imagemagick for this, or are PHP's Image tags adequate? All I want to do is let the user upload a graphic, and have PHP automatically scale it to a couple of desired sizes, and name them, pretty basic stuff. I don't suppose there is an example or tutorial of this process anywhere, geared toward B1FF the n00b? Obviously this has been done a thousand times before... Indeed. Thanks for any clueing-in, Thank google php image upload resize -- 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 -- /* A friend of mine won't get a divorce, because he hates lawyers more than he hates his wife. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie image manipulation question
Hello, Brian Dunning wrote: I'm just about to dive into image uploading resizing for the first time. Do I need Imagemagick for this, or are PHP's Image tags adequate? All I want to do is let the user upload a graphic, and have PHP automatically scale it to a couple of desired sizes, and name them, pretty basic stuff. I don't suppose there is an example or tutorial of this process anywhere, geared toward B1FF the n00b? Obviously this has been done a thousand times before... Indeed yes according to google. Not sure if they will suite n00bs but many newbies seem to manage with them. Even without google hotscripts etc will have hundreds more. You can try mine if you are interested http://www.raditha.com/megaupload/image.php - Thanks for any clueing-in, - Brian -- 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 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie image manipulation question
Hey, you can do what your looking for with phps gd comiled in. You may need to add jpg, gif libs if you dont already have them. Check GD on the php site, there are plenty of examples that cover exactly what your looking for i think. Jason On Wed, 28 Jul 2004 08:05:52 -0700, Brian Dunning [EMAIL PROTECTED] wrote: I'm just about to dive into image uploading resizing for the first time. Do I need Imagemagick for this, or are PHP's Image tags adequate? All I want to do is let the user upload a graphic, and have PHP automatically scale it to a couple of desired sizes, and name them, pretty basic stuff. I don't suppose there is an example or tutorial of this process anywhere, geared toward B1FF the n00b? Obviously this has been done a thousand times before... Thanks for any clueing-in, - 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
[PHP] Re: Retrieving Stored Values for Dropdown Menu
I ended up with this: option selected?php echo $Variable; ?/option Can you see any obvious problems I might miss.? -- - Michael Mason Arras People www.arraspeople.co.uk - Harlequin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all. I'm trying to retrieve values from a previously selected dropdown menu. For text I simply use value=$Whatever But for dropdowns I can't do this - has anyone else come across this before...? -- - 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
RE: [PHP] Re: Retrieving Stored Values for Dropdown Menu
option selected?php echo $Variable; ?/option Can you see any obvious problems I might miss.? You're specifying a variable for the option's text, but you also need to specify the option's value. For example, if you were retrieving data from MySQL: while ($record = mysql_fetch_array($results)) { echo option value=' . $record[ID] . ' . $record[Title] . /option\n; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Expiration Timeout
Hi all, I'm dealing with sessions in a project. Here people are editing some documents on-line, so it can take long, long time to complete a document. The problem is that when it takes so long to edit a page and hitting the submit button in a form, the session has expired and the user looses all the work done. I've been looking for about changing somewhere the session exiration time, but only found about the session cookie expiration. Also, all examples I've found to not get the session expired talk about creating some sort of javascript wich reloads something on a frame, iframe, etc. I've not found any information about session expiration timeout looking at the manual and searching google for many hours ... So I came here to ask about: - Wich is the default timeout for a session? And, is some way to know the expiration time for a session? - Is anyway to change the session expiration timeout? I mean a PHP parameter or function. Javascript workarounds i've found are not valid for me. BTW. Making this search I've found two interesting resources for managing data base driven sessions: An interesting tutorial: http://www.devarticles.com/c/a/MySQL/Developing-Custom-PHP-Sessions A nice class: http://codewalkers.com/seecode/463.html Best regards, Jordi Canals -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net bug tracking tool?
* Thus wrote Andreas Goetz: Which bug tracking tool is php.net using? I know it sounds stupid, but even as I can look at the source on php.net, I can't find any documentation- is this package available for download somewhere? you can checkout the code from cvs: cvs -d :pserver:[EMAIL PROTECTED]:/repository checkout php-bugs-web see: http://cvs.php.net/php-bugs-web http://www.php.net/anoncvs.php you might be better off finding a more generic bug tracking system. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I return the error
* Thus wrote Matthew Oatham: what about returning the error the copy function would have thrown ? * turn display_errors off: ini_set('display_errors', false); * turn track_errors on: ini_set('track_errors', true); if (! copy(...) ) { echo copy failed: $php_errormsg; } Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Expiration Timeout
I've been looking for about changing somewhere the session exiration time, but only found about the session cookie expiration. - Wich is the default timeout for a session? And, is some way to know the expiration time for a session? Take a look at the ini variables. http://us2.php.net/session session.gc_maxlifetime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Expiration Timeout
I beleive there is some session timeout setting in php.ini .. search for session or expire or timeout in that file. Jason On Wed, 28 Jul 2004 20:18:21 +0200, Jordi Canals [EMAIL PROTECTED] wrote: Hi all, I'm dealing with sessions in a project. Here people are editing some documents on-line, so it can take long, long time to complete a document. The problem is that when it takes so long to edit a page and hitting the submit button in a form, the session has expired and the user looses all the work done. I've been looking for about changing somewhere the session exiration time, but only found about the session cookie expiration. Also, all examples I've found to not get the session expired talk about creating some sort of javascript wich reloads something on a frame, iframe, etc. I've not found any information about session expiration timeout looking at the manual and searching google for many hours ... So I came here to ask about: - Wich is the default timeout for a session? And, is some way to know the expiration time for a session? - Is anyway to change the session expiration timeout? I mean a PHP parameter or function. Javascript workarounds i've found are not valid for me. BTW. Making this search I've found two interesting resources for managing data base driven sessions: An interesting tutorial: http://www.devarticles.com/c/a/MySQL/Developing-Custom-PHP-Sessions A nice class: http://codewalkers.com/seecode/463.html Best regards, Jordi Canals -- 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] Re: Retrieving Stored Values for Dropdown Menu
I'd like to make a few changes here to hopefully answer the original question. On Wednesday 28 July 2004 01:35 pm, Ed Lazor wrote: echo select name=\record\; while ($record = mysql_fetch_array($results)) { if ($_POST[record] == $record[ID]){ $SELECTED = SELECTED ; } else { $SELECTED = ; } echo option value=' . $record[ID] . ' .$SELECTED. . $record[Title] . /option\n; } echo /select; James Hicks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Templates Cached on Server
Hi all, I am doing some development work on a new server I put together. For some reason, changes I make to PHP templates don't show up right away. I have not figured out how long they take to start showing, but it could be somewhere around 30 - 60 seconds. Where is this setting modified? Thanks, Rogue -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unset($_COOKIE['foo']) and $_COOKIE['foo'] = '' both don't do anything.
Linux. PHP5. Maybe I'm doing something wrong, but I've tried both: unset($_COOKIE['foo']); And also $_COOKIE['foo'] = ''; And neither of them seem to do anything. I can still see the cookie and worse, the value if I do foreach ($_COOKIE as $key = $val) echo $key = $val; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset($_COOKIE['foo']) and $_COOKIE['foo'] = '' both don't do anything.
unset($_COOKIE['foo']); And also $_COOKIE['foo'] = ''; Are you trying to delete the cookie on the client side? if so try: setcookie ('foo', '', time() - 3600); http://us2.php.net/setcookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 and objects
Hello, I'm trying to make this code to work: // start of code abstract class Strona { abstract public function generuj_strone(); function foo() { generuj_strone(); } } class Katalog extends Strona { public function generuj_strone() { echo OK; } } $bar = new Katalog(); $bar-foo(); // end of code And I get such error : Fatal error: Cannot call abstract method Strona::generuj_strone() in And I expect word: OK Is it a bug or a normal behaviour ? Thanks for help! Krzysztof Gorzelak [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is_numeric questions
Does is_numeric include commas decimals and dollar signs? How do I use this to error check form data? I'm having a hard time figuring out what the correct syntax is for that application. Thanks. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] unset($_COOKIE['foo']) and $_COOKIE['foo'] = '' both don't do anything.
No. I'm trying to delete it from PHP memory, but keep the cookie on their client in the cookie.txt file or wherever it's stored. The idea is for added security. I just don't want traces of it around after the initial login. -Original Message- From: Matt M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 12:03 PM To: Daevid Vincent Cc: [EMAIL PROTECTED] Subject: Re: [PHP] unset($_COOKIE['foo']) and $_COOKIE['foo'] = '' both don't do anything. unset($_COOKIE['foo']); And also $_COOKIE['foo'] = ''; Are you trying to delete the cookie on the client side? if so try: setcookie ('foo', '', time() - 3600); http://us2.php.net/setcookie -- 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] php5 and object
Hello, I'm trying to make this code to work: // start of code abstract class Strona { abstract public function generuj_strone(); function foo() { generuj_strone(); } } class Katalog extends Strona { public function generuj_strone() { echo OK; } } $bar = new Katalog(); $bar-foo(); // end of code And I get such error : Fatal error: Cannot call abstract method Strona::generuj_strone() in And I expect word: OK Is it a bug or a normal behaviour ? Thanks for help! Krzysztof Gorzelak [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_numeric questions - followup
Jeff Oien wrote: Does is_numeric include commas decimals and dollar signs? How do I use this to error check form data? I'm having a hard time figuring out what the correct syntax is for that application. Thanks. Jeff I think what I should have asked is how to tell if something is not numberic. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: is_numeric questions
Jeff Oien [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does is_numeric include commas decimals and dollar signs? How do I use this to error check form data? I'm having a hard time figuring out what the correct syntax is for that application. Thanks. Jeff It surely will not allow a dollar sign. Otherwise just test it with various values! You might take a look at PEAR::Validate for checking *true* numeric values: http://pear.php.net/package/Validate Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] is_numeric questions - followup
From: Jeff Oien [EMAIL PROTECTED] Does is_numeric include commas decimals and dollar signs? How do I use this to error check form data? I'm having a hard time figuring out what the correct syntax is for that application. Thanks. Jeff I think what I should have asked is how to tell if something is not numberic. if(!is_numeric($var)) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 and object
http://us4.php.net/manual/en/language.oop5.abstract.php The short is that you can't do anything more than define a function in an abstract class. IIRC, change abstract to interface, and you'll probably be okay. On Wed, 28 Jul 2004 21:18:26 +0200, Krzysztof Gorzelak [EMAIL PROTECTED] wrote: Hello, I'm trying to make this code to work: // start of code abstract class Strona { abstract public function generuj_strone(); function foo() { generuj_strone(); } } class Katalog extends Strona { public function generuj_strone() { echo OK; } } $bar = new Katalog(); $bar-foo(); // end of code And I get such error : Fatal error: Cannot call abstract method Strona::generuj_strone() in And I expect word: OK Is it a bug or a normal behaviour ? Thanks for help! Krzysztof Gorzelak [EMAIL PROTECTED] -- 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] php5 and object
A change to interface gives me such error : Interface function Strona::foo() cannot contain body Krzysztof Gorzelak [EMAIL PROTECTED] Uzytkownik Stephen Sadowski [EMAIL PROTECTED] napisal w wiadomosci news:[EMAIL PROTECTED] http://us4.php.net/manual/en/language.oop5.abstract.php The short is that you can't do anything more than define a function in an abstract class. IIRC, change abstract to interface, and you'll probably be okay. On Wed, 28 Jul 2004 21:18:26 +0200, Krzysztof Gorzelak [EMAIL PROTECTED] wrote: Hello, I'm trying to make this code to work: // start of code abstract class Strona { abstract public function generuj_strone(); function foo() { generuj_strone(); } } class Katalog extends Strona { public function generuj_strone() { echo OK; } } $bar = new Katalog(); $bar-foo(); // end of code And I get such error : Fatal error: Cannot call abstract method Strona::generuj_strone() in And I expect word: OK Is it a bug or a normal behaviour ? Thanks for help! Krzysztof Gorzelak [EMAIL PROTECTED] -- 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] php5 and objects
* Thus wrote Krzysztof Gorzelak: // start of code abstract class Strona { abstract public function generuj_strone(); function foo() { generuj_strone(); } } class Katalog extends Strona { public function generuj_strone() { echo OK; } } $bar = new Katalog(); $bar-foo(); // end of code And I get such error : Fatal error: Cannot call abstract method Strona::generuj_strone() in And I expect word: OK Is it a bug or a normal behaviour ? It may be a bug, but not in the sense as your probably think. The error message should be complaining about an undefined function instead of trying to access self::generuj_strone() In foo() use: $this-generuj_strone(); That will make things work properly Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 and object
* Thus wrote Stephen Sadowski: http://us4.php.net/manual/en/language.oop5.abstract.php The short is that you can't do anything more than define a function in an abstract class. Negative. It is perfectly fine to have code within an abstract class. The documentation needs to get expanded a little bit to define exactly how an for what use an abstract class can be used. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 and objects
Uzytkownik Curt Zirzow [EMAIL PROTECTED] napisal w wiadomosci * Thus wrote Krzysztof Gorzelak: // start of code abstract class Strona { abstract public function generuj_strone(); function foo() { generuj_strone(); } } class Katalog extends Strona { public function generuj_strone() { echo OK; } } $bar = new Katalog(); $bar-foo(); // end of code And I get such error : Fatal error: Cannot call abstract method Strona::generuj_strone() in And I expect word: OK Is it a bug or a normal behaviour ? It may be a bug, but not in the sense as your probably think. The error message should be complaining about an undefined function instead of trying to access self::generuj_strone() In foo() use: $this-generuj_strone(); That will make things work properly Curt Thank's, all works fine. There is also no bug - in my previous version I had self::generuj_strone(); not generuj_strone(); as I wrote. Thanks a lot Krzysztof Gorzelak [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Expiration Timeout
Matt M. wrote: - Wich is the default timeout for a session? And, is some way to know the expiration time for a session? Take a look at the ini variables. http://us2.php.net/session session.gc_maxlifetime Thanks Matt. for your quick and clear answer. I've readed about it, and seen the default is 24 minutes. When readed the first time I did not associate the garbage collector with the session timeout :( Then, if I understood that correcty, the expiration time for a session is controlled by the session garbage collector. Is that correct ? Thanks again, Jordi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Templates Cached on Server
On Wed, 28 Jul 2004 14:41:20 -0400, rogue [EMAIL PROTECTED] wrote: Hi all, I am doing some development work on a new server I put together. For some reason, changes I make to PHP templates don't show up right away. I have not figured out how long they take to start showing, but it could be somewhere around 30 - 60 seconds. Where is this setting modified? If you're talking about actual PHP files, they normally aren't cached at all. Are you running some kind of cache, such as Turck MMCache? If you're talking about something like Smarty templates then you need to look into the settings of your template system. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reading txt file - certain lines
Hi there.. .I am displaying info (on music) from a text file with the following code... ?php //open the file handler $fp02=fopen(assets/lib/php/itunes/recent.txt,r); //Read the track info $recent=fgets($fp02); //close the file. echo $recent; fclose($fp02); ? Now the contents of said text file would read something like the following: bLiar/bbrby ibSex Pistols/bibriNever Mind The Bollocks/ibrPlayed: 2004/07/28, 1:48:29 PMbr--brbLet's Rave On/bbrby ibThe Raveonettes/bibriChain Gang Of Love/ibrPlayed: 2004/07/28, 1:46:37 PMbr--brbNo Remorse/bbrby ibMetallica/bibriKill 'Em All/ibrPlayed: 2004/07/28, 1:40:17 PMbr--brbThis Is Our Emergency/bbrby ibPretty Girls Make Graves/bibriThe New Romance/ibrPlayed: 2004/07/28, 1:36:37 PMbr--brbFreestylin'/bbrby ibGreyboy/bibriFreestylin'/ibrPlayed: 2004/07/28, 1:30:25 PMbr--brbIn My Head/bbrby ibNaked Raygun/bibriRaygun...Naked Raygun (Reissue)/ibrPlayed: 2004/07/28, 1:26:37 PMbr--brbLust To Love/bbrby ibThe Go-Go's/bibriReturn To The Valley Of The Go-Go's/ibrPlayed: 2004/07/28, 1:23:13 PMbr--brbKim You Bore Me To Death/bbrby ibGrandaddy/bibriConcrete Dunes/ibrPlayed: 2004/07/28, 1:18:37 PMbr--brbSonderkommando/bbrby ibGwar/bibriThis Toilet Earth/ibrPlayed: 2004/07/28, 1:13:49 PMbr--br Now what I want to do is read this file, but only say read 5 songs worth, then I would place the PHP code in (another table) and display the next 5 songs and so on This just allows for a more flexible layout in the final presentation. the way I am having the text files written, there is no way to get it to produce seperate text files - otherwise this would be easy to do Is this possible? Thanks in advance! Dustin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading txt file - certain lines
Dustin Krysak wrote: Hi there.. .I am displaying info (on music) from a text file with the following code... ?php //open the file handler $fp02=fopen(assets/lib/php/itunes/recent.txt,r); //Read the track info $recent=fgets($fp02); //close the file. echo $recent; fclose($fp02); ? Now the contents of said text file would read something like the following: bLiar/bbrby ibSex Pistols/bibriNever Mind The Bollocks/ibrPlayed: 2004/07/28, 1:48:29 PMbr--brbLet's Rave On/bbrby ibThe Raveonettes/bibriChain Gang Of Love/ibrPlayed: 2004/07/28, 1:46:37 PMbr--brbNo Remorse/bbrby ibMetallica/bibriKill 'Em All/ibrPlayed: 2004/07/28, 1:40:17 PMbr--brbThis Is Our Emergency/bbrby ibPretty Girls Make Graves/bibriThe New Romance/ibrPlayed: 2004/07/28, 1:36:37 PMbr--brbFreestylin'/bbrby ibGreyboy/bibriFreestylin'/ibrPlayed: 2004/07/28, 1:30:25 PMbr--brbIn My Head/bbrby ibNaked Raygun/bibriRaygun...Naked Raygun (Reissue)/ibrPlayed: 2004/07/28, 1:26:37 PMbr--brbLust To Love/bbrby ibThe Go-Go's/bibriReturn To The Valley Of The Go-Go's/ibrPlayed: 2004/07/28, 1:23:13 PMbr--brbKim You Bore Me To Death/bbrby ibGrandaddy/bibriConcrete Dunes/ibrPlayed: 2004/07/28, 1:18:37 PMbr--brbSonderkommando/bbrby ibGwar/bibriThis Toilet Earth/ibrPlayed: 2004/07/28, 1:13:49 PMbr--br Now what I want to do is read this file, but only say read 5 songs worth, then I would place the PHP code in (another table) and display the next 5 songs and so on This just allows for a more flexible layout in the final presentation. the way I am having the text files written, there is no way to get it to produce seperate text files - otherwise this would be easy to do Is this possible? Yes, possible. Worth the time? No. Can you put all that info in a database? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']
Does anybody have any ideas on how I can prevent caching of $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'], or clear them? I currently have a restricted area on the site I'm currently designing and all works well until I log out. When I log out I successfully destroy the session and the cookie and I'm refused access to all pages until I browse back to the page that processes my login to the restricted area. I am then forwarded into the admin area as if I had logged in and my cookie and session have both been recreated. Here is my current log out script: session_start(); $_SESSION=array(); unset($_COOKIE[session_name()]); $_SERVER['PHP_AUTH_USER']=loggedoutforgood; $_SERVER['PHP_AUTH_PW']=loggedoutforgood; unset($_SERVER['PHP_AUTH_USER']); unset($_SERVER['PHP_AUTH_PW']); session_destroy(); ? META http-equiv=refresh content=0; URL=http://? echo($_SERVER['HTTP_HOST']); ? As you can see I have tried to modify the values for $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] as well as trying to delete the values associated to them by using unset. I am now out of ideas, can anybody offer any suggestions ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] php5 and object
From: Stephen Sadowski [EMAIL PROTECTED] Subject: Re: [PHP] php5 and object http://us4.php.net/manual/en/language.oop5.abstract.php The short is that you can't do anything more than define a function in an abstract class. IIRC, change abstract to interface, and you'll probably be okay. Switch that around. Interfaces cannot contain anything but function definitions. Abstract classes can contain functions that'll be inherited. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']
From: Mark Collin [EMAIL PROTECTED] Does anybody have any ideas on how I can prevent caching of $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'], or clear them? You can't clear them; they're sent by the browser. It'll keep resending the same values and you're script will authenticate. Only way to get rid of it is to close the browser. You could attempt to force the user to log with a known bad username and password by using a link or header redirect. header('Location: http://username:[EMAIL PROTECTED]'); Your login script should check for these known values and can react accordingly. You know they are bad, so you can either present them with another dialog to log back in or you can just not send any authentication headers and show them a successfully logged out page. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Showing all users who are logged in
Vail, Warren wrote: I did one application where I used the PHP session table to tell who was logged on, and which area of the application they were most recently in. One of several flaws, was that I used Kill session to logoff, and that caused them to disappear from any count of users logged on. Course, if they had logged off, then they weren't logged on, but on the other side, users were counted for every session they created, and closing and opening new browser sessions caused them to be counted multiple times, and continue to be counted until session garbage cleanup removed their session entries, unless I used the session timestamp in my count algorithm. Session was nice, because if a user was causing a problem, I could kill his session entry, effectively logging him off, forcing him to logon again. Warren Vail Thanks guys. Between your suggestions, I managed to come up with a solution. -- Jason Giangrande [EMAIL PROTECTED] http://www.giangrande.org http://www.dogsiview.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I return the error
Hi, Wednesday, July 28, 2004, 11:56:16 PM, you wrote: MO Hi I have this function below - if it reurns false I want to MO also return the error so I can print it in my calling function. MO Can I do this? MO Cheers MO Matt MO function fileUpload($file) { MO if ($file['type'] == image/gif || $file['type'] == image/pjpeg){ MO if (@copy ($file['tmp_name'], images/ . $file['name'])) MO return true; MO }else { MO return false; MO } MO } You can always return an array() something like this: function fileUpload($file) { $r = array(false,''); switch($file['error']){ case UPLOAD_ERR_INI_SIZE: $r[1] = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.'; break; case UPLOAD_ERR_FORM_SIZE: $r[1] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'; break; case UPLOAD_ERR_PARTIAL: $r[1] = 'The uploaded file was only partially uploaded.'; break; case UPLOAD_ERR_NO_FILE: $r[1] = 'No file was uploaded'; break; default: if ($file['type'] == image/gif || $file['type'] == image/pjpeg){ if (@copy ($file['tmp_name'], images/ . $file['name'])) $r[0] = true; else $r[1] = 'Could not copy the file.'; }else { $r[1] = 'The uploaded file is not the right type.'; } break; } return $r; } list ($status, $error) = fileUpload($file); if(!$status) echo $error; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strpos mystery
with this code fragment: ? $string='/mobile/phone.html'; if (strpos($string,'/mobile/')!==false) { print one: yes\n; } if (strpos($string,'/mobile/')===true) { print two: yes\n; } ? only the first if statement prints anything. why is !== false not the same as === true ? -jsd- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 and object
Curt Zirzow wrote: * Thus wrote Stephen Sadowski: http://us4.php.net/manual/en/language.oop5.abstract.php The short is that you can't do anything more than define a function in an abstract class. Negative. It is perfectly fine to have code within an abstract class. The documentation needs to get expanded a little bit to define exactly how an for what use an abstract class can be used. indeed. Abstract classes can contain code - but abstract methods cannot. -- 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 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strpos mystery
On Wed, 28 Jul 2004 17:50:01 -0700, Jon Drukman [EMAIL PROTECTED] wrote: with this code fragment: ? $string='/mobile/phone.html'; if (strpos($string,'/mobile/')!==false) { print one: yes\n; } if (strpos($string,'/mobile/')===true) { print two: yes\n; } ? only the first if statement prints anything. why is !== false not the same as === true ? Because === and !== check the type as well. Of you set $string = 'blah' you'll still get the same result. If you were using != and == both would print. strpos() returns an int, so comparing it to false with === is always false. The same would be true for true. -jsd- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:410846c1241919501214933! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieving Stored Values for Dropdown Menu
On Wed, 28 Jul 2004 21:19, Harlequin wrote: OK David. But here's the conundrum: a User has already selected a value which is stored in the database. Can I Display a range of option tags but make the one the user selected previously as the default...? ??? Yes you can. I'm not going to give you the code, but a pointer to solving problems yourself. Just break the problem down to its component parts, and resolve each one as you go. For instance, you need to define an option as selected - first figure out how to do that (it's a HTML problem). Then you only want to define an option as selected if certain conditions are met, so test for the conditions and act accordingly. -- David Robley Q: Why do blondes hate MMs? A: They're too hard to peel. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Java Script or PHP
I have a database generated page and I want to show a Print Version in a new window when somebody selects the print option. http://www.test.com/docs/view_record.php?id=1 http://www.test.com/docs/print_record.php?id=1 What is the correct way to open the page from the print link to a new page? TIA Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] reading txt file - certain lines
Yeah I do not really have the option to use a database here since the way the data is output is limited to a text file.. the files are populated by a program that takes the currently playing tracks out of Itunes (mp3 player) on my mac. d On 28-Jul-04, at 3:26 PM, [EMAIL PROTECTED] wrote: From: John Nichel [EMAIL PROTECTED] Date: July 28, 2004 2:05:51 PM PDT To: PHP [EMAIL PROTECTED] Subject: Re: [PHP] reading txt file - certain lines Dustin Krysak wrote: Hi there.. .I am displaying info (on music) from a text file with the following code... ?php //open the file handler $fp02=fopen(assets/lib/php/itunes/recent.txt,r); //Read the track info $recent=fgets($fp02); //close the file. echo $recent; fclose($fp02); ? Now the contents of said text file would read something like the following: bLiar/bbrby ibSex Pistols/bibriNever Mind The Bollocks/ibrPlayed: 2004/07/28, 1:48:29 PMbr--brbLet's Rave On/bbrby ibThe Raveonettes/bibriChain Gang Of Love/ibrPlayed: 2004/07/28, 1:46:37 PMbr--brbNo Remorse/bbrby ibMetallica/bibriKill 'Em All/ibrPlayed: 2004/07/28, 1:40:17 PMbr--brbThis Is Our Emergency/bbrby ibPretty Girls Make Graves/bibriThe New Romance/ibrPlayed: 2004/07/28, 1:36:37 PMbr--brbFreestylin'/bbrby ibGreyboy/bibriFreestylin'/ibrPlayed: 2004/07/28, 1:30:25 PMbr--brbIn My Head/bbrby ibNaked Raygun/bibriRaygun...Naked Raygun (Reissue)/ibrPlayed: 2004/07/28, 1:26:37 PMbr--brbLust To Love/bbrby ibThe Go-Go's/bibriReturn To The Valley Of The Go-Go's/ibrPlayed: 2004/07/28, 1:23:13 PMbr--brbKim You Bore Me To Death/bbrby ibGrandaddy/bibriConcrete Dunes/ibrPlayed: 2004/07/28, 1:18:37 PMbr--brbSonderkommando/bbrby ibGwar/bibriThis Toilet Earth/ibrPlayed: 2004/07/28, 1:13:49 PMbr--br Now what I want to do is read this file, but only say read 5 songs worth, then I would place the PHP code in (another table) and display the next 5 songs and so on This just allows for a more flexible layout in the final presentation. the way I am having the text files written, there is no way to get it to produce seperate text files - otherwise this would be easy to do Is this possible? Yes, possible. Worth the time? No. Can you put all that info in a database? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED]
Re: [PHP] Java Script or PHP
--- Karl-Heinz Schulz [EMAIL PROTECTED] wrote: I have a database generated page and I want to show a Print Version in a new window when somebody selects the print option. http://www.test.com/docs/view_record.php?id=1 http://www.test.com/docs/print_record.php?id=1 What is the correct way to open the page from the print link to a new page? To Open a New Window you can use javascript window.open or just set target=_blank in your anchor tag (a). But you may need to adjust the properties of new windows like status bar, toolbar, width, height; for this you can use java script. PHP Can not do client side programming... zareef ahmed TIA Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Java Script or PHP
Zareef, Thank you for the reply but I may was not very clear. I don't know how to pass the record id from the view_record?id=1 to print_record?=whateverTheViewRecordId was. Karl-Heinz -Original Message- From: zareef ahmed [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 11:03 PM To: Karl-Heinz Schulz; [EMAIL PROTECTED] Subject: Re: [PHP] Java Script or PHP --- Karl-Heinz Schulz [EMAIL PROTECTED] wrote: I have a database generated page and I want to show a Print Version in a new window when somebody selects the print option. http://www.test.com/docs/view_record.php?id=1 http://www.test.com/docs/print_record.php?id=1 What is the correct way to open the page from the print link to a new page? To Open a New Window you can use javascript window.open or just set target=_blank in your anchor tag (a). But you may need to adjust the properties of new windows like status bar, toolbar, width, height; for this you can use java script. PHP Can not do client side programming... zareef ahmed TIA Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Browser reload problem
PayPal passes a ton of data back to us when someone's done purchasing something. I use some of that information and shove it all into a database. Problem is, if someone hits reload on their browser, I get the same data re-inserted again. Reload the page four times, and I will get four records with the same data inserted. How can I avoid this? I'd like to silently either discard the information after it's been inserted, or silently prevent it from being re-inserted again. -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Java Script or PHP
--- Karl-Heinz Schulz [EMAIL PROTECTED] wrote: Zareef, Thank you for the reply but I may was not very clear. I don't know how to pass the record id from the view_record?id=1 to print_record?=whateverTheViewRecordId was. Consider it $id=select id from database ?php print a href='http://www.test.com/docs/view_record.php?id=.$id.;' target='_blank' click tio print /a; ? or you may write javasctipt function too. zareef ahmed Karl-Heinz -Original Message- From: zareef ahmed [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 11:03 PM To: Karl-Heinz Schulz; [EMAIL PROTECTED] Subject: Re: [PHP] Java Script or PHP --- Karl-Heinz Schulz [EMAIL PROTECTED] wrote: I have a database generated page and I want to show a Print Version in a new window when somebody selects the print option. http://www.test.com/docs/view_record.php?id=1 http://www.test.com/docs/print_record.php?id=1 What is the correct way to open the page from the print link to a new page? To Open a New Window you can use javascript window.open or just set target=_blank in your anchor tag (a). But you may need to adjust the properties of new windows like status bar, toolbar, width, height; for this you can use java script. PHP Can not do client side programming... zareef ahmed TIA Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Java Script or PHP
* Thus wrote Karl-Heinz Schulz: I have a database generated page and I want to show a Print Version in a new window when somebody selects the print option. http://www.test.com/docs/view_record.php?id=1 http://www.test.com/docs/print_record.php?id=1 What is the correct way to open the page from the print link to a new page? @media print { .css { its: all here; } } Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Java Script or PHP
Thank you for your help. -Original Message- From: zareef ahmed [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 11:25 PM To: Karl-Heinz Schulz Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Java Script or PHP --- Karl-Heinz Schulz [EMAIL PROTECTED] wrote: Zareef, Thank you for the reply but I may was not very clear. I don't know how to pass the record id from the view_record?id=1 to print_record?=whateverTheViewRecordId was. Consider it $id=select id from database ?php print a href='http://www.test.com/docs/view_record.php?id=.$id.;' target='_blank' click tio print /a; ? or you may write javasctipt function too. zareef ahmed Karl-Heinz -Original Message- From: zareef ahmed [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 11:03 PM To: Karl-Heinz Schulz; [EMAIL PROTECTED] Subject: Re: [PHP] Java Script or PHP --- Karl-Heinz Schulz [EMAIL PROTECTED] wrote: I have a database generated page and I want to show a Print Version in a new window when somebody selects the print option. http://www.test.com/docs/view_record.php?id=1 http://www.test.com/docs/print_record.php?id=1 What is the correct way to open the page from the print link to a new page? To Open a New Window you can use javascript window.open or just set target=_blank in your anchor tag (a). But you may need to adjust the properties of new windows like status bar, toolbar, width, height; for this you can use java script. PHP Can not do client side programming... zareef ahmed TIA Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com Tracking #: 0A7561E8C74AB546BCE0A89F73ECA4D2A3FDFA95 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth) fails.
Linux. PHP5. Why does this fail when using an array element, but using a variable will work? Why should PHP care what the variable is I'm trying to store into? list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth); But this works: list($foo, $CompanyDB) = SQL_ROW($sth); And of course I'd have the extra... $foo = $bar['CompanyCode']; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser reload problem
* Thus wrote Ashley M. Kirchner: PayPal passes a ton of data back to us when someone's done purchasing something. I use some of that information and shove it all into a database. Problem is, if someone hits reload on their browser, I get the same data re-inserted again. Reload the page four times, and I will get four records with the same data inserted. How can I avoid this? I'd like to silently either discard the information after it's been inserted, or silently prevent it from being re-inserted again. This is what I call the BRS (Browser Reload Syndrome: the tendency of idiodity users insisting on reloading a page unnecessarily.) The basic solution with this problem is: 1. generate some sort unique id on original form 2. ensure unique id has not been entered when posted. In your case, paypal should be returing to you some sort of transaction Id, 'txn_id' iirc. So step 1 isn't needed. What you need to do is before you insert the data that has been posted to your script, is to ensure that that 'txn_id' has not been entered already into the database. -- W | I haven't lost my mind; it's backed up on tape somewhere. tar xf /dev/somewhere /your/mind; :) Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strpos mystery
Because === and !== check the type as well. Of you set $string = 'blah' you'll still get the same result. If you were using != and == both would print. strpos() returns an int, so comparing it to false with === is always false. The same would be true for true. That's half right. strpos actually *can* return false as opposed to 0, so checking doing the === check might be necessary for your application. ?php $string = 'blah'; if (strpos($string, 'not in the original $string') === false){ echo 'False check succeeded - not in $string.'; } if (strpos($string, $string) === true) { echo 'True check succeeded - in string'; } else { echo 'True check failed - because strpos was at offset 0.'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strpos mystery
Heck, even I got it wrong ;) True check below should always fail... Jason Barnett wrote: Because === and !== check the type as well. Of you set $string = 'blah' you'll still get the same result. If you were using != and == both would print. strpos() returns an int, so comparing it to false with === is always false. The same would be true for true. That's half right. strpos actually *can* return false as opposed to 0, so checking doing the === check might be necessary for your application. ?php $string = 'blah'; if (strpos($string, 'not in the original $string') === false){ echo 'False check succeeded - not in $string.'; } if (strpos($string, $string) === true) { echo 'True check succeeded - in string'; } else { echo 'True check failed - because strpos was at offset 0.'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth) fails.
On Wed, 28 Jul 2004 20:47:37 -0700, Daevid Vincent [EMAIL PROTECTED] wrote: Linux. PHP5. Why does this fail when using an array element, but using a variable will work? Why should PHP care what the variable is I'm trying to store into? list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth); But this works: list($foo, $CompanyDB) = SQL_ROW($sth); And of course I'd have the extra... $foo = $bar['CompanyCode']; Because list() is a language construct, not a function. It assumes what you give it is a normal variable, it doesn't understand arrays. Better IMHO to use $row = mysql_fetch_assoc() and access the array it returns directly. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth) fails.
check the manual for list. It mentions using only numerical array indices for list. There is a warning on it even i beleive. Jason On Wed, 28 Jul 2004 20:47:37 -0700, Daevid Vincent [EMAIL PROTECTED] wrote: Linux. PHP5. Why does this fail when using an array element, but using a variable will work? Why should PHP care what the variable is I'm trying to store into? list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth); But this works: list($foo, $CompanyDB) = SQL_ROW($sth); And of course I'd have the extra... $foo = $bar['CompanyCode']; -- 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