Re: [PHP] no-resubmit on reload/refresh
Well, I've had the same problems with an "Send SMS" routine and it caused the message to get sent twice or more if the user refreshed. I fixed this by adding the following logic: If there are post-data, put this into a session variable (an array of key=val) and reload the page. if there are no post-data put the session-variable array into the current scope again using a foreach loop, and then delete the session variable, so data won't be processed again. Works like a charm, and doesn't include javascript. Don't know if it's excactly right for you, so you might have to modify it a bit. (From memory only, might be typo's:) snip ? session_start(); session_register( pre_posted ); if (count( $HTTP_POST_VARS)=1) { foreach( $HTTP_POST_VARS as $k=$v ) { $pre_posted[$k] = $v; } header( "Location: $PHP_SELF" ); exit; } elseif ( is_array( $pre_posted )) { foreach( $pre_posted as $k=$v ) { $$k = $v; } unset( $pre_posted ); } echo "bYou posted: $Test/bbrWant to refresh?"; ? form method=post input name='Test' value='test' size=20 input type=submit /form /snip - Original Message - From: "Bruin, Bolke de" [EMAIL PROTECTED] To: "'Jon Haworth'" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, March 06, 2001 2:29 PM Subject: RE: [PHP] no-resubmit on reload/refresh That's not really what I want http://pub.alxnet.com/guestbook?id=200 (this one works) does it without. On my page I am using a child window to reload the parent window , so your solution can't be used unfortunately. Bolke -Oorspronkelijk bericht- Van: Jon Haworth [mailto:[EMAIL PROTECTED]] Verzonden: Tuesday, March 06, 2001 2:01 PM Aan: Bruin, Bolke de; [EMAIL PROTECTED] Onderwerp: RE: [PHP] no-resubmit on reload/refresh Javascript? (I know it's generally horrible, but it's good for this sort of thing) Stick this in your head.../head: script language="JavaScript" type="text/javascript"!--Begin var submitcount=0; function jsCheck() { if (submitcount == 0) { submitcount++; return true; } else { alert("This request has already been submitted, please wait while it is processed."); return false; } } //End--/script And call it from your form like this: form name="myform" action="whatever" method="post" onSubmit="return jsCheck()" Voila. HTH Jon -Original Message- From: Bruin, Bolke de [mailto:[EMAIL PROTECTED]] Sent: 06 March 2001 12:53 To: [EMAIL PROTECTED] Subject: [PHP] no-resubmit on reload/refresh I have a form which is submitted by a POST action. After submitting, the same page (updated though) returns with the form. (It's a messageboard) Now when someone refreshes/reloads the page they get the question if they want to resubmit the form. I don't want that. You get double posts this way. I know it is possible to check the input for any duplicates, but for example this guestbook http://pub.alxnet.com/guestbook?id=120611 (hope the id works) does it differently and your browser does NOT if you wnat to resubmit, it just doesn't do it. Anyone knows how this works (HTTP header maybe?) cheerz Bolke ** 'The information included in this Email is of a confidential nature and is intended only for the addressee. If you are not the intended addressee, any disclosure, copying or distribution by you is prohibited and may be unlawful. Disclosure to any party other than the addressee, whether inadvertent or otherwise is not intended to waive privilege or confidentiality' ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] deleting cart items on session expire
Well, why not store the item's in the session-var? When the session dies because of timeout or user-intervention, the items dissapear too. Or store a timestamp along with the items, and refresh the timestamps as needed. Then put in a cron-job to delete out-of-date items left in the DB at regular intervals. -J 17.02.01 02:29:04, Joseph H Blythe [EMAIL PROTECTED] wrote: hey all, I was wondering how one would suggest removing items from a cart system once the session lifetime has expired. I have it set to the default 0, which expires the session on browser close, what I want to be able to do is "delete * from Cart where session='$PHPSESSID'" when the user closes thier browser window is this even possible? maybe using register_shutdown_function or something? Any ideas would be great! Thanks Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Raspuns: [PHP] Cron + PHP
or even better; compile PHP as CGI in addition to an Apache module, and put it somewhere in the path. You can then set cron to: 0 20 * * * php -q myphpfile.php results_to_this_file.txt This could be useful if you need to run a script that is not available on the web-server, for instance. -J - Original Message - From: "Ovidiu EFTIMIE" [EMAIL PROTECTED] To: "GAYTAN BAHAMONDEZ DANIEL EDUARDO" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 09, 2001 8:31 AM Subject: [PHP] Raspuns: [PHP] Cron + PHP 0 20 * * * lynx -dump http://localhost/file.php every day at 20:00 this file will be executed Ovidiu -Mesaj original- De la: GAYTAN BAHAMONDEZ DANIEL EDUARDO [mailto:[EMAIL PROTECTED]] Trimis: Friday, February 09, 2001 12:37 AM Catre: [EMAIL PROTECTED] Subiect: [PHP] Cron + PHP How can i make a crontab run a php file??? should i add something like this in the file: path/to/file.php Thanks in advance... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Arrays through URL
check out: serialize(); - Original Message - From: "Jamie" [EMAIL PROTECTED] To: "PHP" [EMAIL PROTECTED] Sent: Friday, February 09, 2001 10:28 AM Subject: [PHP] Arrays through URL I'm trying to pass a multi dimensional array through a url link but I'm having a hard time doing this. Is it actually possible? from what I can tell the url just shows ...$form_options_array=Array Is there a better way to do this? thanks jamie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Arrays through URL
i would agree that serialize isn't good for huge arrays, yes, but if you're considering databases, why not use sessions? -J - Original Message - From: "Christian Reiniger" [EMAIL PROTECTED] To: "PHP" [EMAIL PROTECTED] Sent: Friday, February 09, 2001 11:32 AM Subject: Re: [PHP] Arrays through URL On Friday 09 February 2001 10:31, Jrg V. Bryne wrote: check out: serialize(); I'm trying to pass a multi dimensional array through a url link but I'm having a hard time doing this. Is it actually possible? from what It's possible (with serialize), but not desirable if the array can become big (which is easy with multidim. arrays). Better: $ArrayS = serialize ($TheArray); $AKey = md5 ($ArrayS); // insert into database (key: $AKey, value: $ArrayS) $Url = $baseurl . "?key=$AKey" plus the matching reading code -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "Software is like sex: the best is for free" -- Linus Torvalds -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable quantity chooser.
The slider control is not a regular html-form-object. (on Windows you can see one in the recycle-bin properties). If you want to, or need to, i guess you can use an active-x control og make a javascript to do it. I wouldn't reccomend either... However if you need to set a not so spesific number you can use multiple radiobuttons or something like that. I made one just in this case to see if it's useful. One never know what will come in handy later on :-) It's not excatly what you wanted, but you might want to take a look at www.omnimedia.no/slider.php3 for the source and a quick try. Doesn't really do anything, though :-) (btw: you don't need JS if you don't need to display the current value, as it will be submitted as '$val') -Y - Original Message - From: "Steve Werby" [EMAIL PROTECTED] To: [EMAIL PROTECTED]; "David VanHorn" [EMAIL PROTECTED] Sent: Thursday, February 08, 2001 5:50 AM Subject: Re: [PHP] Variable quantity chooser. "David VanHorn" [EMAIL PROTECTED] wrote: Is there a way, using PHP, to generate a quantity chooser that maxes out at the quantity on hand? IOW, I have $quantity from the database, for a given line item, and I'd like to have a slider that lets you run up to, but not over, the quantity on hand. This might be more of an HTML question.. I'm sure I can help you, but I'm not able to follow your terminology. What's a "quantity chooser" and what's a "slider"? Are you referring to select boxes? I'm not trying to be rude, I just don't understand what you're referring to. I'm confident you can accomplish what you want using a loop, but perhaps you can restate your question using different terminology and some more details. -- Steve Werby COO 24-7 Computer Services, LLC Tel: 804.817.2470 http://www.247computing.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] db connection error: need help badly
I always use mysql_setpermission, which is a script for easy adding of users and permissions etc. step by step. It comes with the standard dist. of mysql. Mvh Jrg - Original Message - From: "Jacky@lilst" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 24, 2001 10:45 PM Subject: [PHP] db connection error: need help badly Quoting from my previous message. I think my exact question is that when I add a new db on to db server, How do I set up username and password to access that db? All I did was just run the query at "mysql" database to insert Host, username at "user" table ( left password blank)and gave all privileges as Y. And insert Host, User at "db" table with Y privileges as well. And what I added to the Host field on both tables is 216.122.146.146 ( which is the same IP susing at the code to establish db connection below.). But the IP for my db server is 216.122.146.147. Then I write "mysqladmin reload " . It still did not work. Somone told me that what added into the host field on bothe table ( db and user) should be where I connect from, which in this case should be 216.122.146.146, not the other IP, And the host IP in the db connection sniplet should be the same too, right? So is there anything I miss here? error mesage: Warning: MySQL Connection Failed: Access denied for user: '[EMAIL PROTECTED]' (Using password: NO) in /home/sites/site1/web/FreeSale/submitagree.php3 on line 2 * The sniplet is : $connection = mysql_connect("216.122.146.146", "freesale", ""); Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself" - Original Message - From: Maxim Maletsky [EMAIL PROTECTED] To: 'Jacky@lilst' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 24, 2001 2:06 AM Subject: RE: [PHP] db connection error It says that the username or password are incorrect. Just Double Check them! Cheers, Maxim Maletsky -Original Message- From: Jacky@lilst [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 25, 2001 6:07 AM To: [EMAIL PROTECTED] Subject: [PHP] db connection error Hi all, I got the error below when I tried to establish db coonection. Warning: MySQL Connection Failed: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /home/sites/site1/web/FreeSale/submitagree.php3 on line 2 The sniplet is : $connection = mysql_connect("216.122.146.146", "freesale", "secret"); what is the problem here? Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] multple select forms... going to hit my head against a wall ..
If you don't put it in a session var, and need to transport it you can use f. x. : input type=hidden name='user_selections' value='?=implode( "||", $select )?' This puts double pipe-chars between the array variables. You can later (when u need to use the vars again) use: $select = explode( "||", $user_selections ); to put it into an array again. -J - Original Message - From: [EMAIL PROTECTED] To: "Adrian Murphy" [EMAIL PROTECTED] Cc: "PHP list" [EMAIL PROTECTED] Sent: Tuesday, January 23, 2001 1:26 PM Subject: Re: [PHP] multple select forms... going to hit my head against a wall .. Having soved this .. thanks .. now for the next question .. *grin* I have the $select ... but I only use it on the next page .. heheh so I'm trying the following .. input type=\"hidden\" name=\"select\" value=\"$select\" which of course doens't work .. nor does input type=\"hidden\" name=\"select[]" value=\"$select\" any idea on how to pass an array on in an input field in a form ? Henti On Tue, Jan 23, 2001 at 12:01:40PM -, Adrian Murphy wrote: hey, since u are slecting multiple options you'll have to use an array here's how.i u need explanation,feel free to mail me: ? if ($select==""){ print" form method=\"post\" name=\"select\" action=\"test.php3\" SELECT MULTIPLE NAME=\"select[]\" Option VALUE=\"Chocolate\"Chocolate/Chocolate Chip Option VALUE=\"Peanut\"Peanut Brittle/Vanilla Option Selected VALUE=\"Cookie\"Cookie Batter Option VALUE=\"Blueberry\"Vanilla/Blueberry Option VALUE=\"Caramel\"Caramel Swirl Option VALUE=\"Other\"Other... /selectbr input type=\"submit\" name=\"send\" value=\"test\" /form "; }else{ ///count array $num = count($select); file://loop through array for($i = 0;$i $num;$i++){ print $select[$i] . "br"; } } ? - Original Message - From: [EMAIL PROTECTED] To: PHP list [EMAIL PROTECTED] Sent: Tuesday, January 23, 2001 11:42 AM Subject: [PHP] multple select forms... going to hit my head against a wall .. Hi all I'm having a slight little problem .. I can't seem to solve.. I have a multiple select form .. that i select mutiple options from and then it creates a variable called $select now if I display $select .. I only get the last selected value .. here foloows test code.. ? if ($select==""){ print" form method=\"post\" name=\"select\" action=\"test.php3\" SELECT MULTIPLE NAME=\"select\" Option VALUE=\"Chocolate\"Chocolate/Chocolate Chip Option VALUE=\"Peanut\"Peanut Brittle/Vanilla Option Selected VALUE=\"Cookie\"Cookie Batter Option VALUE=\"Blueberry\"Vanilla/Blueberry Option VALUE=\"Caramel\"Caramel Swirl Option VALUE=\"Other\"Other... /selectbr input type=\"submit\" name=\"send\" value=\"test\" /form "; }else{ print $select; } ? I'm de missing something ... can sombody please lend a hand .. thanks Henti Smith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] url hide
I saw this done with a frameset recently. The domain blah.com had a frameset which opened the real page (at www.hotel.com/blahblah ) in a frame. -J - Original Message - From: "AJDIN BRANDIC" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 22, 2001 11:30 AM Subject: [PHP] url hide Perhaps not related to php but I was wandering, is it possible to hide site's real url and replace it with something else (some other URL). ie. someone clicks on a link on www.blah.co.uk which takes the user to an designated area (ie. /house-search/) on www.foo.co.uk. I want the user still to see www.blah.co.uk. This is just for aesthetic reasons since ones the user finishes the search for houses (on www.foo.co.uk/house-search/) he/she will return to www.blah.co.uk. I have tried www.javascripts.com but no success?? Thanks Ajdin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] javascript and php
In general: We made a script which did this, however a bit limited because of the client/server-problems mentioned. The script is part of a registration-form, and pick out a city based on the zip entered. We didn't want the list of zipcodes and cities in JS since it would be quite huge. Don't remember the excacts but in general: (simplified model) form name=oFrm input name=zip onBlur='fetch();'input name=city /form Fetch() is a function that opens a new pop-up window at 50x50px, and set the url-property of this window using JS (ex:) var strURL = "find_city.php?zip=" + document.oFrm.zip.value; The find_city.php script recieves the zip in a get-var, and can connect to mysql and retrieve the city etc. and closes itself. find_city then outputs JS (ex): script opener.document.oFrm.city.value = "$the_right_city"; self.close(); /script The "drawbacks" here is a window flashing a short second or so... You can make this thing run queries or whatever... Wrote the above from memory, so the syntax might be a bit of, but the flow is the same. have a nice day! -Jrg V. Bryne - Original Message - From: "Patrice ROTH" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 16, 2001 10:04 AM Subject: [PHP] javascript and php It is easy to generate javascript through php,but how to call php through javascript. In fact, I'd like to update some form fields according to events on other fields. I can do this using javascript, but the values should be readed in a MySql database. Thank's Patrice - Original Message - From: "Soeren Staun-Pedersen" [EMAIL PROTECTED] To: "Patrice ROTH" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, January 16, 2001 10:08 AM Subject: Re: [PHP] javascript and php It is easy to generate javascript through php,but how to call php through javascript. In fact, I'd like to update some form fields according to events on other fields. I can do this using javascript, but the values should be readed in a MySql database. You're in a serverside, clientside problem. You want the client to execute the PHP code, which it cannot. If you want to update the form fields with some other data, you have to provide the page you sent to the client with all the needed data beforehand. Regards, Soeren Staun-Pedersen - [EMAIL PROTECTED] -- "The internet is full, beat it" - Me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] what is wrong with this sniplet?
print("input type='button' value='back' onclick='self.history.back()';"); lacks a at the end of the input-tag print("input type='button' value='back' onclick='self.history.back()';"); - Original Message - From: "Jacky@lilst" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 16, 2001 11:28 PM Subject: [PHP] what is wrong with this sniplet? Hi people Looking for a piece of advice about what is wrong with this sniplet and what is the right one. I tried to write the html using print(""); as below: print("td"); print("input type='button' value='back' onclick='self.history.back()';"); print("/td"); what happen was that when the html page was generated, that specific part did not apear on the page, although the source can be seen using view source. What did I do wrong? cheers Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]