Jump to content

Parse error: syntax error, unexpected 'include' (T_INCLUDE) in C:\xampp\htdocs\PoetsIN\create-account.php on line 6


hinton92

Recommended Posts

I can't find the error, this is the whole code. I'm quite new to php and free to any advice. I use sublime text to create this. I hope you can help thanks in advance.  

 

 

<?php

$pdo = new PDO('mysql:host=localhost;dbname=PoetsIN;charset=utf8', 'root', '');

$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)

 

 

include('/classes/DB.php') ;

 

if (isset($_POST['createaccount'])) {

$username=$_POST['username'];

$password=$_POST['password'];

$email=$_POST['email'];

 

DB::query(INSERT INTO users VALUES (\'\', :username,:password,:email)', array(':username=>$username, ':password'=>$password, ':email'=>$email));

echo "Success!"; 

}

 

?>

Link to comment
Share on other sites

 

... I'm quite new to php and free to any advice. ... 
 
$pdo = new PDO('mysql:host=localhost;dbname=PoetsIN;charset=utf8', 'root', '');
 
 
$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
 
DB::query(INSERT INTO users VALUES (\'\', :username,:password,:email)', array(':username=>$username, ':password'=>$password, ':email'=>$email));

 

(1) Don't have your connect to your database as root

Create a dedicated account to be used by your application with the permissions that it needs to do its job. 

Only you get to use root, usually to clean up the mess made by applications or other people. 

 

(2) Never store passwords in a recoverable form (i.e plain text). 

Hash the password and store that result.  

When the user logs in, hash whatever password they enter and compare that with what's in the table. 

 

Regards, 

  Phill  W.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.