hakiepoo Posted July 28, 2009 Share Posted July 28, 2009 Hi, I've got some PHP scripts that have stopped working. The first was when I was trying to pass a variable in the URL from one page to the next. http://farliggods.no/kurs/meldpa.php?kurs=239 I solved this by adding $kurs = $_GET['kurs']; in the code on the second page. On this page, I have another problem that I can not seem to solve with this method. I have an email form that, if some parameters are met, should send an email with lots of data. The full code I have used to execute this is: $message="MESSAGE"; if ($send=="send"){ if ($navn!="" && $adresse!="" && $postnummer!="" && $sted!="" && $personnummer!="" && $firmanavn!=""){ if($oppfriskning=1) { mail("[email protected]", "SUBJECT", "Navn: $navn\n\nAdresse: $adresse\n\nPostnummer: $postnummer\n\nSted: $poststed\n\nTelefon: $telefon\n\nMobil: $mobil\n\nE-post: $epost\n\nPersonnummer: $personnummer\n\nOppfriskning: Ja\n\nFirmanavn: $firmanavn\n\nFirma adresse: $firmaadresse\n\nFirma postnummer: $firmapostnummer\n\nFirma sted: $firmasted\n\nFirma telefon: $firmatelefon\n\nFirma telefax: $firmatelefax\n\n\nKurs: $tittel\n\nDato start: $startd.$startm.$starty\n\nSted: $sted\n\Pris: $pris\n\n", "From: [email protected]\nReturn-Path: [email protected]"); }else{ mail("[email protected]", "SUBJECT", "Navn: $navn\n\nAdresse: $adresse\n\nPostnummer: $postnummer\n\nSted: $poststed\n\nTelefon: $telefon\n\nMobil: $mobil\n\nE-post: $epost\n\nPersonnummer: $personnummer\n\nOppfriskning: Nei\n\nFirmanavn: $firmanavn\n\nFirma adresse: $firmaadresse\n\nFirma postnummer: $firmapostnummer\n\nFirma sted: $firmasted\n\nFirma telefon: $firmatelefon\n\nFirma telefax: $firmatelefax\n\n\nKurs: $tittel\n\nDato start: $startd.$startm.$starty\n\nSted: $sted\n\Pris: $pris\n\n", "From: [email protected]\nReturn-Path: [email protected]"); } if($epost!=""){ if($pris!=""){ mail("$epost", "SUBJECT", "Navn: $navn\n\n\nKurs: $tittel\n\nDato start: $startd.$startm.$starty\n\nSted: $sted\n\nPris: $pris", "From: [email protected]\nReturn-Path: [email protected]"); } else if($pris==""){ mail("$epost", "SUBJECT", "Navn: $navn\n\n\nKurs: $tittel\n\nDato start: $startd.$startm.$starty\n\nSted: $sted", "From: [email protected]\nReturn-Path: [email protected]"); } } header("Location: takk.php?kurs=$ref'"); } else{ $message="MESSAGE"; } } I have asked my webhost to turn on globals, something they claim that they have done, but that hasn' helped. Any help would be much appreciated. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/167786-problem-probably-caused-by-php-5-upgrade/ Share on other sites More sharing options...
patrickmvi Posted July 28, 2009 Share Posted July 28, 2009 At quick glance, it would seem to me that you had register_globals enabled before your upgrade and the upgrade has disabled them. You should be able to re-enable them in your php.ini file. You may also want to double-check on session.auto_start. A lot of people that use register_globals also use session.auto_start and that may be another thing that has become disabled due to your upgrade. Quote Link to comment https://forums.phpfreaks.com/topic/167786-problem-probably-caused-by-php-5-upgrade/#findComment-884839 Share on other sites More sharing options...
PFMaBiSmAd Posted July 28, 2009 Share Posted July 28, 2009 The solution is to fix the dependency on register_globals now. Don't re-enable them as they have been completely removed in php6 and you will still eventually need to fix the code. Quote Link to comment https://forums.phpfreaks.com/topic/167786-problem-probably-caused-by-php-5-upgrade/#findComment-885192 Share on other sites More sharing options...
.josh Posted July 28, 2009 Share Posted July 28, 2009 "Let's 'fix' the problem by trying to revert back to how it was before the upgrade! There can't possibly be a reason they've disabled it by default now, and are removing it altogether later!" Quote Link to comment https://forums.phpfreaks.com/topic/167786-problem-probably-caused-by-php-5-upgrade/#findComment-885213 Share on other sites More sharing options...
hakiepoo Posted July 29, 2009 Author Share Posted July 29, 2009 Any thoughts on how I can fix the dependency on register_globals? Like I mentioned, I can manage to pass variables in the url. However, I can't figure out how to make the email form work. Quote Link to comment https://forums.phpfreaks.com/topic/167786-problem-probably-caused-by-php-5-upgrade/#findComment-885707 Share on other sites More sharing options...
trq Posted July 29, 2009 Share Posted July 29, 2009 All your variables that are magically appearing in your script (eg; $send and a few others) no longer magically appear without register globals being on. You will now find these vars within the $_GET or $_POST array depending in your forms method. Quote Link to comment https://forums.phpfreaks.com/topic/167786-problem-probably-caused-by-php-5-upgrade/#findComment-885714 Share on other sites More sharing options...
hakiepoo Posted July 29, 2009 Author Share Posted July 29, 2009 Thanks for all the replies. I think I have solved it now by using $_REQUEST. Quote Link to comment https://forums.phpfreaks.com/topic/167786-problem-probably-caused-by-php-5-upgrade/#findComment-885857 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.