Voilà j'ai un soucis avec un script php m'affichant des notice reporting à répétition et je pense justifiant de certaines erreurs...
donc ce que je souhaiterais c'est si une Âme bienveillante pourrait jeter un œil aux script voir erreurs...(et a part désactiver les E notice du reporting préfère trouver une solution).
SCRIPT 1 Formulaire SLP.view.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<div>
<link rel="stylesheet" href="css/menu-small.css" />
<ul id="menu-bar">
<?php include_once ('inc/menu.inc.php'); ?>
</ul>
</div>
<title>Automatic rerolling - Recreation automatique</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">#error {color:#ff0000; list-style:none;}</style>
<script type="text/javascript">var RecaptchaOptions = {theme:'clean'};</script>
<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script src="js/placeholder.js"></script>
<link rel="stylesheet" href="css/style.css" />
</head><button onclick="javascript:location.reload();">Refresh</button>
<body><center>
<?php if(count($errors)){ ?>
<ul id="error">
<?php foreach($errors as $error){ ?>
<li><?php echo $error; ?></li>
<?php } ?>
</ul>
<?php } ?>
<form action="SLP.php" method="post" class="rerolling">
<h2>Automatic rerolling</br>Recreation automatique</h2>
<input name="username" value="<?php if(isset($_POST['username'])){ echo $_POST['username']; } ?>" class="text-field" placeholder="Username" />
<input name="password" type="password" value="<?php if(isset($_POST['password'])){ echo $_POST['password']; } ?>" class="text-field" placeholder="Password" />
</br></br>
<div align="center"> <table><td>
<b><font size=2 face=Tahoma>Stats :</font></b>
<select name="stat1">
<option value="Str">Str</option>
<option value="Dex">Dex</option>
<option value="Rec">Rec</option>
<option value="Wis">Wis</option>
<option value="Int">Int</option>
<option value="Luc">Luc</option>
</select><br /></td><td>
<select name="stat2">
<option value="Str">Str</option>
<option value="Dex">Dex</option>
<option value="Rec">Rec</option>
<option value="Wis">Wis</option>
<option value="Int">Int</option>
<option value="Luc">Luc</option>
</select><br /></td><td>
<select name="stat3">
<option value="Str">Str</option>
<option value="Dex">Dex</option>
<option value="Rec">Rec</option>
<option value="Wis">Wis</option>
<option value="Int">Int</option>
<option value="Luc">Luc</option>
</select><br /></td><td>
<select name="stat4">
<option value="HP">HP</option>
<option value="MP">MP</option>
<option value="SP">SP</option>
</select><br /></td>
</table>
</br>
Take care to have read completly the rerolling step</br>Lire attentivement la notice explicative Rerolling
<div style="height: 5px;"> </div>
<div align="center"><?php echo recaptcha_get_html($recaptcha_public_key); ?></div>
<input type="submit" value="Rerolling" class="button"/>
</br></br>
</form>
</center></body>
</html>
SCRIPT 2 le traitement SLP.php<?php
//error_reporting(E_ALL ^ E_NOTICE); //<-- JE NEN VEUX PLUS et en désactivant voir ci dessous les notices en question...
//Script pour modifier les stats oranges des items.
require_once('recaptchalib.config.php');
require_once('recaptchalib.php');
require_once('db.config.php');
$user_ip = $_SERVER['REMOTE_ADDR'];
$username = isset($_POST['username']) ? mssql_escape_string(trim($_POST['username'])) : '';
$password = isset($_POST['password']) ? mssql_escape_string(trim($_POST['password'])) : '';
$password2 = isset($_POST['password2']) ? mssql_escape_string(trim($_POST['password2'])) : '';
$itemIDV= 38150; // ID de l'item servant au Rerolling.
require_once('db.php');
$resx = mssql_query("SELECT * FROM PS_UserData.dbo.Users_Master WHERE UserID = '$username'");
$detailx = mssql_fetch_array($resx);
$resx2 = mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '0')");
$detailx2 = mssql_fetch_array($resx2); /*---ligne1---*/
$resx3 = mssql_query("SELECT * FROM PS_GameDefs.dbo.Items WHERE (ItemID = '$detailx2[ItemID]')");
$detailx3 = mssql_fetch_array($resx3);/*---ligne2---*/
// Remove the @ symbol here to see what the SQL error message is when running the above query in $sql.
$level2 = "$detailx3[ReqWis]";
switch( $level2 )// Ce "switch" est pour ajouter ou modifier les stats déjà existantes sur l'item à rerolling.
{
case 1:$bb = '01';break;
case 2:$bb = '02';break;
case 3:$bb = '03';break;
case 4:$bb = '04';break;
case 5:$bb = '05';break;
case 6:$bb = '06';break;
case 7:$bb = '07';break;
case 8:$bb = '08';break;
case 9:$bb = '09';break;
case 11:$bb = '11';break;
case 12:$bb = '12';break;
case 13:$bb = '13';break;
case 14:$bb = '14';break;
case 15:$bb = '15';break;
case 16:$bb = '16';break;
case 17:$bb = '17';break;
case 18:$bb = '18';break;
case 19:$bb = '19';break;
case 20:$bb = '20';break;
case 21:$bb = '21';break;
case 22:$bb = '22';break;
case 23:$bb = '23';break;
case 24:$bb = '24';break;
case 25:$bb = '25';break;
case 26:$bb = '26';break;
case 27:$bb = '27';break;
case 28:$bb = '28';break;
case 29:$bb = '29';break;
case 30:$bb = '30';break;
case 31:$bb = '31';break;
case 32:$bb = '32';break;
case 33:$bb = '33';break;
case 34:$bb = '34';break;
case 35:$bb = '35';break;
case 36:$bb = '36';break;
case 37:$bb = '37';break;
case 38:$bb = '38';break;
case 39:$bb = '39';break;
case 40:$bb = '40';break;
case 41:$bb = '41';break;
case 42:$bb = '42';break;
case 43:$bb = '43';break;
case 44:$bb = '44';break;
case 45:$bb = '45';break;
case 46:$bb = '46';break;
case 47:$bb = '47';break;
case 48:$bb = '48';break;
case 49:$bb = '49';break;
case 50:$bb = '50';break;
}
// ceci a ete modifier pour retirer lerreur Post blah.
// Exemple pour une variable $_POST['truc']:
// Avant d'utiliser $_POST['truc']
// if (isset($_POST['truc']))
// {
// Instructions si $_POST['truc'] existe
// }
$stat1 = $_POST['stat1'];
$Str ='00';$Dex ='00';$Rec ='00';$Wis ='00';$Int ='00';$Luc ='00';$HP ='00';$MP ='00';$SP ='00';$En ='00';
switch( $stat1 )
{
case Str:$Str = ''.$bb.'';break;
case Dex:$Dex = ''.$bb.'';break;
case Rec:$Rec = ''.$bb.'';break;
case Int:$Int = ''.$bb.'';break;
case Wis:$Wis = ''.$bb.'';break;
case Luc:$Luc = ''.$bb.'';break;
}
$stat2 = $_POST['stat2'];
switch( $stat2 )
{
case Str:$Str = ''.$bb.'';break;
case Dex:$Dex = ''.$bb.'';break;
case Rec:$Rec = ''.$bb.'';break;
case Int:$Int = ''.$bb.'';break;
case Wis:$Wis = ''.$bb.'';break;
case Luc:$Luc = ''.$bb.'';break;
}
$stat3 = $_POST['stat3'];
switch( $stat3 )
{
case Str:$Str = ''.$bb.'';break;
case Dex:$Dex = ''.$bb.'';break;
case Rec:$Rec = ''.$bb.'';break;
case Int:$Int = ''.$bb.'';break;
case Wis:$Wis = ''.$bb.'';break;
case Luc:$Luc = ''.$bb.'';break;
}
$stat4 = $_POST['stat4'];
switch( $stat4 )
{
case HP:$HP = ''.$bb.'';break;
case MP:$MP = ''.$bb.'';break;
case SP:$SP = ''.$bb.'';break;
}
$errors = array();
$success = false;
if(isset($_POST) && !empty($_POST)){
require_once('db.php');
// Validar Nome de Usuario.
$useruid = mssql_query("SELECT UserID,Pw FROM PS_UserData.dbo.Users_Master WHERE UserID = '{$username}'");
if(empty($username)){
$errors[] = 'Please provide a user name.';
}else if(strlen($username) < 4 || strlen($username) > 16){
$errors[] = 'User name must be between 4 and 12 characters in length.';
}else if(ctype_alnum($username) === false){
$errors[] = 'User name must consist of numbers and letters only.';
}else if (mssql_num_rows($useruid) == 0){
$errors[] = 'Invalid UserName/Nom d Utilisateur Incorrect.';
}
// Validar Senha do Usuario.
$useruid1 = @mssql_query("SELECT UserID,Pw FROM PS_UserData.dbo.Users_Master WHERE UserID = '{$username}' and PW = '{$password}'");
if(empty($password)){
$errors[] = 'Please provide a password.';
}else if(strlen($password) < 4 || strlen($password) > 12){
$errors[] = 'Password must be between 4 and 12 characters in length.';
}else if (mssql_num_rows($useruid1) == 0){
$errors[] = 'Invalid Password / Mot de passe Incorrect.';
}
// Evitar Status repetidos.
if($stat1 == $stat2){$errors[] = 'Choose one different Stat/Choisis une autre Stat.'; }
if($stat1 == $stat3){$errors[] = 'Choose one different Stat/Choisis une autre Stat.'; }
if($stat2 == $stat3){$errors[] = 'Choose one different Stat/Choisis une autre Stat.'; }
// Checar Se Usuario esta online.
$result = mssql_query("SELECT * FROM [PS_GameData].[dbo].[Chars] c INNER JOIN [PS_UserData].[dbo].[Users_Master] u ON c.UserID='{$username}' WHERE c.LoginStatus=1");
if(mssql_num_rows($result)){
$errors[] = '<strong>You must to close the game to continious/Tu dois fermer le jeu pour continuer.</strong>';
}
//Controle que l'item pour Reroll est bien present dans le slot 1 de l'entrepot
$res02 = mssql_query("SELECT ItemID FROM PS_GameData.dbo.UserStoredItems WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '1') AND (ItemID = '{$itemIDV}')");
$resxx2 = mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '0')");
$resz2 = mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '1')");
$detailz2 = mssql_fetch_array($resz2);
$resz3 = mssql_query("SELECT * FROM PS_GameDefs.dbo.Items WHERE (ItemID = '$detailz2[ItemID]')");
$detailz3 = mssql_fetch_array($resz3);
$resz4 = mssql_query("SELECT * FROM PS_GameDefs.dbo.Items WHERE (ItemID = '{$itemIDV}')");
$detailz4 = mssql_fetch_array($resz4);
$ItemName4= "$detailz4[ItemName]";
$ItemName= "$detailz3[ItemName]";
$count= "$detailz2[Count]";
if(empty($itemIDV)){
$errors[] = 'Please provide a password.';
}else if (mssql_num_rows($res02) == 0){
$errors[] = 'The Item <u>'.$ItemName.'</u> Is not Valid to continious <br /> Add this item <u>'.$ItemName4.'</u> In the second slot of Warehouse.';
}else if (mssql_num_rows($resxx2) == 0){
$errors[] = 'Provide an item in the first slot of Warehouse.';
}
// Validation du reCAPTCHA. This is to prevent someone botting account creation.
$response = recaptcha_check_answer($recaptcha_private_key,$_SERVER['REMOTE_ADDR'],$_POST['recaptcha_challenge_field'],$_POST['recaptcha_response_field']);
if(!$response->is_valid){
if($response->error == 'incorrect-captcha-sol'){
$errors['recaptcha'] = 'The Letters reCAPTCHA are incorrect/Les Lettres reCAPTCHA sont incorrectes.';
}else{
$errors['recaptcha'] = $response->error;
}
}
// Lecture et Ecriture dans la Database
if(count($errors) == 0){
$res22 = mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '0')");
$detail22 = mssql_fetch_array($res22);
$res33 = mssql_query("SELECT * FROM PS_GameDefs.dbo.Items WHERE (ItemID = '$detail22[ItemID]')");
$detail33 = mssql_fetch_array($res33);
// Ici vous donnera le numéro du serveur de l'élément du serveur n ° 4 qui reçoivent HP MP SP et Server 3 qui ne reçoivent HP MP SP (Modifier votre Item.SData)
$zr=0;
switch( $zr )
{
case 0:$ru = "00";break;
}
$enchant= substr("$detail22[Craftname]", -2) ;
$sv= "$detail33[Server]";
switch( $sv )
{
case 3:$ok = "$Str$Dex$Rec$Int$Wis$Luc$ru$ru$ru$enchant";break;
case 4:$ok = "$Str$Dex$Rec$Int$Wis$Luc$HP$MP$SP$enchant";break;
}
$res = mssql_query("SELECT * FROM PS_UserData.dbo.Users_Master WHERE UserID = '$username'");
$detail = mssql_fetch_array($res);
$del = 'DELETE FROM PS_GameData.dbo.UserStoredItems WHERE
CharID in (SELECT CharID FROM PS_GameData.dbo.Chars WHERE UserUID=' . $row1['UserUID'] . ')';
$res2 = mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '0')");
$detail2 = mssql_fetch_array($res2);
$del3= $count-1; // Ici retire la quantité de l'item demandé en slot 1. retire 1 item du montant en cas de stack.
$res3 = mssql_query("SELECT * FROM PS_GameDefs.dbo.Items WHERE (ItemID = '$detail2[ItemID]')");
$detail3 = mssql_fetch_array($res3);
$del = "DELETE FROM PS_GameData.dbo.UserStoredItems WHERE ItemID = '$itemIDV' AND Count='1' AND UserUID=(SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '1') ";
$sql2 = "UPDATE PS_GameData.dbo.UserStoredItems SET Count ='$del3' WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '1')";
$sql = "UPDATE PS_GameData.dbo.UserStoredItems SET Craftname = '$ok' WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '0')";
// Remove the @ symbol here to see what the SQL error message is when running the above query in $sql.
if($result3 = @mssql_query($del)){$success = "Success/Reussi.";
}else{ $errors[] = 'Failed to Reroll/Echec a Recreer.'; }
if($result2 = @mssql_query($sql2)){ $success = "Ready/Pret.";
}else{ $errors[] = 'Failed to Reroll/Echec a Recreer.'; }
if($result = @mssql_query($sql)){ $success = "The item<strong> '{$detail3[ItemName]}' </strong>was modify with success with the following stats :<br />Str:$Str<br />Dex:$Dex<br />Rec:$Rec<br />Wis:$Wis<br />Int:$Int<br />Luc:$Luc<br />HP:$HP<br />MP:$MP<br />SP:$SP<br />";
}else{
// This means the insert statement is probably not valid for your database. Fix the query or fix your database, your choice ;)
$errors[] = 'Not available for the moment, Try later!/Non disponible pour le moment, reessaye plutard!';
}
}
}
// Determine which view to show.
if($success === false){
require_once('SLP.view.php');
}else{
require_once('success.view.php');
}
?>
NOTICE :Voila ce que j'ai a vous présenter en guise "casse tete" et Merci beaucoup de votre aideNotice: Undefined index: stat1 in C:\tools\htdocs\panel\SLP.php on line 90
Notice: Use of undefined constant Str - assumed 'Str' in C:\tools\htdocs\panel\SLP.php on line 94
Notice: Use of undefined constant Dex - assumed 'Dex' in C:\tools\htdocs\panel\SLP.php on line 95
Notice: Use of undefined constant Rec - assumed 'Rec' in C:\tools\htdocs\panel\SLP.php on line 96
Notice: Use of undefined constant Int - assumed 'Int' in C:\tools\htdocs\panel\SLP.php on line 97
Notice: Use of undefined constant Wis - assumed 'Wis' in C:\tools\htdocs\panel\SLP.php on line 98
Notice: Use of undefined constant Luc - assumed 'Luc' in C:\tools\htdocs\panel\SLP.php on line 99
Notice: Undefined index: stat2 in C:\tools\htdocs\panel\SLP.php on line 101
Notice: Use of undefined constant Str - assumed 'Str' in C:\tools\htdocs\panel\SLP.php on line 104
Notice: Use of undefined constant Dex - assumed 'Dex' in C:\tools\htdocs\panel\SLP.php on line 105
Notice: Use of undefined constant Rec - assumed 'Rec' in C:\tools\htdocs\panel\SLP.php on line 106
Notice: Use of undefined constant Int - assumed 'Int' in C:\tools\htdocs\panel\SLP.php on line 107
Notice: Use of undefined constant Wis - assumed 'Wis' in C:\tools\htdocs\panel\SLP.php on line 108
Notice: Use of undefined constant Luc - assumed 'Luc' in C:\tools\htdocs\panel\SLP.php on line 109
Notice: Undefined index: stat3 in C:\tools\htdocs\panel\SLP.php on line 111
Notice: Use of undefined constant Str - assumed 'Str' in C:\tools\htdocs\panel\SLP.php on line 114
Notice: Use of undefined constant Dex - assumed 'Dex' in C:\tools\htdocs\panel\SLP.php on line 115
Notice: Use of undefined constant Rec - assumed 'Rec' in C:\tools\htdocs\panel\SLP.php on line 116
Notice: Use of undefined constant Int - assumed 'Int' in C:\tools\htdocs\panel\SLP.php on line 117
Notice: Use of undefined constant Wis - assumed 'Wis' in C:\tools\htdocs\panel\SLP.php on line 118
Notice: Use of undefined constant Luc - assumed 'Luc' in C:\tools\htdocs\panel\SLP.php on line 119
Notice: Undefined index: stat4 in C:\tools\htdocs\panel\SLP.php on line 121
Notice: Use of undefined constant HP - assumed 'HP' in C:\tools\htdocs\panel\SLP.php on line 124
Notice: Use of undefined constant MP - assumed 'MP' in C:\tools\htdocs\panel\SLP.php on line 125
Notice: Use of undefined constant SP - assumed 'SP' in C:\tools\htdocs\panel\SLP.php on line 126
Cordialement