By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,175 Members | 1,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,175 IT Pros & Developers. It's quick & easy.

Parse error: syntax error, unexpected '$true' (T_VARIABLE) in C:\xampp\htdocs\downloa

P: 2
Parse error: syntax error, unexpected '$true' (T_VARIABLE) in C:\xampp\htdocs\download\register.php on line 19
Apr 14 '18 #1
Share this Question
Share on Google+
1 Reply

P: 2
$db = new mysqli('localhost','root','','felhasznalok');
if (isset($_POST['submit'])) {
$errors = array();
$true = true;
if (empty($_POST['username'])) {
$true = false;
array_push($errors, "A felhasználónév üres!");
if (empty($_POST['password'])) {
$true = false;
array_push($errors, "A jelszó üres!");
if (empty($_POST['password_2'])) {
$true = false;
array_push($errors, "A jelszó megerősítés üres!");
if (!($_POST['password']==$_POST['password_2'])
$true = false;
array_push($errors, "A jelszavak nem egyeznek!");
if ($true) {
$username = mysqli_real_escape_string($db, $_POST['username']);
$password = mysqli_real_escape_string($db, $_POST['password']);
$password = md5($password);

$sql = "INSERT INTO users(username, password, Date) VALUES('$
username', '$password' ,NOW())";
$_SESSION['username'] = $username;
header('location: home.php');


<form action="register.php" method="POST"/>
username<input type="text" name="username"/>
password<input type="password" name="password"/>
re_password<input type="password" name="password_2"/>
<input value="Regisztráció" type="submit" name="submit"/>
if (!empty($errors)) {
foreach ($errors as $key) {
echo $key. "<br/>";


Apr 14 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.