Résolu Problème sur mon code php

Statut
N'est pas ouverte pour d'autres réponses.
Inscription
20 Novembre 2012
Messages
36
Réactions
1
Points
3 560
RGCoins
25
Bonsoir,
Je dois mettre en commentaire les lignes que j'ai mis en rouge mais quand je le fais ils me disent que j'ai une erreur à la ligne que j'ai mis en vert. Les signes que j'ai mis en orange c'est les signes que j'ai utilisé pour mettre en commentaire.

Aidez moi svp !

Code :
<?php include("../includes/database.php"); include("../includes/functions.php"); include("../includes/site.php");
session_start();
$do = Secu($_GET['do']);
if($do == "check"){
$username = Secu($_POST['username']);
$password = Secu($_POST['password']);
if(!empty($username)&&($password)){
/*
if($username == "admin"){
if($password == "mdp"){
$_SESSION['admin'] = $username;
header('location:index.php');
}

*/
} else {
$passwordhash = md5(sha1($password));
$sql = mysql_query("SELECT * FROM account_admins WHERE username = '".$username."' && pass = '".$passwordhash."'");
$checkadmin = mysql_fetch_assoc($sql);
if(!empty($checkadmin['id'])){
$_SESSION['admin'] = $username;
header('location:index.php');
} else {
header('location:index.php');
}
}
} else {
header('location:index.php');
}
} else if($do = "changeyt"){
$linkvideo = Secu($_POST['linkvideo']);
if(!empty($linkvideo)){
mysql_query("INSERT INTO youtube (code)
VALUES ('".$linkvideo."')") or die (mysql_error());
}
}
?>
 
Dernière édition:
Bonsoir,
Je dois mettre en commentaire les lignes que j'ai mis en rouge mais quand je le fais ils me disent que j'ai une erreur à la ligne que j'ai mis en vert. Les signes que j'ai mis en orange c'est les signes que j'ai utilisé pour mettre en commentaire.

Aidez moi svp !

Code :
<?php include("../includes/database.php"); include("../includes/functions.php"); include("../includes/site.php");
session_start();
$do = Secu($_GET['do']);
if($do == "check"){
$username = Secu($_POST['username']);
$password = Secu($_POST['password']);
if(!empty($username)&&($password)){
/*
if($username == "admin"){
if($password == "mdp"){
$_SESSION['admin'] = $username;
header('location:index.php');
}

*/
} else {
$passwordhash = md5(sha1($password));
$sql = mysql_query("SELECT * FROM account_admins WHERE username = '".$username."' && pass = '".$passwordhash."'");
$checkadmin = mysql_fetch_assoc($sql);
if(!empty($checkadmin['id'])){
$_SESSION['admin'] = $username;
header('location:index.php');
} else {
header('location:index.php');
}
}
} else {
header('location:index.php');
}
} else if($do = "changeyt"){
$linkvideo = Secu($_POST['linkvideo']);
if(!empty($linkvideo)){
mysql_query("INSERT INTO youtube (code)
VALUES ('".$linkvideo."')") or die (mysql_error());
}
}
?>
Relis bien tu mets des acolades Ouvrantes et Fermantes en trop...
Tu as mis deux conditions 'else' à la suite qui sont les mêmes...
 
Peut tu me faire la modif sur le code et me l'envoyer ?
_________________________________________________________________________________________________________
<?php include("../includes/database.php"); include("../includes/functions.php"); include("../includes/site.php");
session_start();
$do = Secu($_GET['do']);
if($do == "check"){
$username = Secu($_POST['username']);
$password = Secu($_POST['password']);
if(!empty($username)&&($password)){
/*
if($username == "admin"){
if($password == "mdp"){
$_SESSION['admin'] = $username;
header('location:index.php');
}
*/
} else {
$passwordhash = md5(sha1($password));
$sql = mysql_query("SELECT * FROM account_admins WHERE username = '".$username."' && pass = '".$passwordhash."'");
$checkadmin = mysql_fetch_assoc($sql);
if(!empty($checkadmin['id'])){
$_SESSION['admin'] = $username;
header('location:index.php');
} else {
header('location:index.php');
}
}
}
else if($do = "changeyt"){
$linkvideo = Secu($_POST['linkvideo']);
if(!empty($linkvideo)){
mysql_query("INSERT INTO youtube (code)
VALUES ('".$linkvideo."')") or die (mysql_error());
}
}
?>
________________________________________________________________________________________
 
Ton topic se trouvait dans la mauvaise section http://reality-gaming.fr/attachments/deplace-png.20318/, je l'ai donc déplacé dans la bonne section http://reality-gaming.fr/attachments/deplacement-png.20319/. :modo:
 
Statut
N'est pas ouverte pour d'autres réponses.
Retour
Haut