0

i get this error Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\1\register.php on line 80

this is my code

<html>
<body style="background-color:#00B5FC">
<?php

$connection = mysql_connect("localhost", "root", "drndic899") or die("couldn't connect to the server");
mysql_select_db ("login", $connection) or die ("couldn't connect to the database");

error_reporting(0);

if ($_POST['register']){
    if ($_POST[`username`] && $_POST['password']) {
        $username = mysql_real_string($_POST['username']);
        $password = mysql_real_escape_string( $_POST['password']);
        $name = '';
        if  ($_POST['name']){
            $name = mysql_real_escape_string(strip_tags($_POST['name']));
        $check = mysql_fetch_array(mysql_query("SELECT * FROM 'users' WHERE 'username'='$username'"));
        if ($check != '0') {
            die("That Username already exists! Try <i>$username" . rand(1, 50) . " </i> instead! <a href='register.php'>&larr; Back</a>'");
        }
        if (!ctype_alnum($username)){
            die("sry Mr.x or Miss.x but you are not permited to use symbols in your username or password <a href='register.php'>larr; Back</a>");
        }
        if (strlen($username) <32) {
            die("Username is to long plz press (CTRL+Alt+F4) or press the back button if that dosent work dont press it again <a href='register.php'>larr; Back</a>");
        }
        $salt = rand() . rand() . rand() . rand();
        mysql_query("INSERT INTO `users` (`username`, `passord` , `name` , `salt` ) VALUES ('$username', '$password' , '$name' , '$salt' )");
        setcookie("c_users",($username), time () +24 * 60 * 60, "/");
        setcookie("c_salt",($salt), time () +24 * 60 * 60, "/");
        die("You just successfully created your OWN account on MC-Dacoow and are now logged in<a href='register.php'>&larr; Back </a>'");
    }

}

echo "

    <body style ='font-family: Verdana , sans-serif;'>
        <div style='width: 80%; padding: 10px; border: 1px solid #e3e3e3; background-color: #F5800C; color: #000; text-align:center; width:110em; margin: 0 auto;'>
            <h3>Register</h3>
            <br />
            <form action ='' method='post'>
                <table style='text-align:center; margin: 0 auto;'>
                    <tr>
                        <td>
                            <b>Username:</b>
                        </td>
                        <td>
                            <input type='text' name='username' style=padding: 4px;'/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <b>Name:</b>
                        </td>
                        <td>
                            <input type='text' name='name' style=padding: 4px;'/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <b>Password:</b>
                        </td>
                        <td>
                            <input type='password' name='password' style=padding: 4px;'/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        <input type='submit' name='Register' value='Register' />
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
<p style='text-align:center; margin: 0 auto; color:white; font-size: 2em; '>Made By HDminecraftnerd</p> " 
?>
</body>

80: </html>

5
Contributors
5
Replies
20
Views
3 Years
Discussion Span
Last Post by diafol
0

change this

<p style='text-align:center; margin: 0 auto; color:white; font-size: 2em; '>Made By HDminecraftnerd</p> "

?>

to this

<p style='text-align:center; margin: 0 auto; color:white; font-size: 2em; '>Made By HDminecraftnerd</p> ";

?>

Please allow me express my concern about your codes. I just need to know the reasons why use echo for the html tags.

You can close the pHP here

href='register.php'>&larr; Back </a>'");
}
}
?>

and remove the

echo "

go down to the page right on the codes that I corrected, change it to this

<p style='text-align:center; margin: 0 auto; color:white; font-size: 2em; '>Made By HDminecraftnerd</p> 

By doing so, you will have a clean PHP/ html separation, while allowing the server to parse the PHP codes and letting the browser does its job on the html part of the document.

Edited by veedeoo: info added.

0

Few things:

Line 77 place a ';' at the end of the line
Line 11 use single quotes not backticks for the username
Line 14 - you need a closing brace '}' after this

There may be other errors too.

A good IDE should help you.

Edited by diafol

0

line 31:

die("You just successfully created your OWN account on MC-Dacoow and are now logged in<a href='register.php'>&larr; Back </a>'");

remove last '

die("You just successfully created your OWN account on MC-Dacoow and are now logged in<a href='register.php'>&larr; Back </a>");

Lines 49, 57, 65

style=padding: 4px;'

must be

style='padding: 4px;'
0

@haris

This looks very bad. Test your code and markup at regular intervals - don't write a behemoth and then find hundreds of mistakes.

What program are you using to write your code?

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.