Jump to content

Php Registration Script


Anuradha
 Share

Recommended Posts

Hello friends,I try to write a script that, first, user could register; then log in after email link is been confirmed and provide more details later. U could see this first step in http://www.cctsrilanka.com/services_provid...egistration.phpHowever, my question is about first step. Following error massage appears on the browser. What I'm doing wrong? Any help will be appreciated. Thank You."Parse error: syntax error, unexpected $end in line 79"<?phpinclude 'global.php';if ($_POST['submit']){//get form data$username = addslashes(strip_tags($_POST['username']));$password = addslashes(strip_tags($_POST['password']));$email = addslashes(strip_tags($_POST['email']));//encrypt password$password = md5($password);//check if username already taken$check = mysql_query("SELECT * FROM serprologins WHERE username='$username'");if (mysql_num_rows ($check)>=1) echo "Username has already taken";else {//generate random code $code = rand(111111111,999999999); //send activation email $to = $email; $subjet = "Activate your account"; $headers = "From: myemail"; $body = "Hello $username,\n\nYou registered and need to activate your account in order to submit your details to Cross Country Travels Sri Lanka. Click on the link please\n\nhttp://cctsrilanka.com/services_providers/activate.php?code=$code\n\nThanks!"; if (!mail ($to,$subjet,$body,$headers)) echo "We could not sign you up at this time. Please contact us."; else {//Connect To Database $hostname='my'; $username='my'; $password='my'; $dbname='my'; $usertable='my'; $con = mysql_connect($hostname,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mydatabase", $con); //register into database $sql = "INSERT INTO mydatabase (companyname, firstname, lastname, countrycode, telephonenumber, emailaddress, confirmemail, address, streetname, Town, username, password, code, active) VALUES ('$_POST[company_name]', '$_POST[firstname]', '$_POST[lastname]', '$_POST[country_code]', '$_POST[telephone_number]', '$_POST[email_address]', '$_POST[confirm_email_address]', '$_POST[address]', '$_POST[street_name]', '$_POST[town_city]', '$_POST[username]', '$_POST[password]', '$_POST

',	'$_POST[0]')";				if (!mysql_query($sql,$con))	  {	  die('Error: ' . mysql_error());	  }	echo "1 record added";			mysql_close($con)?>
Link to comment
Share on other sites

You have forgotten some ends:mysql_close($con)}}}?>

<?phpinclude 'global.php';if ($_POST['submit']){//get form data$username = addslashes(strip_tags($_POST['username']));$password = addslashes(strip_tags($_POST['password']));$email = addslashes(strip_tags($_POST['email']));//encrypt password$password = md5($password);//check if username already taken$check = mysql_query("SELECT * FROM serprologins WHERE username='$username'");if (mysql_num_rows ($check)>=1)echo "Username has already taken";else{//generate random code$code = rand(111111111,999999999);//send activation email$to = $email;$subjet = "Activate your account";$headers = "From: myemail";$body = "Hello $username,\n\nYou registered and need to activate your account in order to submit your details to Cross Country Travels Sri Lanka.Click on the link please\n\nhttp://cctsrilanka.com/services_providers/activate.php?code=$code\n\nThanks!";if (!mail ($to,$subjet,$body,$headers))echo "We could not sign you up at this time. Please contact us.";else{//Connect To Database$hostname='my';$username='my';$password='my';$dbname='my';$usertable='my';$con = mysql_connect($hostname,$username,$password);if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("mydatabase", $con);//register into database$sql = "INSERT INTO mydatabase(companyname, firstname, lastname, countrycode, telephonenumber, emailaddress, confirmemail, address, streetname, Town, username, password, code, active)VALUES('$_POST[company_name]','$_POST[firstname]','$_POST[lastname]','$_POST[country_code]','$_POST[telephone_number]','$_POST[email_address]','$_POST[confirm_email_address]','$_POST[address]','$_POST[street_name]','$_POST[town_city]','$_POST[username]','$_POST[password]','$_POST[code]','$_POST[0]')";if (!mysql_query($sql,$con)){die('Error: ' . mysql_error());}echo "1 record added";mysql_close($con)}}}?>

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...