Jump to content

Parse error: syntax error, unexpected $end in...? lol


derrick1123

Recommended Posts

I am getting the error:

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\my_site\m\l-r\register.php on line 130

This is my register.php page...

 

<?php
// Register.php
$step = $_POST['step'];

if($step==0 || $step==""){

  echo "<body><html>";
  echo "<form method='POST' action='login.php'>";
  echo "<input type='hidden' value='1' name='step'>";
  echo "Username: <input type='text' name='username' size=30><br>";
  echo "Password: <input type='password' name='password' size=30><br>";
  echo "Email: <input type='text' name='email' size=30><br>";
  echo "<input type='submit' value='register'>";
  echo "</form>";
  echo "</body></html>";
  
}

if($step==1){

// Functions
function gen_key($len){

if($len == 0){ $len = 1; }



$letters = array('a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);



for($x=0; $x!=$len; $x++){





$key .= $letters[rand(0,sizeof($letters))];



}



return strtoupper($key);
}

// Get the POST vars
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];

// Connect to the database
require("../settings.php");

// Error Check Time!
$e = 0; $es = "There were some errors:";

if(strlen($username)<5 || strlen($username)>30){



$e++; $es .= "<br>Username is either too long or too short. Must be between 5 and 30 letters long.";
}

$r = mysql_query("SELECT * FROM member_system WHERE username='$username'");
if(mysql_numrows($r)>0){



$e++; $es .= "<br>A Member with this username already exists!";
}

if(strlen($password)<5 || strlen($password)>30){



$e++; $es .= "<br>Password is either too long or too short. Must be between 5 and 30 letters long.";
}

if(strlen($email)<8 || !strpos($email, ".") || !strpos($email, "@")){



$e++; $es .= "<br>The email entered appears to be invalid. Please enter a VALID email address.";
}

$r = mysql_query("SELECT * FROM member_system WHERE email='$email'");
if(mysql_numrows($r)>0){



$e++; $es .= "<br>A Member with this email address already exists!";
}

// Go for it!
if($e==0){



$key = gen_key(30);






$r = mysql_query("INSERT INTO member_system VALUES('','$username','$password','$email','$key');");






echo "Done!<br><br>User '<tt>$username</tt>' successfully registered!<br>You can now <a href='login.htm'>Login!</a>.";

} else {



echo $es."<br><br><a href='javascript:history.go(-1);'>Back</a>";
}

// Close MySQL Connection
mysql_close();

?> <!-- this is line 130 -->

 

If you need any other pages, please say so. I really want to get this fixed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.