473,320 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

Parse error: syntax error, unexpected '$true' (T_VARIABLE) in C:\xampp\htdocs\download\register.php on line 19
Apr 14 '18 #1
1 2558
<?php
$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())";
$db->query($sql);
session_start();
$_SESSION['username'] = $username;
header('location: home.php');

}
}
$db->close();
?>
<html>
<head>

</head>
<body>
<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"/>
</form>
<?php
if (!empty($errors)) {
foreach ($errors as $key) {
echo $key. "<br/>";
}


}

?>
</body>
</html>
Apr 14 '18 #2

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

Similar topics

1
by: james2432 | last post by:
Parse error: syntax error, unexpected T_VARIABLE in /var/www/LukeSite/validateform.php on line 27 validateform.php <?php session_start(); if(empty($_SESSION)||!isset($_SESSION)){...
3
by: brkseven | last post by:
Looking for help with this Contact Form. The error is on line 1, but that' doesn't mean a lot, I think. In fact, a php syntax check passed it, but I was hoping for an easy syntax error, it looks...
5
by: Adam Pelling | last post by:
I'm getting this error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/neblncbt/public_html/forum/includes/acp/acp_board.php on line 69 Here is the...
3
by: SUNN | last post by:
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /Users/Sunn/Song/usersong/profile.php on line 113 This is the line 113 <script...
7
by: aquilina | last post by:
This is my code..unexpected T_VARIABLE in C:\wamp\www\job_detail.php on line 15 <div class="h3">Features</div> <div class="mainbox"> <ul id="features"> <?php $con =...
2
by: vivekphp | last post by:
<?php $auth = 0; if(isset($_SERVER)) { $uname = $_SERVER; $pwd = $_SERVER; $fp = fopen("user.txt","r"); while($line = fgets($fp))
2
by: Cody DeWert | last post by:
My code (from a template) is saying: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' When i open the .php in dreamweaver, it confirms the error. the code is: <?php ...
4
by: thiagorisan | last post by:
Hi Guys.. I Heave the problem with my script of BPPennyMultiBid. This is Error: Parse error: syntax error, unexpected '"' in /home/thi8isju/public_html/bid_classic.php on line 159 This is...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.