tomfmason Posted July 25, 2006 Share Posted July 25, 2006 it was not the echo but rather that I forgot a } at the end. Change the end of the script to this[code=php:0]if(!$sql){ echo 'There has been an error creating your account. Please contact the webmaster.'; }else{ echo " Your account has now been created. You may login with the following information:<br> <b>Login Id :</b> $loginid <br> <b>Password</b> $password <br>"; } ?>[/code]Here is a login script[code=php:0]<?phpsession_start(); include ('includes/db.php');array_pop($_POST); if ( get_magic_quotes_gpc() ) { $_POST= array_map('stripslashes', $_POST); } $loginid= mysql_real_escape_string(trim($_POST['loginid'])); $password= mysql_real_escape_string(trim($_POST['password']));$mdpwd= md5($password); $sql= sprintf("SELECT COUNT(*) AS login_match FROM `login_tbl` WHERE `loginid` = '%s' AND `password`= '%s'", $loginid, $mdpwd); $res= mysql_query($sql) or die(mysql_error()); $login_match= mysql_result($res, 0, 'login_match'); if ( $login_match == 1 ) { $_SESSION['loginid']= "$loginid"; $login_id = $_SESSION['loginid']; echo " Welcome $login_id, you are now loged in. <a href=\"http://www.yoursite.com/yourpage.php\">Click here</a> to proceed"; } else { echo "Your password and username do not match. Please try again."; include('your_login_form.html');//change this to your login form // not logged in }?>[/code] Quote Link to comment Share on other sites More sharing options...
onthespot Posted July 25, 2006 Author Share Posted July 25, 2006 i spotted the } u missed out mate, and got it working ;D Quote Link to comment 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.