Parse error: syntax error, unexpected '{'
Résolu
leDerko
Messages postés
22
Statut
Membre
-
leDerko Messages postés 22 Statut Membre -
leDerko Messages postés 22 Statut Membre -
Bonjour,
j'ai une grosse erreur qui m'embête regarder
j'ai une grosse erreur qui m'embête regarder
<html>
<body>
<?php
/*
* Copyright Niels Hamelink
* 26-4-2015
*/
function login($id){
$_session['id'] = $id;
exit('You are logged in');
}
if(!empty(($_POST['username'])
&& !empty($_POST['password'])) {
/*
* Config Parts
*/
$_config['host'] = 'db4free.net';
$_config['username'] = 'highlevel_100899';
$_config['password'] = '**';
$_config['database'] = 'highlevel_100899';
$_config['table_name'] = 'users';
$_config['username_column'] = 'Username';
$_config['password_column'] = 'Password';
$_config['hash_name'] = 'MD5';
// Creatings a (PDO) MySQL connections
// You can replace it with:
// $pdo = mysqli_connect(...) if you prefer mysqli above using PDO
// Don't forget to remove the exception around the connecting
try {
$pdo = new PDO ('mysql:host=' . $_config['host'] . ';dbname=' . $_config['database'], $_config['username'], $_config['password']);
}
catch (PDOException $ex) {
die ('Could not connect with the database!');
}
$query = $pdo->prepare('SELECT id, password FROM :table_name WHERE :username_column=":username_value"');
$query->execute(
array(
'table_name' => $_config['table_name'],
'username_column' => $_config['username_column'],
'username_value' => $_POST['username']
)
);
if($query->rowCount() == 1) {
$result = $query->fetch(PDO::FETCH_ASSOC);
if(result[$_config['password_column']] == hash($_config['hash_name'], $_POST['password']))
login($result['id']);
}
unset($_config, $_POST);
}
?>
</body>
</html>
A voir également:
- Parse error: syntax error, unexpected '{'
- Cmos checksum error ✓ - Forum Carte-mère/mémoire
- Error 1962 ✓ - Forum PC fixe
- Playback error reconnect in 3s (1/5) francais - Forum Box et Streaming vidéo
- Bad request error 403 paiement ✓ - Forum Réseaux sociaux
- A javascript error occurred in the main process - Forum Matériel & Système
if(!empty(($_POST['username']) && !empty($_POST['password'])) {Tu t'es trompé dans les parenthèses. Il y a 4 parenthèses ouvrantes pour 3 fermantes.
if(!empty(($_POST['username'])) && !empty($_POST['password'])) {Maintenant j'ai une erreur ligne 52
syntax error '['..