Parse error: syntax error, unexpected $end in /home/a7358914/public_html/index.php on
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Parse error: syntax error, unexpected $end in /home/a7358914/public_html/index.php on
i don't know what i have don wrong in my script, but i am always getting this massage "Parse error: syntax error, unexpected $end in /home/a7358914/public_html/index.php on line 134" i diden't really understand it either, so i hope that someone can help me
Please use CODE tags when you paste script code. Also use a good code editor with coloring syntax, to catch that errors.
The error is caused by not closed curly brace for "if". You also had other mistakes, like not closed "input" tags, semicolons instead of equality signs, and not closed "p" tag. Check this:
PHP Code:
<html><body> // E-mail and password form thingy to login <form action='login.php' method='POST'> <br> <input type='email' name='email' value=""> <input type='password' name='password'> <input type='submit' value='log in'><br><br><hr> </form>
$namecheck = mysql_query("SELECT email FROM users WHERE email='$email'"); $count = mysql_num_rows($namecheck);
if ($count!=0) { die("Email already in use!"); }
//check for existance if ($firstname&&$lastname&&$email&&$password&&$repeatpassword) { if ($password==$repeatpassword) { //check char lenght of email, firstname and lastname if (strlen($email)>25||strlen($firstname)>25||strlen($lastname)>25) { echo "length of email or firstname or lastname is too long!"; } else { //check password length if (strlen($password)>25||strlen($password)<6) { echo "password must be between 6 and 25 charaters"; } else { //register the user!
// encript password $password = md5 ($password); $repeatpassword = md5 ($repeatpassword); $queryreg = mysql_query(" INSERT INTO users VALEU ('','$firstname','$email','$password','$date') "); die ("You have been registered!"); } } } else { echo "your password do not match!"; // I am also not good in english, but I think here should be "does" not "do". } } else { echo "Please fill in <b>all</b> fields!"; } } ?> <p> <form action="register.php" method="POST"> <table> <tr> <td> first name </td> <td> <input type="text" name="firstname" value="<?php echo $firstname; ?>"> </td> </tr> <tr> <td> last name </td> <td> <input type="text" name="lastname" value="<?php echo $lastname; ?>"> </td> </tr> <tr> <td> Email </td> <td> <input type="email" name="email" value="<?php echo $email; ?>"> </td> </tr> <tr> <td> password </td> <td> <input type="password" name="password"> </td> </tr> <tr> <td> Repeat password </td> <td> <input type="password" name="repeatpassword"> </td> </tr> </table> <input type="submit" name="submit" value="Register"> </form> </p> <body></html>
For security reasons, you should use "mysql_real_escape_string()" function on data executed in SQL queries, for example:
$namecheck = mysql_query("SELECT email FROM users WHERE email='$SQLemail'"); $count = mysql_num_rows($namecheck);
if ($count!=0) return "Email already in use!";
//check for existance if (empty($firstname) || empty($lastname) || empty($email) || empty($password) || empty($repeatpassword)) return "Please fill in <b>all</b> fields!";
if ($password != $repeatpassword) return "Your password does not match!";
//check char lenght of email, firstname and lastname if (strlen($email)>25||strlen($firstname)>25||strlen($lastname)>25) return "Length of email or firstname or lastname is too long!";
//check password length if (strlen($password)>25||strlen($password)<6) return "Password must be between 6 and 25 charaters.";
$Result = RegisterUser(); if($Result === true) // This means successful echo "You have been registered!"; // should not be die(), what about ending tags? else if(!empty($Result)) // This means some error message echo $Result;
Thanks m8, i followed your advices and everything its working fine now Thank you very much and I am also new here, so could you tell me the code to get my scrip in CODE: like yours
To use CODE tags, you need to click an icon on advanced editor toolbar which look like "#". Or faster by enclosing text [CODE]some text[/CODE]. You can also use [PHP] tag insted of [CODE].
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.