-3

Parse error: syntax error, unexpected end of file in /var/www/html/register.php on line 38

Anyone can help me?? I try to put ?> at the end but nothing is changed and I have also already tried to search online. This is the code:

<!DOCTYPE html>
<html>
<meta charset="utf-8">
<link rel="stylesheet" href="csslogin/style.css" />
</head>
<body>
<?php
require('config.php');
if (isset($_REQUEST['username'])){
    $username = $_POST['$username']; 
if (isset($_REQUEST['email'])){
    $email = $_POST['$email'];
if (isset($_REQUEST['password'])){
    $password = $_POST['$password'];
    $trn_date = date("Y-m-d H:i:s");
        $query = "INSERT into `users` (username, password, email, trn_date)
VALUES ('$username', '".md5($password)."', '$email', '$trn_date')";
        $result = mysql_query($con,$query);
        if($result){
            echo "<div class='form'>
<h3>You are registered successfully.</h3>
<br/>Click here to <a href='login.php'>Login</a></div>";
        }
    }else{
?>
<div class="form">
<h1>Registration</h1>
<form name="registration" action="" method="post">
<input type="text" name="username" placeholder="Username" required />
<input type="email" name="email" placeholder="Email" required />
<input type="password" name="password" placeholder="Password" required />
<input type="submit" name="submit" value="Register" />
</form>
</div>
</body>
</html>
Manuel
  • 1
  • 1
    Does this answer your question? [PHP parse/syntax errors; and how to solve them](https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – El_Vanja Apr 29 '21 at 14:50
  • 1
    I don't see you closing that `else` at the end. – El_Vanja Apr 29 '21 at 14:51
  • If you put error message into google, you'd find that you forgot to close bracket. – pavel Apr 29 '21 at 14:52
  • And please look up an up to date php tutorial, especially look for prepared statements, secure password handling ([password_hash()](https://www.php.net/manual/en/function.password-hash.php) and [password_verify()](https://www.php.net/manual/en/function.password-verify.php)) (md5 is not secure for passwords!) and mysqli/pdo since the mysql_* api has been deprecated for a long time. – LLJ97 Apr 29 '21 at 14:57

0 Answers0