viv Posted May 5, 2007 Share Posted May 5, 2007 Hey - I just started my first PHP project yesterday and I've hit a bit of a stump. With the help of some premade forms I got a start but now I can't figure out how to correct my error. If anyone has time to just look through it and let me know I'd appreciate it! I'm trying to make a place for members on my game to be able to write checks with their SIM dollars and have it automatically upload to a table. Any help would be appreciated! I'm completely lost! LOGIN.PHP routine ------------------ <?php session_start(); <?php $dbh=mysql_connect ("localhost", "arcadias_bank", "<(filled in correctly on real code>") or die ('I cannot connect to the database because: ' . mysql_error()); } else { if ($_POST['_submit_check']) { if ($form_errors = validate_form()) { show_form($form_errors); } else { process_form(0); } } else { show_form(); } } function show_form($errors = '') { print '<form name="authForm" method="POST" action="'.$_SERVER['PHP_SELF'].'">'; if ($errors) { print '<span style="color:red"><ul><li><b>'; print implode('</b></li><li><b>',$errors); print '</b></li></ul></span>'; } print 'userto'; print '<input type="text" name="userto" value="'; print htmlentities($_POST[userID]) . '"> <br />'; print 'password'; print '<input type="password" name="password" value="'; print htmlentities($_POST[password]) . '"> <br />'; print '<input type="submit" name="login" value="Login" />'; print '<input type="hidden" name="_submit_check" value="1"/>'; print '</form>'; print '<a href="index.php">Click</a> here if you want to leave this form.'; } function validate_form() { $errors = array(); $userid=$_POST['Username']; $passwd=$_POST['Password']; /************************************************** ************************** * Check username and password in database * ************************************************** **************************/ // ..... connect to data base $text = ""; $text = $db->get_var("SELECT * FROM authorized_users WHERE userid='$userfrom' AND passwd=sha1('$passwd')") ; if ($text == "") { $errors[] = 'Enter a valid username and password!'; } return $errors; } function process_form($logged_in) { if ($logged_in == 0) { // Add the username to the session $_SESSION['username'] = $_POST['username']; } print 'You are logged in as: <b>'.$_SESSION['username'].'</b>'.str_repeat(' ', 10).'<a href="logout.php">Logout</a><br />'; print '<p>You can continue processing as a logged-in user ............</p>'; } ?> LOGOUT.PHP routine: ------------------- <?php session_start(); unset($_SESSION['username']); print '<p>You are logged out.</p>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/50147-solved-whats-my-error/ Share on other sites More sharing options...
Lumio Posted May 5, 2007 Share Posted May 5, 2007 Where is the error? Quote Link to comment https://forums.phpfreaks.com/topic/50147-solved-whats-my-error/#findComment-246209 Share on other sites More sharing options...
viv Posted May 5, 2007 Author Share Posted May 5, 2007 Oh sorry! Silly me! Parse error: syntax error, unexpected '<' in /home/arcadias/public_html/checkform.php on line 6 Quote Link to comment https://forums.phpfreaks.com/topic/50147-solved-whats-my-error/#findComment-246210 Share on other sites More sharing options...
MadTechie Posted May 5, 2007 Share Posted May 5, 2007 you have <?php twice (without closing the first one) remove the 2nd <?php Quote Link to comment https://forums.phpfreaks.com/topic/50147-solved-whats-my-error/#findComment-246215 Share on other sites More sharing options...
Lumio Posted May 5, 2007 Share Posted May 5, 2007 right Quote Link to comment https://forums.phpfreaks.com/topic/50147-solved-whats-my-error/#findComment-246222 Share on other sites More sharing options...
MadTechie Posted May 5, 2007 Share Posted May 5, 2007 if all is fine please click resolved Quote Link to comment https://forums.phpfreaks.com/topic/50147-solved-whats-my-error/#findComment-246224 Share on other sites More sharing options...
viv Posted May 5, 2007 Author Share Posted May 5, 2007 thanks so much! I'll probably be back later with more silly questions. Thanks for being patient with us noobies. Quote Link to comment https://forums.phpfreaks.com/topic/50147-solved-whats-my-error/#findComment-246229 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.