RE: [PHP] convert seconds to hours, minutes, seconds
Hi Chinmoy, I have a value 178607, which is stored as seconds. I like to convert it (178607 Secs) to Hours, Minutes and Seconds appropiatly. Can anybody help me supplying the code? Try something like this: ?php function sec2hms ($secs) { $hms = ; $hours = intval(intval($secs) / 3600); $hms .= $hours. :; $minutes = intval(($secs / 60) % 60); $hms .= str_pad($minutes, 2, 0, STR_PAD_LEFT). :; $seconds = intval($secs % 60); $hms .= str_pad($seconds, 2, 0, STR_PAD_LEFT); return $hms; } echo sec2hms(6). br; echo sec2hms(60). br; echo sec2hms(66). br; echo sec2hms(3600). br; echo sec2hms(3666). br; echo sec2hms(178607); ? HTH Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert seconds to hours, minutes, seconds
function secondstohours($seconds) { /* [EMAIL PROTECTED] */ $sec=$seconds%3600; return (($seconds-$sec)/3600).':'.($sec/60).':'.($sec%60); } echo secondstohours(7500); Op dinsdag 03 juni 2003 14:38, schreef u: Hello everybody, I have a value 178607, which is stored as seconds. I like to convert it (178607 Secs) to Hours, Minutes and Seconds appropiatly. Can anybody help me supplying the code? Thank You, - Chinmoy __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: convert seconds to hours, minutes, seconds
use the standard mathematics: like 178607 / 60 / 60 = Hours ( u have to round down to the nearest integer ) then u substract the number of hours*3600 from the 178607 seconds. then you have to divide the number you get by 60 and you got the minutes ( remember to round down to the nearest integer ). then u substract the number of ( hours*3600 + minutes*60 ) from 178607 and you got the seconds.. :-) Jakob 'iNstinct' Mund :) Chinmoy Barua [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hello everybody, I have a value 178607, which is stored as seconds. I like to convert it (178607 Secs) to Hours, Minutes and Seconds appropiatly. Can anybody help me supplying the code? Thank You, - Chinmoy __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert seconds to hours, minutes, seconds
I have a value 178607, which is stored as seconds. I like to convert it (178607 Secs) to Hours, Minutes and Seconds appropiatly. Can anybody help me supplying the code? If it's stored in MySQL, you can use SEC_TO_TIME() mysql select sec_to_time(178607); +-+ | sec_to_time(178607) | +-+ | 49:36:47| +-+ 1 row in set (0.00 sec) mysql select sec_to_time(178607)+0; +---+ | sec_to_time(178607)+0 | +---+ |493647 | +---+ 1 row in set (0.00 sec) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Delete from Multidimensional Array?
I think I've outsmarted myself, again. Can someone help me out of this, please? I've built a page that collects network card information, assigning each element its place within a $Card array, and all of the cards to $NetCards. As you enter your card information at the bottom, the previous card is displayed above it, with a Delete checkbox option at the end of that row ($Delete[$Card]). But I can't figure out how to actually delete that card from the deck, as it were. I've looked over the Arrays pages, but there's little there about multi-dimensional arrays and I ended up more confused than ever. Here's my print_r: Array =--- This is $NetCards ( [0] = Array=--- This one is just $Card ( [0] = 3Com =--- Description [1] = 12:34:45:78:90:AA=--- MAC Address [2] = 129.93.100.100 =--- IP Address ) [1] = Array ( [0] = Intel 100b [1] = 12:34:45:78:90:AB [2] = 129.93.100.101 ) [2] = Array ( [0] = ThinAire [1] = 12:34:45:78:90:BB [2] = 129.93.100.102 ) [3] = Array ( [0] = 3Com [1] = 12:34:45:78:90:BC [2] = 129.93.100.103 ) ) How can I delete, say, the wireless card (ThinAire) which is third, here, if someone clicks on that one's Delete box? Thanks! Mark D Hiatt Better Documentation Through Science -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Displaying 5 records only/displaying specific records
Hi, I'm trying to build a news panel for my home page. Basically I want to present the five most recent news articles in a recordset, but I'm not sure how to cut off the recordset after 5. Also I want to present a picture with my first headline. My code will go something like this: ?php // Start News Wotsit. // Create Recordset $gubbins = SELECT * FROM tblContent WHERE pageParent = 3 ORDER BY pageDate DESC; $resGubbins = mysql_query($gubbins,$conn); $rowsGubbins = mysql_fetch_assoc($resGubbins); echo pnbsp;/p\n; echo table cellpadding=3 cellspacing=0 border=0trtd width=75\n; echo img src=\/i/s/; //echo pageImage echo \ width=\75\/\n; echo /tdtd width=\225\; // echo pageTitle // echo pageContent echo /td/tr\n; //Begin Loop articles 2-5 // Not sure how to make the loop start at the 2nd record echo trtdnbsp;/td\n; echo tdpstrong; //echo pageTitle echo /strong ; // echo pageContent echo a href=\/news/page.php?pageID=; //echo page ID echo \Read More.../a/p/td/tr\n; //end loop }*/ echo /table\n; } ? I can see in my head how this should work but I' don't really understand how to do things like print the value of pageTitle for the nth record in the set. Any pointers would be gratefully received. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Displaying 5 records only/displaying specific records
[snip] I'm trying to build a news panel for my home page. Basically I want to present the five most recent news articles in a recordset, but I'm not sure how to cut off the recordset after 5. [/snip] use LIMIT 5 as the last bit of your query Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
On Tuesday 03 June 2003 13:58, Jay Blanchard wrote: [snip] We would have to see some code Jay I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: Either this is a bad cut and paste job or this script will never run because it's full of errors. Either way, if $lid changes, it's because you're changing it. Maybe you have an if($lid = 'value') instead of if($lid == 'value') somewhere? if ($hostid==31) echo lid1: $lid; # Paragraphs # if ($bodytype==1) { sql_query(UPDATE tblArticleParagraph SET sort=-1 WHERE artid=$lid AND hostid=$session_hostid); $tmpbody = ''; for ($i=0; $icount($paragraphs); $i++) { $popt = 1; $popt = $popt | (($parhardoutline[$i]) ? 0x2 : 0); $parpicurl[$i] = preg_replace(/'/s,'',$parpicurl[$i]); $parheadline[$i] = trim($parheadline[$i]); $parpictext[$i] = trim($parpictext[$i]); if ($hostoptions0x80) { # STRICT FONT/STYLE STRIP $parparagraph[$i] = stripFontAndStyle($parparagraph[$i]); } sql_query(INSERT INTO tblArticleParagraph (hostid,artid,sort,options,headline,picurl,paragraph,pictext) VALUES ($session_hostid,$lid,$i,$popt,'$parheadline[$i]','$parpicurl[$i]','$parpara graph[$i]','$parpictext[$i]')); $tmpbody .= $parheadline[$i]; $tmpbody .= ' '; $tmpbody .= $parparagraph[$i]; $tmpbody .= ' '; } sql_query(UPDATE tblArticle SET body='$tmpbody' WHERE id=$lid AND hostid=hostid=$session_hostid); sql_query(DELETE FROM tblArticleParagraph WHERE artid=$lid AND sort=-1 AND hostid=$session_hostid); } if ($special $formid) { # form based article publishing # arnt h, Feb 03 list($tformid,$treplyid) = sql_queryandfetch(SELECT formid,replyid FROM refArticleForm WHERE hostid=$session_hostid AND artid='$saveid' You do not finish the above SQL statement if (!$tformid !$treplyid) { sql_query(INSERT INTO refArticleForm (hostid,artid,formid,replyid) VALUES ($session_hostid,$saveid,$formid,0)); $tformid = $formid; } $surveyid = $tformid; $hostid = $session_hostid; $arntid = $id; $id = $saveid; $arntpublic_userid = $public_userid; $public_userid = 0; include 'include/surveysavereply.inc'; ## perform saving $public_userid = $arntpublic_userid; $id = $arntid; sql_query(UPDATE refArticleForm SET replyid=$thisreplyid WHERE artid=$saveid AND hostid=$session_hostid); $tmp = ''; reset($surveykeyval); foreach ($surveykeyval as $key = $val) { for ($xxi=0; $xxicount($val); $xxi++) { $tmpval = $val[$xxi]; if (!$tmpval) continue; $tmpval = preg_replace('/\|\{.*?\}/','',$tmpval); $lbl = fbq_.$key; $tmp .= $key lbl=\.$$lbl.\$tmpval/$key\r\n; } } # $tmp = 'bodyxml'.$tmp.'/bodyxml'; sql_query(UPDATE tblArticle SET body='$tmp' WHERE id=$saveid AND hostid=$session_hostid); } # Save tblArticleExtension # list($tmp) = sql_queryandfetch(SELECT id FROM tblArticleExtension WHERE artid=$lid AND hostid=$session_hostid); if ($tmp) sql_query(UPDATE tblArticleExtension SET custom1='$custom1',custom2='$custom2',custom3='$custom3',custom4='$custom4' WHERE ar Same here... elseif ($custom1||$custom2||$custom3||$custom4) sql_query(INSERT INTO tblArticleExtension (hostid,artid,custom1,custom2,custom3,custom4) V and here... Those alone will cause a ton of parse errors. if ($hostid==31) echo hrlid2:$lid; ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying 5 records only/displaying specific records
I'm trying to build a news panel for my home page. Basically I want to present the five most recent news articles in a recordset, but I'm not sure how to cut off the recordset after 5. Also I want to present a picture with my first headline. My code will go something like this: ?php // Start News Wotsit. // Create Recordset $gubbins = SELECT * FROM tblContent WHERE pageParent = 3 ORDER BY pageDate DESC; SELECT * FROM tblContent WHERE pageParent = 3 ORDER BY pageDate DESC LIMIT 5 Now your result only has 5 results returned. Loop through them with mysql_fetch_assoc() and display accordingly. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete from Multidimensional Array?
I've built a page that collects network card information, assigning each element its place within a $Card array, and all of the cards to $NetCards. As you enter your card information at the bottom, the previous card is displayed above it, with a Delete checkbox option at the end of that row ($Delete[$Card]). But I can't figure out how to actually delete that card from the deck, as it were. I've looked over the Arrays pages, but there's little there about multi-dimensional arrays and I ended up more confused than ever. Here's my print_r: Array =--- This is $NetCards ( [0] = Array=--- This one is just $Card ( [0] = 3Com =--- Description [1] = 12:34:45:78:90:AA=--- MAC Address [2] = 129.93.100.100 =--- IP Address ) [1] = Array ( [0] = Intel 100b [1] = 12:34:45:78:90:AB [2] = 129.93.100.101 ) [2] = Array ( [0] = ThinAire [1] = 12:34:45:78:90:BB [2] = 129.93.100.102 ) [3] = Array ( [0] = 3Com [1] = 12:34:45:78:90:BC [2] = 129.93.100.103 ) ) How can I delete, say, the wireless card (ThinAire) which is third, here, if someone clicks on that one's Delete box? Thanks! Assuming you somehow already get the 2 value when the user checks the checkbox, you'd simply call unset($NetCards[2]); to get rid of the ThinAire card. If you're also looking for help making the checkboxes, let me know. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: convert seconds to hours, minutes, seconds
It's just some mathematics: assume $time is the value in seconds: $secs= $time % 60; $totalMinutes = ( $time - $secs ) / 60; $minutes = $totalMinutes % 60; $hours = ( $totalMinutes - $minutes ) / 60; Now you can do like this: echo $time secondes is $hours hours, $minutes minutes and $seconds seconds; Chinmoy Barua [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Hello everybody, I have a value 178607, which is stored as seconds. I like to convert it (178607 Secs) to Hours, Minutes and Seconds appropiatly. Can anybody help me supplying the code? Thank You, - Chinmoy __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables changes their values
[snip] I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: if ($hostid==31) echo lid1: $lid; # Paragraphs [/snip] $lid is getting set the first time before the IF statement. From this IF to the last $lid in what you posted I couldn't find anything re-setting $lid. So you must be doing it outside of the code block. What is the initial value of the variable, and what does it change to? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete from Multidimensional Array?
unset($NetCards[2]); Mark D Hiatt wrote: I think I've outsmarted myself, again. Can someone help me out of this, please? I've built a page that collects network card information, assigning each element its place within a $Card array, and all of the cards to $NetCards. As you enter your card information at the bottom, the previous card is displayed above it, with a Delete checkbox option at the end of that row ($Delete[$Card]). But I can't figure out how to actually delete that card from the deck, as it were. I've looked over the Arrays pages, but there's little there about multi-dimensional arrays and I ended up more confused than ever. Here's my print_r: Array =--- This is $NetCards ( [0] = Array=--- This one is just $Card ( [0] = 3Com =--- Description [1] = 12:34:45:78:90:AA=--- MAC Address [2] = 129.93.100.100 =--- IP Address ) [1] = Array ( [0] = Intel 100b [1] = 12:34:45:78:90:AB [2] = 129.93.100.101 ) [2] = Array ( [0] = ThinAire [1] = 12:34:45:78:90:BB [2] = 129.93.100.102 ) [3] = Array ( [0] = 3Com [1] = 12:34:45:78:90:BC [2] = 129.93.100.103 ) ) How can I delete, say, the wireless card (ThinAire) which is third, here, if someone clicks on that one's Delete box? Thanks! Mark D Hiatt Better Documentation Through Science -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file reading and regex
New to the list, so I hope I'm in the right place. I'm trying to write a small php function which checks a page filled with a list of satellite images of earth, and loads the latest one to have been taken at 4:25 in the morning, when the view is most complete (full credit to be given to the original source, of course ... I'm not pretending to be running a satellite here). Here's what I've got so far: ?php $URLbase = http://rsd.gsfc.nasa.gov/goesg/earth/Weather/GMS-5/jpg/vis/4km/;; if (!($fp = fopen($URLbase, r))) { echo p style=color:whiteCould not open the url/p; exit; } $contents = fread($fp, 100); fclose($fp); $pattern = (^[[:digit:]]{6}0425\.jpg$); if (eregi($pattern, $contents, $fullviews)) { $latestfullview = end($fullviews); echo img src=\.$URLbase.$latestfullview.\ width=\470\ . alt=\Earth from the GMS-5 satellite above the Timor strait\ \\; } else { echo p style=color:whiteNo image available/p; } ? The error I'm getting points to the fclose($fp) line, but whether or not that's the culprit I don't know. (What little java I've written has taught me that the effects of an error can be registered far from it's source - perhaps the url isn't properly formed for the fopen() function?) I've tested the regex, and it returns true for a jpg file named with a 10 digit number ending in 0425 (eg. 0305110425.jpg) as it should, but not for eg. a href=0305110425.jpg0305110425.jpg/a, which is the sort of code in which the file name is embedded in the page I'm asking it to search, so I guess there's a problem here. Am I understanding the caret and dollar signs correctly, as respectively indicating the start and end of the search string? Or do they refer to the token being searched? I want to add more functionality to the script yet (load a default image and email the webmaster when no image is found, date and time of the image capture, etc.) but I need to get at least this much working to start off with. Any suggestions? I'm still new to this, so feel free to mention the most obvious mistakes as well as any more subtle ones. I'm working locally on Mac OS X if that makes any difference. Many thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
Thats the strange thing... there IS NO CODE that change the value... And the cut/paste is bad... there is no parse errors and the code snip is only a small part of a scriptfile. - Svein On Tuesday 03 June 2003 15:33, Jay Blanchard wrote: [snip] I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: if ($hostid==31) echo lid1: $lid; # Paragraphs [/snip] $lid is getting set the first time before the IF statement. From this IF to the last $lid in what you posted I couldn't find anything re-setting $lid. So you must be doing it outside of the code block. What is the initial value of the variable, and what does it change to? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending Layer2 frames with PHP
Hi NG, I am trying to implement the CDP (Cisco Discovery Protocol) into PHP. For this task it is needed to send Layer2 frames to a specific MAC address. Is there a possibility to do so ? Please answer as fast as possible either to [EMAIL PROTECTED] or to this NG. Thanks ! Kai M Poppe WLAN Infrastructure, University of Bremen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
On Tuesday 03 June 2003 15:27, CPT John W. Holmes wrote: On Tuesday 03 June 2003 13:58, Jay Blanchard wrote: [snip] We would have to see some code Jay I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: Either this is a bad cut and paste job or this script will never run because it's full of errors. Either way, if $lid changes, it's because you're changing it. Maybe you have an if($lid = 'value') instead of if($lid Yep, its a bad paste :) The script is error-free... But there is no code that change the variable and it still get changed. Eg. it change from 75497 to 6894 - Svein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Validating user input
Hello, On 06/03/2003 06:21 AM, Shaun wrote: I am creating a timesheet application, how can I make sure that a user has entered a number, and that the number is a whole number or a decimal up to 2 places, and that the number is less than 24? You may want to try this forms generation and validation class that can either validate you form values in the client site with generated Javascript or using the class itself on the server side: http://www.phpclasses.org/formsgeneration -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] file reading and regex
[snip] ?php $URLbase = http://rsd.gsfc.nasa.gov/goesg/earth/Weather/GMS-5/jpg/vis/4km/;; if (!($fp = fopen($URLbase, r))) { echo p style=color:whiteCould not open the url/p; exit; } $contents = fread($fp, 100); fclose($fp); ? [/snip] Was that really a line break after $URLbase = ? (Probably not, but just checking) ... Try adding a 'b' to your fopen ... fopen($URLbase, rb) ... in the event that you're dealing with a Windows platform. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sql question
If I have a date in unix format in a numeric field in my table (Mysql) and I want to compare it to a date which is in unixformat also, will the query work like this? SELECT from tarifs where unix_from_date=.$dateinunixformat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
Yep, its a bad paste :) The script is error-free... But there is no code that change the variable and it still get changed. Eg. it change from 75497 to 6894 In order of increasing probability: - you can attribute it to black magic - you've hit upon a php bug - there's something wrong with your code Assume that there's something wrong with your code, you can do one of the following: - step through it with a debugger to see where $lid changes - remove code from it until $lid doesn't change - echo $lid after everything statement/line in your code -- 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 -- /* You may have heard that a dean is to faculty as a hydrant is to a dog. -- Alfred Kahn */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file reading and regex
Your pattern should look like: $pattern = ([[:digit:]]{6}0425\.jpg); This will give you the image name, but remember that ereg works on single lines and also the image might be taken at some time around 4:25. So you need a while loop to read the html line by line, in the loop try to match the pattern, and if the pattern succeeds (first few lines and last 2 lines are just html junk), check if it is close enough to 4:25. Then break the while loop and display the image. Michael Allan wrote: New to the list, so I hope I'm in the right place. I'm trying to write a small php function which checks a page filled with a list of satellite images of earth, and loads the latest one to have been taken at 4:25 in the morning, when the view is most complete (full credit to be given to the original source, of course ... I'm not pretending to be running a satellite here). Here's what I've got so far: ?php $URLbase = http://rsd.gsfc.nasa.gov/goesg/earth/Weather/GMS-5/jpg/vis/4km/;; if (!($fp = fopen($URLbase, r))) { echo p style=color:whiteCould not open the url/p; exit; } $contents = fread($fp, 100); fclose($fp); $pattern = (^[[:digit:]]{6}0425\.jpg$); if (eregi($pattern, $contents, $fullviews)) { $latestfullview = end($fullviews); echo img src=\.$URLbase.$latestfullview.\ width=\470\ . alt=\Earth from the GMS-5 satellite above the Timor strait\ \\; } else { echo p style=color:whiteNo image available/p; } ? The error I'm getting points to the fclose($fp) line, but whether or not that's the culprit I don't know. (What little java I've written has taught me that the effects of an error can be registered far from it's source - perhaps the url isn't properly formed for the fopen() function?) I've tested the regex, and it returns true for a jpg file named with a 10 digit number ending in 0425 (eg. 0305110425.jpg) as it should, but not for eg. a href=0305110425.jpg0305110425.jpg/a, which is the sort of code in which the file name is embedded in the page I'm asking it to search, so I guess there's a problem here. Am I understanding the caret and dollar signs correctly, as respectively indicating the start and end of the search string? Or do they refer to the token being searched? I want to add more functionality to the script yet (load a default image and email the webmaster when no image is found, date and time of the image capture, etc.) but I need to get at least this much working to start off with. Any suggestions? I'm still new to this, so feel free to mention the most obvious mistakes as well as any more subtle ones. I'm working locally on Mac OS X if that makes any difference. Many thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
Cutpaste the code, also file include/surveysavereply.inc. Svein Larsen wrote: On Tuesday 03 June 2003 15:27, CPT John W. Holmes wrote: On Tuesday 03 June 2003 13:58, Jay Blanchard wrote: [snip] We would have to see some code Jay I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: Either this is a bad cut and paste job or this script will never run because it's full of errors. Either way, if $lid changes, it's because you're changing it. Maybe you have an if($lid = 'value') instead of if($lid Yep, its a bad paste :) The script is error-free... But there is no code that change the variable and it still get changed. Eg. it change from 75497 to 6894 - Svein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending Layer2 frames with PHP
No, not with php. You can use some external program or write a php module. Kai Poppe wrote: Hi NG, I am trying to implement the CDP (Cisco Discovery Protocol) into PHP. For this task it is needed to send Layer2 frames to a specific MAC address. Is there a possibility to do so ? Please answer as fast as possible either to [EMAIL PROTECTED] or to this NG. Thanks ! Kai M Poppe WLAN Infrastructure, University of Bremen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql question
What about trying it first? Diana Castillo wrote: If I have a date in unix format in a numeric field in my table (Mysql) and I want to compare it to a date which is in unixformat also, will the query work like this? SELECT from tarifs where unix_from_date=.$dateinunixformat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] submitting to differient php scripts based on button -O T-
Hi, This is more of a JS question than a PHP but have not found anything on google (http://www.google.com/search?q=javascript+onclick+buttonsourceid=operanum =0ie=utf-8oe=utf-8) and cant remember how I did this last time I simply want to submit my form to either one.php or two.php or thr.php depending on which BUTTON is pressed (I am using html buttons input type='submit' value='blah') I have 3 buttonshow do i set it? Sorry this is so O T but any help appreciated. Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] submitting to differient php scripts based on button -O T-
[snip] I simply want to submit my form to either one.php or two.php or thr.php depending on which BUTTON is pressed (I am using html buttons input type='submit' value='blah') I have 3 buttonshow do i set it? [/snip] Instead of 3 different .php why not use one.php with a SWITCH statement? http://us3.php.net/manual/en/control-structures.switch.php HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file reading and regex
Marek, Your pattern should look like: $pattern = ([[:digit:]]{6}0425\.jpg); BINGO! This will give you the image name, but remember that ereg works on single lines and also the image might be taken at some time around 4:25. So you need a while loop to read the html line by line, in the loop try to match the pattern, and if the pattern succeeds (first few lines and last 2 lines are just html junk), check if it is close enough to 4:25. Then break the while loop and display the image. I'll look into this - 04:25 has been a constant for the months I've been watching this, but I'll work out a routine to check if this changes as you suggest. And thanks for the explanation of ereg() - that will help. And Jay, Was that really a line break after $URLbase = ? (Probably not, but just checking) ... nah, just line wrapping in the email Try adding a 'b' to your fopen ... fopen($URLbase, rb) ... in the event that you're dealing with a Windows platform. I presume from the forward slashes in $URLbase that I'm dealing with just such a platform, so I've added the b (and looked up what it means). Good tip. Thanks for such quick and effective help, guys! What a great resource. Mike Michael Allan wrote: New to the list, so I hope I'm in the right place. I'm trying to write a small php function which checks a page filled with a list of satellite images of earth, and loads the latest one to have been taken at 4:25 in the morning, when the view is most complete (full credit to be given to the original source, of course ... I'm not pretending to be running a satellite here). Here's what I've got so far: ?php $URLbase = http://rsd.gsfc.nasa.gov/goesg/earth/Weather/GMS-5/jpg/vis/4km/;; if (!($fp = fopen($URLbase, r))) { echo p style=color:whiteCould not open the url/p; exit; } $contents = fread($fp, 100); fclose($fp); $pattern = (^[[:digit:]]{6}0425\.jpg$); if (eregi($pattern, $contents, $fullviews)) { $latestfullview = end($fullviews); echo img src=\.$URLbase.$latestfullview.\ width=\470\ . alt=\Earth from the GMS-5 satellite above the Timor strait\ \\; } else { echo p style=color:whiteNo image available/p; } ? The error I'm getting points to the fclose($fp) line, but whether or not that's the culprit I don't know. (What little java I've written has taught me that the effects of an error can be registered far from it's source - perhaps the url isn't properly formed for the fopen() function?) I've tested the regex, and it returns true for a jpg file named with a 10 digit number ending in 0425 (eg. 0305110425.jpg) as it should, but not for eg. a href=0305110425.jpg0305110425.jpg/a, which is the sort of code in which the file name is embedded in the page I'm asking it to search, so I guess there's a problem here. Am I understanding the caret and dollar signs correctly, as respectively indicating the start and end of the search string? Or do they refer to the token being searched? I want to add more functionality to the script yet (load a default image and email the webmaster when no image is found, date and time of the image capture, etc.) but I need to get at least this much working to start off with. Any suggestions? I'm still new to this, so feel free to mention the most obvious mistakes as well as any more subtle ones. I'm working locally on Mac OS X if that makes any difference. Many thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link to a Site
don't echo anything before the header. else there is automatically a header generated by your server. Mishari [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, I used it before, but I had a problem my code look like, if (--) { echo ---; header(--); } I don't know what is it? --- Marek Kilimajer [EMAIL PROTECTED] wrote: Discused few threads ago: header('Refresh: 15; url=newurl.php' ); 15 is in seconds. Mishari wrote: Hi all, I need help, actually I'm building a PHP site where my users will wait for a few seconds reading a text then it will automatically link them to another site. I'm looking for the command which auto. link to other sites. Kind Regards, esheager __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] This line does not execute...
I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd --
[PHP] Migration from register_globals=on to register_globals=off
None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This line does not execute...
did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: Todd Cary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This line does not execute...
oh I see, you want to execute that image.php script ? - Original Message - From: Alex Ciurea [EMAIL PROTECTED] To: php mailing [EMAIL PROTECTED]; Todd Cary [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:07 PM Subject: Re: [PHP] This line does not execute... did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: Todd Cary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- -- 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] How do I grab the first X characters of a string?
How do I grab the first X characters of a string? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do I grab the first X characters of a string?
RTFM http://us2.php.net/manual/en/function.substr.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This line does not execute...
Alex - The code I placed in the messsage is a copy and paste of the code from the sample.php script provided by the author of the barcode class and it agrees with the demo he has on his site. The error is that nothing is happening which I interpret as the file, image.php is not being accessed (I put an Echo statement inside it and it does not execute). Here is the complete block of code: if ($obj) { if ($obj-DrawObject($xres)) { echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; // My debug code - this line executes! echo table align='center'trtdfont color='#FF'Success: Barcode = . $barcode . /font/td/tr/table; } else { echo table align='center'trtdfont color='#FF' . ($obj-GetError()) . /font/td/tr/table; // My debug code echo table align='center'trtdfont color='#FF'Problem; Barcode = . $barcode . /font/td/tr/table; } } else { // My debug code echo table align='center'trtdfont color='#FF'Obj is false; Barcode = . $barcode . /font/td/tr/table; } Alex Ciurea wrote: did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: Todd Cary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- . --
Re: [PHP] This line does not execute...
How do you know it is not being accessed? You should output an image, and if it is not an image, broken image icon is displayed in IE or nothing in Netscape/Mozilla (I see you use Netscape). Look at the html, and if the img tag is there, I'm sure your browser tries to read the image. Todd Cary wrote: Alex - The code I placed in the messsage is a copy and paste of the code from the sample.php script provided by the author of the barcode class and it agrees with the demo he has on his site. The error is that nothing is happening which I interpret as the file, image.php is not being accessed (I put an Echo statement inside it and it does not execute). Here is the complete block of code: if ($obj) { if ($obj-DrawObject($xres)) { echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; // My debug code - this line executes! echo table align='center'trtdfont color='#FF'Success: Barcode = . $barcode . /font/td/tr/table; } else { echo table align='center'trtdfont color='#FF' . ($obj-GetError()) . /font/td/tr/table; // My debug code echo table align='center'trtdfont color='#FF'Problem; Barcode = . $barcode . /font/td/tr/table; } } else { // My debug code echo table align='center'trtdfont color='#FF'Obj is false; Barcode = . $barcode . /font/td/tr/table; } Alex Ciurea wrote: did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: Todd Cary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sql question
That procedure it's call validation so i think you don't need compare, or query to bd any. Just validate if a $variable is a valid date in UnixFormat, i don't know how to do this, but google or someelse maybe know. regards. EF. Diana Castillo [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] If I have a date in unix format in a numeric field in my table (Mysql) and I want to compare it to a date which is in unixformat also, will the query work like this? SELECT from tarifs where unix_from_date=.$dateinunixformat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This line does not execute...
Ok Tod, this is what I understood so far: 1) image.php should generate for you a barcode; 2) you placed an echo statement inside image.php and nothing happens Marek have good ideea: try to see the html source code, the code that is interpreted by your browser. the executable file ./image.php probably don't run. try to see, from your shell (i think you use linux) if u can run a php script. e.g.: ./myscript.php - Original Message - From: Todd Cary [EMAIL PROTECTED] To: Alex Ciurea [EMAIL PROTECTED] Cc: php mailing [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:22 PM Subject: Re: [PHP] This line does not execute... Alex - The code I placed in the messsage is a copy and paste of the code from the sample.php script provided by the author of the barcode class and it agrees with the demo he has on his site. The error is that nothing is happening which I interpret as the file, image.php is not being accessed (I put an Echo statement inside it and it does not execute). Here is the complete block of code: if ($obj) { if ($obj-DrawObject($xres)) { echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; // My debug code - this line executes! echo table align='center'trtdfont color='#FF'Success: Barcode = . $barcode . /font/td/tr/table; } else { echo table align='center'trtdfont color='#FF' . ($obj-GetError()) . /font/td/tr/table; // My debug code echo table align='center'trtdfont color='#FF'Problem; Barcode = . $barcode . /font/td/tr/table; } } else { // My debug code echo table align='center'trtdfont color='#FF'Obj is false; Barcode = . $barcode . /font/td/tr/table; } Alex Ciurea wrote: did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: Todd Cary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- . -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies and Sessions: What's the Best Recipe?
Guys, that's exactly what the SID predefined constant is for -- it's defined only when a session is active, and it has the value sessionname=sessionid (e.g. PHPSESSID=1afd764ecb938274) if and only if the session id was passed in the URL -- otherwise it contains the empty string. So you can safely do: header(Location: {$location}?.SID); The SID constant var is a good idea! I didn't realize this existed. Taking what Justin originally suggested, I've now modified the myHeader() function to only append the SID if it exists (else, it returns the $location var as it was passed). It also checks to see whether there is a ? in the $location var. If so, it will append the SID using a , otherwise it will append the SID with a ?. I haven't tested this yet, but, if anyone has any other suggestions or recommendations, please post them. function myHeader($location) { if (SID) { if (strstr($location, '?')) { header(Location: {$location}.SID); } else { header(Location: {$location}?.SID); } } else { return $location; } return; } Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This line does not execute...
Marek - Yes, the Img is being executed (Broken image icon in IE) as evidenced by the HTML: table align='center'trtdimg src=''/td/tr/tabletable align='center'trtdfont color='#FF'Success: Barcode = 0123456789/font/td/tr/tablebr However, the image.php is apparently not being executed. I put an Echo statement in the top of image.php: // Debug echo "Debugbr"; Is there some setting in the php.ini file that would prevent image.php from executing? I do have register_globals = Off However, I get the variables with $HTTP_POST_VARS[] statements. Todd Marek Kilimajer wrote: How do you know it is not being accessed? You should output an image, and if it is not an image, broken image icon is displayed in IE or nothing in Netscape/Mozilla (I see you use Netscape). Look at the html, and if the img tag is there, I'm sure your browser tries to read the image. Todd Cary wrote: Alex - The code I placed in the messsage is a copy and paste of the code from the sample.php script provided by the author of the barcode class and it agrees with the demo he has on his site. The "error" is that nothing is happening which I interpret as the file, image.php is not being accessed (I put an Echo statement inside it and it does not execute). Here is the complete block of code: if ($obj) { if ($obj-DrawObject($xres)) { echo "table align='center'trtdimg src=''/td/tr/table"; // My debug code - this line executes! echo "table align='center'trtdfont color='#FF'Success: Barcode = " . $barcode . "/font/td/tr/table"; } else { echo "table align='center'trtdfont color='#FF'" . ($obj-GetError()) . "/font/td/tr/table"; // My debug code echo "table align='center'trtdfont color='#FF'Problem; Barcode = " . $barcode . "/font/td/tr/table"; } } else { // My debug code echo "table align='center'trtdfont color='#FF'Obj is false; Barcode = " . $barcode . "/font/td/tr/table"; } Alex Ciurea wrote: did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: "Todd Cary" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo "table align='center'trtdimg src=''/td/tr/table"; To see if it is executing, I have an "Echo" statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- . --
[PHP] Re: Migration from register_globals=on to register_globals=off
When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: determine action of a form dynamically?
Hi, I want action of a form to be PHP_SELF untill user presses continue button. If continue button is pressed than next.php should be the action of the form. how to do this? Thanks in advance, Mukta I'm not sure why it's necessary to do this, but, not sure it can be done. Maybe with Javascript and an onClick= command inside the input button tag or an onSubmit= inside the form tag. Do you simply want to hide the name of the file that the form will go to once a button is clicked? If so, you need an in-between script that the form uses to determine where to send the user. So instead of sending them to PHP_SELF or next.php, use something like goto.php, which can determine where to send the user next, and then redirects the user using the header() function. Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This line does not execute...
img tag can only display images, even if you did put echo Debug;, this is not a valid image, so it is not displayed. Try Right Click - View Image, you should see your debug output. Todd Cary wrote: Marek - Yes, the Img is being executed (Broken image icon in IE) as evidenced by the HTML: table align='center'trtdimg src='./image.php?code=0123456789style=68type=C39width=460height=120xres=2font=5'/td/tr/tabletable align='center'trtdfont color='#FF'Success: Barcode = 0123456789/font/td/tr/tablebr However, the image.php is apparently not being executed. I put an Echo statement in the top of image.php: // Debug echo Debugbr; Is there some setting in the php.ini file that would prevent image.php from executing? I do have register_globals = Off However, I get the variables with $HTTP_POST_VARS[] statements. Todd Marek Kilimajer wrote: How do you know it is not being accessed? You should output an image, and if it is not an image, broken image icon is displayed in IE or nothing in Netscape/Mozilla (I see you use Netscape). Look at the html, and if the img tag is there, I'm sure your browser tries to read the image. Todd Cary wrote: Alex - The code I placed in the messsage is a copy and paste of the code from the sample.php script provided by the author of the barcode class and it agrees with the demo he has on his site. The error is that nothing is happening which I interpret as the file, image.php is not being accessed (I put an Echo statement inside it and it does not execute). Here is the complete block of code: if ($obj) { if ($obj-DrawObject($xres)) { echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; // My debug code - this line executes! echo table align='center'trtdfont color='#FF'Success: Barcode = . $barcode . /font/td/tr/table; } else { echo table align='center'trtdfont color='#FF' . ($obj-GetError()) . /font/td/tr/table; // My debug code echo table align='center'trtdfont color='#FF'Problem; Barcode = . $barcode . /font/td/tr/table; } } else { // My debug code echo table align='center'trtdfont color='#FF'Obj is false; Barcode = . $barcode . /font/td/tr/table; } Alex Ciurea wrote: did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: Todd Cary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- . -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Migration from register_globals=on to register_globals=off
I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Migration from register_globals=on to register_globals=off
Hi, What he means is that with register_globals=off you cannot do this: echo $path you need to do this (if the variable is sent by POST action) echo _POST('path') and through GET echo _GET('path') -Original Message- From: Øystein Håland [mailto:[EMAIL PROTECTED] Sent: 03 June 2003 17:02 To: [EMAIL PROTECTED] Subject: [PHP] Re: Migration from register_globals=on to register_globals=off I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pagenting logic to cut short
Hi guys, I have successfully implemted pagenting on one of my pages to generate PREV 1,2,3,4 (etc) NEXT depending on the records that are being returned and the number of rows i specify in a LIMIT. One little problem, right now I have very few records so I dont mind it giving a 1,2,3,4 etc till 10 or more but soon I will have quite a lot of records and I dont want the client to see a whole page of 1,2,3,4 for him to click, is there anyway I can cut it down (eg. like google) to show only 10 pages or such?? Below is the code that I am using and which so far is working perfectly: ?php $connected=mysql_connect(localhost,estwe_uma,balh) or die ('connect:'.mysql_error()); mysql_select_db (estwe_bh); $limit = 10; $query_count = SELECT COUNT(*) FROM web_shared; $result_count = mysql_query($query_count) or die(Error: . mysql_error()); $totalrows = mysql_result($result_count,0); $page = $_GET['page']; if(empty($page)) $page = 1; $limitvalue = $page * $limit - ($limit); $database[sql] = select * from webplans_shared order by company,price LIMIT $limitvalue, $limit; print(html output comes here); if(mysql_num_rows($result) == 0) { echo( Sorry, No matches found!); exit;} if($page != 1){ $pageprev = $page-1; echo(a href=\search.template.php?page=$pageprev\PREV/anbsp; nbsp; nbsp;); }else echo(PREVnbsp;nbsp;nbsp;); $numofpages = $totalrows / $limit; for($i = 1; $i = $numofpages; $i++){ if($i == $page) echo($i.:nbsp;); else echo(a href=\search.template.php?page=$i\$i/anbsp;); } if(($totalrows % $limit) != 0){ if($i == $page) echo($i.:nbsp;); else echo(a href=\search.template.php?page=$i\$i/anbsp;); if(($totalrows - ($limit * $page)) 0){ $pagenext = $page+1; echo(nbsp;nbsp; a href=\search.template.php?page=$pagenext\NEXT /a); }else echo(..); } thanks in advance, Cheers, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Migration from register_globals=on to register_globals=off
Uh, I think you mean echo $_POST['path']; and echo $_GET['path']; Jonathan Wilkes wrote: Hi, What he means is that with register_globals=off you cannot do this: echo $path you need to do this (if the variable is sent by POST action) echo _POST('path') and through GET echo _GET('path') -Original Message- From: Xystein Heland [mailto:[EMAIL PROTECTED] Sent: 03 June 2003 17:02 To: [EMAIL PROTECTED] Subject: [PHP] Re: Migration from register_globals=on to register_globals=off I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernaNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. XYstein HeLand [EMAIL PROTECTED] escribis en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Migration from register_globals=on to register_glob als=off
yep I did, sorry about that -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED] Sent: 03 June 2003 17:15 To: Jonathan Wilkes Cc: 'Øystein Håland'; [EMAIL PROTECTED] Subject: Re: [PHP] Re: Migration from register_globals=on to register_glob als=off Uh, I think you mean echo $_POST['path']; and echo $_GET['path']; Jonathan Wilkes wrote: Hi, What he means is that with register_globals=off you cannot do this: echo $path you need to do this (if the variable is sent by POST action) echo _POST('path') and through GET echo _GET('path') -Original Message- From: Xystein Heland [mailto:[EMAIL PROTECTED] Sent: 03 June 2003 17:02 To: [EMAIL PROTECTED] Subject: [PHP] Re: Migration from register_globals=on to register_globals=off I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernaNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. XYstein HeLand [EMAIL PROTECTED] escribis en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Re: Migration from register_globals=on to register_globals=off
Uh, just putting those variables at the top of your page won't help you. You need to do something with them. Esteban Fernández wrote: When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] submitting to differient php scripts based on button -O T-
At 6/3/2003 04:24 PM, Ryan A wrote: I simply want to submit my form to either one.php or two.php or thr.php depending on which BUTTON is pressed (I am using html buttons input type='submit' value='blah') I have 3 buttonshow do i set it? You can do this one of three ways: 1. Instead of actually submitting to a different php script, you submit to one script that gives a header location based on which submit button you use. So if I have three submit-type buttons, I'll just say IF($_POST['submit1']) { header(Location: script1.php); } ELSEIF($_POST['submit2']) { header(Location: script2.php); } etc. 2. You submit to one script that includes the relevant functions depending on which button is pushed. IF($_POST['submit1']) { include(script1.php): } or 3. You do it with Javascript since what you actually want to do is on the client, not the server. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Migration from register_globals=on to register_globals=off
Then i don't understand you problem. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] pagenting logic to cut short
I have successfully implemted pagenting on one of my pages to generate PREV 1,2,3,4 (etc) NEXT depending on the records that are being returned and the number of rows i specify in a LIMIT. One little problem, right now I have very few records so I dont mind it giving a 1,2,3,4 etc till 10 or more but soon I will have quite a lot of records and I dont want the client to see a whole page of 1,2,3,4 for him to click, is there anyway I can cut it down (eg. like google) to show only 10 pages or such?? Below is the code that I am using and which so far is working perfectly: ?php $connected=mysql_connect(localhost,estwe_uma,balh) or die ('connect:'.mysql_error()); mysql_select_db (estwe_bh); $limit = 10; $query_count = SELECT COUNT(*) FROM web_shared; $result_count = mysql_query($query_count) or die(Error: . mysql_error()); $totalrows = mysql_result($result_count,0); $page = $_GET['page']; if(empty($page)) $page = 1; $limitvalue = $page * $limit - ($limit); $database[sql] = select * from webplans_shared order by company,price LIMIT $limitvalue, $limit; print(html output comes here); if(mysql_num_rows($result) == 0) { echo( Sorry, No matches found!); exit;} if($page != 1){ $pageprev = $page-1; echo(a href=\search.template.php?page=$pageprev\PREV/anbsp; nbsp; nbsp;); }else echo(PREVnbsp;nbsp;nbsp;); $numofpages = $totalrows / $limit; for($i = 1; $i = $numofpages; $i++){ if($i == $page) echo($i.:nbsp;); else echo(a href=\search.template.php?page=$i\$i/anbsp;); } Instead of going from 1 until $numofpages, go from $page-5 to $page+5, for example... $minpage = max(1,$page-5); $maxpage = min($numofpages,$page+5); for($i = $minpage; $i = $maxpage; $i++) { ... } ---John W. Holmes... Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Migration from register_globals=on toregister_globals=off
on 04/06/03 3:02 AM, Øystein Håland ([EMAIL PROTECTED]) wrote: I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. instead of looking for $printout, you need to be lookign for $_POST['printout'] (for posted vars from a form), $_GET['printout'[ for vars in the url, $_SESSION[...], $_COOKIE[...], etc. if($_GET['printout'] != yeah) { include(header.php); } Alternately, if you don't want to dig through old code, you could a) turn register globals back on via a .htaccess file for SOME sites/directories/domains b) do something like $printout = $_GET['printout']; $id = $_GET['id']; etc c) see this example i wrote: http://www.weberdev.com/get_example.php3?count=3639 Does the above helps Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Automatically include global file ...
Hi folks, I've heard something about the possibility to set an option somewhere that will include a file to each php file requested... but I can't find it.. What I'm trying to do is something similar to things done with mod_perl .. loading a file which sets things the lib dir and stuff... Set some constants for ie. database connection (username, password) and of course the full path dir... And I don't want to use an include() on top of every page, cuz this gets the entire reason away; not having to use fullpath anywhere.. I hope you, or at least one of you, understands my chaotic message and maybe even has an answer.. Greetz, Wouter _ esctoday.com | your daily eurovision centre Wouter van Vliet, Staff assistant, member technical staff E-mail: [EMAIL PROTECTED] Websites: www.esctoday.com, webzee.mine.nu MSN Messenger passport: [EMAIL PROTECTED] Phone +31-(0)6-1539 7471 Based in The Hague, The Netherlands
[PHP] Re: Migration from register_globals=on to register_globals=off
I tried changing my code to (since the variable $printout in this case is sent with GET) ($_GET['printout'] != yeah) { include(header.php); } and got the following error: Undefined index: printout -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace help
I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The problem is that some links may have additional modifiers and onthers may not. I have seen many examples of doing the reverse, but I can't seem to find an example of this. If anyone has done something similar and would like to share, please do. Thanks, -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Migration from register_globals=on to register_globals=off
One little addit: use indeed $_GET for vars passed through the query string and $_POST to read out postdate .. $_COOKIE for cookies, but you'll find a combination of them all in $_REQUEST (nobody happens to know why $_SESSION is not included in that one .. or knows one that includes $_SESSION in it..?) Wouter -Oorspronkelijk bericht- Van: Øystein Håland [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 18:45 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Re: Migration from register_globals=on to register_globals=off I tried changing my code to (since the variable $printout in this case is sent with GET) ($_GET['printout'] != yeah) { include(header.php); } and got the following error: Undefined index: printout -- 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] Automatically include global file ...
On Tue, 3 Jun 2003 18:41:59 +0200, Wouter van Vliet wrote: I've heard something about the possibility to set an option somewhere that will include a file to each php file requested... but I can't find it.. It's an ini setting (auto_prepend_file). Check here: http://us4.php.net/ini_set It can be set in the php.ini (or on Apache at least) in the .htaccess as follows: php_value auto_prepend_file /www/extract_post.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating favorites
I have a customer who wants me to add a bookmarking feature on all his pages that will create a link on the IE toolbar for that page. Any ideas as to how I can do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace help
What do you mean by additional modifiers? Jim Lucas - Original Message - From: Jackson Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 9:43 AM Subject: [PHP] preg_replace help I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The problem is that some links may have additional modifiers and onthers may not. I have seen many examples of doing the reverse, but I can't seem to find an example of this. If anyone has done something similar and would like to share, please do. Thanks, -Jackson -- 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: Migration from register_globals=on to register_globals=off
on top of your script add extract ($_POST); or may be a little more checking to see if its actually a form submission by POST method like if ($_SERVER[REQUEST_METHOD] == 'POST') extract($_POST); same thing goes for GET Then you can access all form variables just as you were accessing. HTH R'twick ØYstein HåLand [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace help
On Tue, 2003-06-03 at 11:52, Jim Lucas wrote: What do you mean by additional modifiers? Some links may be in the format: a href=http://domain.tld/page.ext; target=target name=description of the linklink name/a I just want to ignore any of those modifiers in the text version. -Jackson Jim Lucas - Original Message - From: Jackson Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 9:43 AM Subject: [PHP] preg_replace help I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The problem is that some links may have additional modifiers and onthers may not. I have seen many examples of doing the reverse, but I can't seem to find an example of this. If anyone has done something similar and would like to share, please do. Thanks, -Jackson -- 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] PHP and base32 encryption
Someone has sent me a line of text that is base32 encrypted that I need to decrypt. Does anyone know of a php module or snippet that can decrypt this? I have searched on google and the php.net site, but was unable to find anything that can help. Thanks CDitty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace help
At 18:43 03.06.2003, Jackson Miller said: [snip] I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The problem is that some links may have additional modifiers and onthers may not. I have seen many examples of doing the reverse, but I can't seem to find an example of this. If anyone has done something similar and would like to share, please do. [snip] This should work: $result = null; while (preg_match('!(.*).*?a.*?href\s*=\s*(.*?).*?(.*)!i', $html, $aresult)) { $result .= $aresult[1]; if ($aresult[2]) $result .= ' link name [' . $aresult[2] . ']'; $html = $aresult[3]; } $result .= $html; -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MYSQL record locking
We have a multi-user database we use for telemarketing. It is used across the internet. All the pages are PHP, I am trying to lock or keep other users from accessing the same record, so that they do not call the same lead. For example, the user selects a zip code to work from and then a lead pops up, once the lead has popped up on the callers screen, I don t want that same lead to pop up on anyone else's screen. So I am not sure if I need to lock the row, or if there is a better way of doing it, since the web browser is stateless. Please any help you can provide would be great, because I have searched the net and haven t found much information. Thank you. -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace help
At 18:43 03.06.2003, Jackson Miller said: [snip] I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The problem is that some links may have additional modifiers and onthers may not. I have seen many examples of doing the reverse, but I can't seem to find an example of this. If anyone has done something similar and would like to share, please do. [snip] Sorry - you want the enclosed link name This should work: $result = null; while (preg_match('!(.*).*?a.*?href\s*=\s*(.*?).*?(.*?)\s*/\s*a\s*(.*)!i', $html, $aresult)) { $result .= $aresult[1]; if ($aresult[2] $aresult[3]) $result .= $aresult[3] . ' [' . $aresult[2] . ']'; $html = $aresult[4]; } $result .= $html; -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Migration from register_globals=on to register_globals=off
probably because $_SESSION is a server side thing not coming from the client side in a Request ? R'twick - Original Message - From: Wouter van Vliet [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 12:48 PM Subject: RE: [PHP] Re: Migration from register_globals=on to register_globals=off One little addit: use indeed $_GET for vars passed through the query string and $_POST to read out postdate .. $_COOKIE for cookies, but you'll find a combination of them all in $_REQUEST (nobody happens to know why $_SESSION is not included in that one .. or knows one that includes $_SESSION in it..?) Wouter -Oorspronkelijk bericht- Van: Øystein Håland [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 18:45 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Re: Migration from register_globals=on to register_globals=off I tried changing my code to (since the variable $printout in this case is sent with GET) ($_GET['printout'] != yeah) { include(header.php); } and got the following error: Undefined index: printout -- 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] PHP and MYSQL record locking
We have a multi-user database we use for telemarketing. It is used across the internet. All the pages are PHP, I am trying to lock or keep other users from accessing the same record, so that they do not call the same lead. For example, the user selects a zip code to work from and then a lead pops up, once the lead has popped up on the callers screen, I don t want that same lead to pop up on anyone else's screen. So I am not sure if I need to lock the row, or if there is a better way of doing it, since the web browser is stateless. Please any help you can provide would be great, because I have searched the net and haven t found much information. Thank you. Just add an extra column to keep track of whether the lead is being viewed or not. Set it to 1 when someone views it and then only select leads where the column is zero. You'll need a system to control setting it back to zero if need be or timing it out after so long... ---John W. Holmes... Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating favorites
I know you can use javascript to add the bookmark to the favorites folder, not sure how to add an icon to the toolbar.. a href=javascript:window.external.AddFavorite('http://www.yourpage.com', 'Your Page');Bookmark This Site!/a -Original Message- From: Joaco [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: [PHP] Creating favorites I have a customer who wants me to add a bookmarking feature on all his pages that will create a link on the IE toolbar for that page. Any ideas as to how I can do this? -- 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] Creating favorites
That's already very helpful. Thanks. Edward Peloke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I know you can use javascript to add the bookmark to the favorites folder, not sure how to add an icon to the toolbar.. a href=javascript:window.external.AddFavorite('http://www.yourpage.com', 'Your Page');Bookmark This Site!/a -Original Message- From: Joaco [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: [PHP] Creating favorites I have a customer who wants me to add a bookmarking feature on all his pages that will create a link on the IE toolbar for that page. Any ideas as to how I can do this? -- 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: PHP and base32 encryption
I've never even heard of base32... Only base64... Maybe mcrypt but nah, can't see why mcrypt would include that... Errmm... Maybe you should check for some RFC about this... geektools.com seems to let you search RFC's... Cditty [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Someone has sent me a line of text that is base32 encrypted that I need to decrypt. Does anyone know of a php module or snippet that can decrypt this? I have searched on google and the php.net site, but was unable to find anything that can help. Thanks CDitty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Automatically include global file ...
Thanks !!! -Oorspronkelijk bericht- Van: Wendell Brown [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 18:52 Aan: PHP General; Wouter van Vliet Onderwerp: Re: [PHP] Automatically include global file ... On Tue, 3 Jun 2003 18:41:59 +0200, Wouter van Vliet wrote: I've heard something about the possibility to set an option somewhere that will include a file to each php file requested... but I can't find it.. It's an ini setting (auto_prepend_file). Check here: http://us4.php.net/ini_set It can be set in the php.ini (or on Apache at least) in the .htaccess as follows: php_value auto_prepend_file /www/extract_post.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
[PHP] OK guys, thank you so far
Now my code is extract ($_GET); if ($_GET['printout'] != yeah) { include(header.php); } but I still get the following error: Undefined index: printout I understand nothing Jonathan Wilkes [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, What he means is that with register_globals=off you cannot do this: echo $path you need to do this (if the variable is sent by POST action) echo _POST('path') and through GET echo _GET('path') -Original Message- From: Øystein Håland [mailto:[EMAIL PROTECTED] Sent: 03 June 2003 17:02 To: [EMAIL PROTECTED] Subject: [PHP] Re: Migration from register_globals=on to register_globals=off I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- 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] preg_replace help
Maybe I should clarify. $message = 'pVisit a href=http://jaxn.org; target=_topMy personal site/a to learn more about me./p pVisit a href=http://memigo.com;memigi/a to learn about current events.'; What I want is to run a preg_replace to get the following: Visit My personal site (http://jaxn.org) to learn more about me. Visit memigo (http://memigo.com) to learn about current events. stripping the HTML is easy, but before I do I want to convert the links. Thanks, -Jackson On Tue, 2003-06-03 at 11:59, Ernest E Vogelsinger wrote: At 18:43 03.06.2003, Jackson Miller said: [snip] I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The problem is that some links may have additional modifiers and onthers may not. I have seen many examples of doing the reverse, but I can't seem to find an example of this. If anyone has done something similar and would like to share, please do. [snip] Sorry - you want the enclosed link name This should work: $result = null; while (preg_match('!(.*).*?a.*?href\s*=\s*(.*?).*?(.*?)\s*/\s*a\s*(.*)!i', $html, $aresult)) { $result .= $aresult[1]; if ($aresult[2] $aresult[3]) $result .= $aresult[3] . ' [' . $aresult[2] . ']'; $html = $aresult[4]; } $result .= $html; -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] John - RE: pagenting logic to cut short
Hey John, Thanks, its working fine now, actually a little better than I expected :-) Dont understand the logic though, if you find time point me to the correct place where i can read up and figure out the logic you used. Thanks again. Cheers, -Ryan - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: 'Ryan A' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 5:36 PM Subject: RE: [PHP] pagenting logic to cut short I have successfully implemted pagenting on one of my pages to generate PREV 1,2,3,4 (etc) NEXT depending on the records that are being returned and the number of rows i specify in a LIMIT. One little problem, right now I have very few records so I dont mind it giving a 1,2,3,4 etc till 10 or more but soon I will have quite a lot of records and I dont want the client to see a whole page of 1,2,3,4 for him to click, is there anyway I can cut it down (eg. like google) to show only 10 pages or such?? Below is the code that I am using and which so far is working perfectly: ?php $connected=mysql_connect(localhost,estwe_uma,balh) or die ('connect:'.mysql_error()); mysql_select_db (estwe_bh); $limit = 10; $query_count = SELECT COUNT(*) FROM web_shared; $result_count = mysql_query($query_count) or die(Error: . mysql_error()); $totalrows = mysql_result($result_count,0); $page = $_GET['page']; if(empty($page)) $page = 1; $limitvalue = $page * $limit - ($limit); $database[sql] = select * from webplans_shared order by company,price LIMIT $limitvalue, $limit; print(html output comes here); if(mysql_num_rows($result) == 0) { echo( Sorry, No matches found!); exit;} if($page != 1){ $pageprev = $page-1; echo(a href=\search.template.php?page=$pageprev\PREV/anbsp; nbsp; nbsp;); }else echo(PREVnbsp;nbsp;nbsp;); $numofpages = $totalrows / $limit; for($i = 1; $i = $numofpages; $i++){ if($i == $page) echo($i.:nbsp;); else echo(a href=\search.template.php?page=$i\$i/anbsp;); } Instead of going from 1 until $numofpages, go from $page-5 to $page+5, for example... $minpage = max(1,$page-5); $maxpage = min($numofpages,$page+5); for($i = $minpage; $i = $maxpage; $i++) { ... } ---John W. Holmes... Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.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] OK guys, thank you so far
can you try if ($HTTP_GET_VARS['printout']!=yeah) {include(header.php);} does that work? -Original Message- From: Øystein Håland [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:17 PM To: [EMAIL PROTECTED] Subject: [PHP] OK guys, thank you so far Now my code is extract ($_GET); if ($_GET['printout'] != yeah) { include(header.php); } but I still get the following error: Undefined index: printout I understand nothing Jonathan Wilkes [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, What he means is that with register_globals=off you cannot do this: echo $path you need to do this (if the variable is sent by POST action) echo _POST('path') and through GET echo _GET('path') -Original Message- From: Øystein Håland [mailto:[EMAIL PROTECTED] Sent: 03 June 2003 17:02 To: [EMAIL PROTECTED] Subject: [PHP] Re: Migration from register_globals=on to register_globals=off I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- 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
[PHP] problems?
I have the following scenario: I have this timeclock program that my employees access by logging into and the program pretty much allows them to clock-in and clock-out. The problem is that I noticed some of the employees were clocking-in and clocking-out from their home. The main problem is that the machine at work that the employees use to access this program does not have a static ip address. Is there any way to access the mac address in php. Any ideas? thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: determine action of a form dynamically?
Best way to do this, in my opinion, is by using a javascript-code like this input type=button onClick=processForm('next.php'); input type=button onClick=processForm('?php echo $PHP_SELF; ?'); The javascript function would then look like this: function processForm(url) { document.forms[0].action = url; document.forms[0].submit(); } Mukta Telang [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Hi, I want action of a form to be PHP_SELF untill user presses continue button. If continue button is pressed than next.php should be the action of the form. how to do this? Thanks in advance, Mukta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating favorites
Adding the icon is done like this (grabbed it from the php.net site): link rel=shortcut icon href=http://static.php.net/www.php.net/favicon.ico; / Edward Peloke [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] I know you can use javascript to add the bookmark to the favorites folder, not sure how to add an icon to the toolbar.. a href=javascript:window.external.AddFavorite('http://www.yourpage.com', 'Your Page');Bookmark This Site!/a -Original Message- From: Joaco [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: [PHP] Creating favorites I have a customer who wants me to add a bookmarking feature on all his pages that will create a link on the IE toolbar for that page. Any ideas as to how I can do this? -- 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 guys, thank you so far
On Tue, 3 Jun 2003 19:16:30 +0200, +ystein Hland wrote: Now my code is extract ($_GET); if ($_GET['printout'] != yeah) { include(header.php); } but I still get the following error: Undefined index: printout I understand nothing Ok, it looks like you are mixing your metaphors ;) If you use extract( $_GET ); -- you should have a $printout variable available (assuming you aren't doing a POST form and you are on a version of PHP that supports $_GET). At least two of the following should work... --- Option 1 --- GET method - New PHP extract($_GET); if ($printout != yeah) { include(header.php); } --- Option 2 --- POST method - New PHP extract($_POST); if ($printout != yeah) { include(header.php); } --- Option 3 --- GET method - Older PHP extract($HTTP_GET_VARS); if ($printout != yeah) { include(header.php); } --- Option 4 --- POST method - Older PHP extract($HTTP_POST_VARS); if ($printout != yeah) { include(header.php); } --- Option 5 --- GET method - new php - No extract if ( $_GET[ 'printout' ] != yeah) { include(header.php); } --- Option 6 --- POST method - new php - No extract if ( $_POST[ 'printout' ] != yeah) { include(header.php); } --- Option 7 --- GET method - older php - No extract if ( $HTTP_GET_VARS[ 'printout' ] != yeah) { include(header.php); } --- Option 8 --- POST method - older php - No extract if ( $HTTP_POST_VARS[ 'printout' ] != yeah) { include(header.php); } End --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Migration from register_globals=on to register_globals=off
yeah .. I knew it .. but it would be so very helpfull if it would be just included in a superglobal similar to $_REQUEST ... -Oorspronkelijk bericht- Van: R'twick Niceorgaw [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 19:01 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] Re: Migration from register_globals=on to register_globals=off probably because $_SESSION is a server side thing not coming from the client side in a Request ? R'twick - Original Message - From: Wouter van Vliet [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 12:48 PM Subject: RE: [PHP] Re: Migration from register_globals=on to register_globals=off One little addit: use indeed $_GET for vars passed through the query string and $_POST to read out postdate .. $_COOKIE for cookies, but you'll find a combination of them all in $_REQUEST (nobody happens to know why $_SESSION is not included in that one .. or knows one that includes $_SESSION in it..?) Wouter -Oorspronkelijk bericht- Van: Øystein Håland [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 18:45 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Re: Migration from register_globals=on to register_globals=off I tried changing my code to (since the variable $printout in this case is sent with GET) ($_GET['printout'] != yeah) { include(header.php); } and got the following error: Undefined index: printout -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating favorites
Thanks guys, didnt realize this would be a javascript question, so this post is on the wrong site. I appreciate all the help none the less. Yves Daemen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Adding the icon is done like this (grabbed it from the php.net site): link rel=shortcut icon href=http://static.php.net/www.php.net/favicon.ico; / Edward Peloke [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] I know you can use javascript to add the bookmark to the favorites folder, not sure how to add an icon to the toolbar.. a href=javascript:window.external.AddFavorite('http://www.yourpage.com', 'Your Page');Bookmark This Site!/a -Original Message- From: Joaco [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: [PHP] Creating favorites I have a customer who wants me to add a bookmarking feature on all his pages that will create a link on the IE toolbar for that page. Any ideas as to how I can do this? -- 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] problems?
are you wanting to prevent them from using this from home? Do they vpn or something into the work network and then view this page or can they just get there from the web? -Original Message- From: Dale [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:21 PM To: [EMAIL PROTECTED] Subject: [PHP] problems? I have the following scenario: I have this timeclock program that my employees access by logging into and the program pretty much allows them to clock-in and clock-out. The problem is that I noticed some of the employees were clocking-in and clocking-out from their home. The main problem is that the machine at work that the employees use to access this program does not have a static ip address. Is there any way to access the mac address in php. Any ideas? thanks, Dale -- 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] Mcrypt functions
Hello, I have been playing with the mycrypt function. Im having a bit of trouble understanding why it is important to use a vector IV. I was wandering if there is a reasonably powerful encryption algorithm. That uses a key only instead of getting the block size and using a IV. I basically want to know if there is something simple out there that will do the same job. Kind Regards, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problems?
Couple of clarifications Dale: Is this an internal intranet server? Can it be? Do you have admin rights to the server? What's OS and Server are you running? ~Ed -Original Message- From: Dale [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:21 PM To: [EMAIL PROTECTED] Subject: [PHP] problems? I have the following scenario: I have this timeclock program that my employees access by logging into and the program pretty much allows them to clock-in and clock-out. The problem is that I noticed some of the employees were clocking-in and clocking-out from their home. The main problem is that the machine at work that the employees use to access this program does not have a static ip address. Is there any way to access the mac address in php. Any ideas? thanks, Dale -- 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: Migration from register_globals=on to register_globals=off
yeah .. I knew it .. but it would be so very helpfull if it would be just included in a superglobal similar to $_REQUEST ... Do it yourself, if you must: array_merge() ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: John - RE: pagenting logic to cut short
Thanks, its working fine now, actually a little better than I expected :-) Dont understand the logic though, if you find time point me to the correct place where i can read up and figure out the logic you used. The logic isn't too hard. You're on page X. You show links to other pages from X minus 5 to X plus 5. So if you're on page 15, you show links for pages 10 - 20. Those adjust dynamically based upon the current value of $page. The min() and max() bits are just easy ways to ensure you don't create links for pages below 1 or above $numofpages. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setting up a cron job for a PHP script
Hi, I've setup a simple PHP script that runs through a database table and sends an email to a group of members asking them to verify their information. My new ISP allows me to access the cron tab so we can have this script run at set intervals. However I'm a little new to the whole cron tab command line ... is it possible to have a PHP script execute on command from a cron tab? And if so, could someone proide an example of say having the script run on the first of every month? We're using 4.3.0 if that helps. Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This line does not execute...
Alex - The problem is/was that I run PHP with register_globals = Off. Knowing that, I thought that I had put in all of the $HTTP_XXX_VARS statments, but I did not. Setting register_globals = On temporarily fixed the problem. Now the question is what is the usual setting for register_globals : on or off. As i stated, my preference is to have it off. Sorry for not setting register_globals = On right in the beginning...it would have saved a lot of time :-)!! Todd Alex Ciurea wrote: Ok Tod, this is what I understood so far: 1) image.php should generate for you a barcode; 2) you placed an echo statement inside image.php and nothing happens Marek have good ideea: try to see the html source code, the code that is interpreted by your browser. the executable file ./image.php probably don't run. try to see, from your shell (i think you use linux) if u can run a php script. e.g.: ./myscript.php - Original Message - From: Todd Cary [EMAIL PROTECTED] To: Alex Ciurea [EMAIL PROTECTED] Cc: php mailing [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:22 PM Subject: Re: [PHP] This line does not execute... Alex - The code I placed in the messsage is a copy and paste of the code from the sample.php script provided by the author of the barcode class and it agrees with the demo he has on his site. The error is that nothing is happening which I interpret as the file, image.php is not being accessed (I put an Echo statement inside it and it does not execute). Here is the complete block of code: if ($obj) { if ($obj-DrawObject($xres)) { echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; // My debug code - this line executes! echo table align='center'trtdfont color='#FF'Success: Barcode = . $barcode . /font/td/tr/table; } else { echo table align='center'trtdfont color='#FF' . ($obj-GetError()) . /font/td/tr/table; // My debug code echo table align='center'trtdfont color='#FF'Problem; Barcode = . $barcode . /font/td/tr/table; } } else { // My debug code echo table align='center'trtdfont color='#FF'Obj is false; Barcode = . $barcode . /font/td/tr/table; } Alex Ciurea wrote: did u made copypaste with your code? yes? then why don't you try to use the path='image.php?blahblahmoreblah' no? then please give us more details about the error you're getting... good luck, Alex - Original Message - From: Todd Cary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 6:03 PM Subject: [PHP] This line does not execute... I am trying to get the Sample Barcode to run on my server, however the following line does not execute: echo table align='center'trtdimg src='./image.php?code= . $barcode . style= . $style . type= . $type . width= . $width . height= . $height . xres= . $xres . font= . $font . '/td/tr/table; To see if it is executing, I have an Echo statement in the script. The image.php file is in the same directory as the other script files. What am I missing here? Todd -- . -- --
Re: [PHP] setting up a cron job for a PHP script
On Tue, 03 Jun 2003 12:59:41 -0500, Tim Thorburn wrote: is it possible to have a PHP script execute on command from a cron tab? Absolutely! And if so, could someone proide an example of say having the script run on the first of every month? It should look something like this. 0 0 1 * * php -f/update_arkie_net.php Minutes (0) -- Hours (0) -- Day (1) -- Month (*) -- DayOfWeek (*) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setting up a cron job for a PHP script
[snip] I've setup a simple PHP script that runs through a database table and sends an email to a group of members asking them to verify their information. My new ISP allows me to access the cron tab so we can have this script run at set intervals. However I'm a little new to the whole cron tab command line ... is it possible to have a PHP script execute on command from a cron tab? And if so, could someone proide an example of say having the script run on the first of every month? We're using 4.3.0 if that helps. [/snip] Find out where the PHP executable is... which php ...should return something like /usr/local/bin/php Put the following line in your crontab 15 2 1 * * /usr/local/bin/php -q /path/to/your/script.php This will run in the 15th minute of the 2nd hour of the 1st of the month. The -q get PHP to run quietly. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setting up a cron job for a PHP script
You can also call the file through lynx or wget if you can't call the php executable directly. lynx --dump http://www.yourserver.com/file.php wget http://www.yourserver.com/file.php Down side is that the file has to be in your web root. Works great for calling remote files, though. ---John Holmes... - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Tim Thorburn [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 2:12 PM Subject: RE: [PHP] setting up a cron job for a PHP script [snip] I've setup a simple PHP script that runs through a database table and sends an email to a group of members asking them to verify their information. My new ISP allows me to access the cron tab so we can have this script run at set intervals. However I'm a little new to the whole cron tab command line ... is it possible to have a PHP script execute on command from a cron tab? And if so, could someone proide an example of say having the script run on the first of every month? We're using 4.3.0 if that helps. [/snip] Find out where the PHP executable is... which php ...should return something like /usr/local/bin/php Put the following line in your crontab 15 2 1 * * /usr/local/bin/php -q /path/to/your/script.php This will run in the 15th minute of the 2nd hour of the 1st of the month. The -q get PHP to run quietly. HTH! Jay -- 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] problems?
The web server sits outside of the office and can be accessed from anywhere pc. I was thinking that if I could some how query the MAC address of the store workstation, I could write some code that would allow only pc with certain MAC addresses to access this timeclock program. The server is a win 2k server and is running php on iis 5.0 Thanks, Dale Ed Gorski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Couple of clarifications Dale: Is this an internal intranet server? Can it be? Do you have admin rights to the server? What's OS and Server are you running? ~Ed -Original Message- From: Dale [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:21 PM To: [EMAIL PROTECTED] Subject: [PHP] problems? I have the following scenario: I have this timeclock program that my employees access by logging into and the program pretty much allows them to clock-in and clock-out. The problem is that I noticed some of the employees were clocking-in and clocking-out from their home. The main problem is that the machine at work that the employees use to access this program does not have a static ip address. Is there any way to access the mac address in php. Any ideas? thanks, Dale -- 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] Multi Selection
Hi Guys, I'm trying to do the following: I've got a multiple selection box build out of a query of table tdselect name=VALUE[] size=10 multiple id=VALUE[] ? $query2 = SELECT SomethingID, Somewhere FROM Someplace WHERE publiceer = 'yes' ORDER BY somewhere; $result2 = mysql_query($query2) or die (Error in query: $query2. . mysql_error()); if (mysql_num_rows($result2) 0) { while($row2 = mysql_fetch_object($result2)) { ? OPTION VALUE=? echo $row2-SomethingID ?? echo $row2-Somewhere ; ? ? } } ? /option /select The outcome is stored in the VALUE[].. Now i want to have an INSERT query that insert each value seperatly.. So if there are 3 selections it must be repeat the INSERT query three times... Thanks for the help! Frank
[PHP] Re: Mcrypt functions
Daniel Rychlik wrote: Hello, I have been playing with the mycrypt function. Im having a bit of trouble understanding why it is important to use a vector IV. I was wandering if there is a reasonably powerful encryption algorithm. That uses a key only instead of getting the block size and using a IV. I basically want to know if there is something simple out there that will do the same job. Kind Regards, Daniel An initialization vector is basically used to 'seed' the algorithm to make it more difficult to crack the ciphertext. Using an IV with a block cipher is recommended because it generally makes the cipher more resiliant to known-plaintext attacks. You can use an algorithm without an IV, but you're risking security if you do. In ECB mode, for instance, the IV is actually completely ignored, but if you use the same key, identical blocks of plaintext will translate to identical blocks of ciphertext. This is why an IV and block cipher modes which utilize IVs are important. Using an IV is definitely recommended. A good start would be Rijndael in CBC mode with random IVs. You can safely transport the IV with the ciphertext. If you really, really don't want to use IVs, you should try to stick with a strong cipher such as Rijndael or Twofish and a mode like CBC. You might also want to look into a stream cipher, such as ARC4 or SEAL. But I'd still recommend using an IV. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OK guys, thank you so far
I've tried and here's the output: Undefined index: input if ($HTTP_GET_VARS['printout'] != yeah) { include(header.php); } Edward Peloke [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] can you try if ($HTTP_GET_VARS['printout']!=yeah) {include(header.php);} does that work? -Original Message- From: Øystein Håland [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:17 PM To: [EMAIL PROTECTED] Subject: [PHP] OK guys, thank you so far Now my code is extract ($_GET); if ($_GET['printout'] != yeah) { include(header.php); } but I still get the following error: Undefined index: printout I understand nothing Jonathan Wilkes [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, What he means is that with register_globals=off you cannot do this: echo $path you need to do this (if the variable is sent by POST action) echo _POST('path') and through GET echo _GET('path') -Original Message- From: Øystein Håland [mailto:[EMAIL PROTECTED] Sent: 03 June 2003 17:02 To: [EMAIL PROTECTED] Subject: [PHP] Re: Migration from register_globals=on to register_globals=off I'm not sure what you mean. To give ONE example: Earlier I could use this code on top of every page: if ($printout != yeah) { include(header.php); } This code gives an error today. The variable $printout is set if the visitor choose to click on the 'print_page_image', otherwise the variable has no value. Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] When you recivied that error ?, in a form ?, if is in a Form just put in the top of .php files this code $HTTP_GET_VARS[variable2]; $HTTP_GET_VARS[variable3]; Of course if you send with other method (post) change the GET for POST $HTTP_POS_VARS[variable2]; $HTTP_POS_VARS[variable3]; Regards. Esteban. ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] None of my old scripts worx nowadays and the most common error message is 'undefined variable'. What is the best/simplest way to work around this situation? if !isset($myvar) { do this blah blah } ? -- 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] problems?
What comes in my mind is that usually in offices (or schools) all workstations have IP's within some IP range.. Unless each workstation dials up to or makes it's own connection with 'the internet'... You should be able to do something with that.. -Oorspronkelijk bericht- Van: Dale [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 20:43 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] problems? The web server sits outside of the office and can be accessed from anywhere pc. I was thinking that if I could some how query the MAC address of the store workstation, I could write some code that would allow only pc with certain MAC addresses to access this timeclock program. The server is a win 2k server and is running php on iis 5.0 Thanks, Dale Ed Gorski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Couple of clarifications Dale: Is this an internal intranet server? Can it be? Do you have admin rights to the server? What's OS and Server are you running? ~Ed -Original Message- From: Dale [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:21 PM To: [EMAIL PROTECTED] Subject: [PHP] problems? I have the following scenario: I have this timeclock program that my employees access by logging into and the program pretty much allows them to clock-in and clock-out. The problem is that I noticed some of the employees were clocking-in and clocking-out from their home. The main problem is that the machine at work that the employees use to access this program does not have a static ip address. Is there any way to access the mac address in php. Any ideas? thanks, Dale -- 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] Multi Selection
What you need to generate as HTML looks smth like this --- FORM method=post action=page.php SELECT name='somename[]' size=10 multiple id='somename[]' OPTION value='one'First Thingie/OPTION OPTION value='two'Second Thingie/OPTION OPTION value='three'Third Thingie/OPTION OPTION value='four'Fourth Thingie/OPTION OPTION value='five'Fifth Thingie/OPTION /SELECT INPUT TYPE='post' /FORM --- page.php should look a bit like this: --- ?php foreach($_POST['somename'] as $Key = $Value) { $Query = 'INSERT INTO table (value) VALUES ('.$Value.')'; mysql_query($Query); }; ? --- What I'm not really sure about are the '[]' in the SELECT name='somename[]' .. might wanna try to leave them out. Also, i'm not sure if the value of $_POST['somename'] is always an array, also if one option is selected.. If it gives an errer, just use something like: ?php if(is_array($_POST['somename'])) { foreach($_POST['somename'] as $Key = $Value) { $Query = 'INSERT INTO table (value) VALUES ('.$Value.')'; mysql_query($Query); }; } else { $Query = 'INSERT INTO table (value) VALUES ('.$_POST['somename'].')'; mysql_query($Query); } ? Just to be sure of the correct POST data, I usually do a ?php print_r($_POST); ? .. just to test it.. Hope it has been of any help, Wouter -Oorspronkelijk bericht- Van: Frank Keessen [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 juni 2003 20:55 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Multi Selection Hi Guys, I'm trying to do the following: I've got a multiple selection box build out of a query of table tdselect name=VALUE[] size=10 multiple id=VALUE[] ? $query2 = SELECT SomethingID, Somewhere FROM Someplace WHERE publiceer = 'yes' ORDER BY somewhere; $result2 = mysql_query($query2) or die (Error in query: $query2. . mysql_error()); if (mysql_num_rows($result2) 0) { while($row2 = mysql_fetch_object($result2)) { ? OPTION VALUE=? echo $row2-SomethingID ?? echo $row2-Somewhere ; ? ? } } ? /option /select The outcome is stored in the VALUE[].. Now i want to have an INSERT query that insert each value seperatly.. So if there are 3 selections it must be repeat the INSERT query three times... Thanks for the help! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Interesting.... :/
Lo all, Some input much appreciated. I upgraded mod_php4 from 4.2.3 to 4.3.2, and needless to say, something went horribly wrong. PHP compiled without any serious problems, and the installation seemed to have gone fine as well. When issuing a apachectl restart, apache immediately core dumped... OOOPS. Well, my attempts at debugging, so far, was very much unsuccessful... [EMAIL PROTECTED]:/usr/local/etc/apache# httpd --help Segmentation fault (core dumped) [EMAIL PROTECTED]:/usr/local/etc/apache# [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -h Usage: httpd [-D name] [-d directory] [-f file] [-C directive] [-c directive] [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T] [-F] Options: -D name : define a name for use in IfDefine name directives -d directory : specify an alternate initial ServerRoot -f file : specify an alternate ServerConfigFile -C directive : process directive before reading config files -c directive : process directive after reading config files -v : show version number -V : show compile settings -h : list available command line options (this page) -l : list compiled-in modules -L : list available configuration directives -S : show parsed settings (currently only vhost settings) -t : run syntax check for config files (with docroot check) -T : run syntax check for config files (without docroot check) -F : run main process in foreground, for process supervisors [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -v Server version: Apache/1.3.27 (Unix) Server built: Dec 10 2002 22:10:01 [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -V Server version: Apache/1.3.27 (Unix) Server built: Dec 10 2002 22:10:01 Server's Module Magic Number: 19990320:13 Server compiled with -D EAPI -D EAPI_MM -D EAPI_MM_CORE_PATH=/var/run/httpd.mm -D HAVE_MMAP -D USE_MMAP_SCOREBOARD -D USE_MMAP_FILES -D HAVE_FLOCK_SERIALIZED_ACCEPT -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D HARD_SERVER_LIMIT=512 -D SO_ACCEPTFILTER -D ACCEPT_FILTER_NAME=httpready -D HTTPD_ROOT=/usr/local -D SUEXEC_BIN=/usr/local/sbin/suexec -D DEFAULT_PIDLOG=/var/run/httpd.pid -D DEFAULT_SCOREBOARD=/var/run/httpd.scoreboard -D DEFAULT_LOCKFILE=/var/run/httpd.lock -D DEFAULT_ERRORLOG=/var/log/httpd-error.log -D TYPES_CONFIG_FILE=etc/apache/mime.types -D SERVER_CONFIG_FILE=etc/apache/httpd.conf -D ACCESS_CONFIG_FILE=etc/apache/access.conf -D RESOURCE_CONFIG_FILE=etc/apache/srm.conf [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -l Compiled-in modules: http_core.c mod_so.c suexec: disabled; invalid wrapper /usr/local/sbin/suexec [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -S Segmentation fault (core dumped) [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -t Segmentation fault (core dumped) [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -T Segmentation fault (core dumped) [EMAIL PROTECTED]:/usr/local/etc/apache# httpd -F Segmentation fault (core dumped) checking libphp4.so [EMAIL PROTECTED]:/usr/ports/www/mod_php4# ldd /usr/local/libexec/apache/libphp4.so /usr/local/libexec/apache/libphp4.so: libcrypt.so.2 = /usr/lib/libcrypt.so.2 (0x28297000) libmcal.so = /usr/local/lib/libmcal.so (0x282b) libc-client4.so.8 = /usr/local/lib/libc-client4.so.8 (0x282bf000) libexpat.so.4 = /usr/local/lib/libexpat.so.4 (0x28371000) libsnmp.so.4 = /usr/local/lib/libsnmp.so.4 (0x2838e000) libpspell.so.15 = /usr/local/lib/libpspell.so.15 (0x283e8000) libpdf.so.4 = /usr/local/lib/libpdf.so.4 (0x283ea000) libz.so.2 = /usr/lib/libz.so.2 (0x2847b000) libtiff.so.4 = /usr/local/lib/libtiff.so.4 (0x28489000) libpng.so.5 = /usr/local/lib/libpng.so.5 (0x284cd000) libjpeg.so.9 = /usr/local/lib/libjpeg.so.9 (0x284f1000) libmysqlclient.so.10 = /usr/local/lib/mysql/libmysqlclient.so.10 (0x2850f000) libmhash.so.2 = /usr/local/lib/libmhash.so.2 (0x2852b000) libmcrypt.so.8 = /usr/local/lib/libmcrypt.so.8 (0x28544000) libltdl.so.1 = /usr/local/lib/libltdl.so.1 (0x2858) libpam.so.1 = /usr/lib/libpam.so.1 (0x28584000) libiconv.so.3 = /usr/local/lib/libiconv.so.3 (0x2858e000) libintl.so.4 = /usr/local/lib/libintl.so.4 (0x28669000) libgdbm.so.3 = /usr/local/lib/libgdbm.so.3 (0x28671000) libbz2.so.1 = /usr/lib/libbz2.so.1 (0x28677000) libssl.so.4 = /usr/local/lib/libssl.so.4 (0x28687000) libcrypto.so.4 = /usr/local/lib/libcrypto.so.4 (0x286b6000) libm.so.2 = /usr/lib/libm.so.2 (0x287a9000) libcurl.so.2 = /usr/local/lib/libcurl.so.2 (0x287c5000) libudmsearch.so.1 = /usr/local/lib/libudmsearch.so.1 (0x287e5000) libssl.so.2 = /usr/lib/libssl.so.2 (0x2881c000) libcrypto.so.2 = /usr/lib/libcrypto.so.2 (0x2884a000) libaspell.so.15 =