Problème lors de conversion Mysql a Mysqli
yanaubin
Messages postés
14
Date d'inscription
Statut
Membre
Dernière intervention
-
yanaubin Messages postés 14 Date d'inscription Statut Membre Dernière intervention -
yanaubin Messages postés 14 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
lors de la conversion de mysql a mysqli quand j'essaie de me connnecter au lieu de m'envoyer vers ma page home.php ca me retourne a mon login sans aucun message d'erreur et je ne comprend pas de ou peux provenir le problème. Avant la conversion tout fonctionnais bien.
loggedin.php
home.php
lors de la conversion de mysql a mysqli quand j'essaie de me connnecter au lieu de m'envoyer vers ma page home.php ca me retourne a mon login sans aucun message d'erreur et je ne comprend pas de ou peux provenir le problème. Avant la conversion tout fonctionnais bien.
loggedin.php
<?php
header("Expires: Thu, 17 May 2001 10:17:17 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
session_start();
if (!isset($_SESSION['SESSION'])) require ("session_init.php");
// reset session variables...
$_SESSION['LOGIN_TYPE'] = "";
$_SESSION['USERNAME'] = "";
$_SESSION['LOGGEDIN'] = false;
$_SESSION['FNAME'] = "";
$_SESSION['LNAME'] = "";
// initialize variables...
$username = "";
$password = "";
$email = "";
// make sure post parameters were sent...
if (isset($_REQUEST["username"])) $username = $_REQUEST["username"];
if (isset($_REQUEST["password"])) $password = $_REQUEST["password"];
// form variables must have something in them...
if ($username == "" || $password == "") { header("Location: ../index.php?flg=red&username=".$username); exit; }
// check in database...
$query = "SELECT * FROM user, position WHERE user.positionID = position.positionID AND logonName = '".$username."'";
$con = mysqli_connect($_SESSION['MYSQL_SERVER'],$_SESSION['MYSQL_LOGIN'],$_SESSION['MYSQL_PASS'],$_SESSION['MYSQL_DB']) or die("Unable to connect to SQL server");
$result = mysqli_query($con,$query) or die("Invalid query: " . mysqli_error($con));
// if username is not present in user table try the client table
if (mysqli_affected_rows($con) != 1)
{
$clientUserSQL = "SELECT * FROM client_user WHERE logonName = '".$username."'";
$clientUserResult = mysqli_query($con,$clientUserSQL) or die ("Invalide Query[clientUserSQL]: " . mysqli_error($con));
if (mysqli_affected_rows($con) != 1)
{
header("Location: ../index.php?flg=red&username=".$username); exit;
}
else
{
// check for password, active state, user type, and then send to appropriate section...
if ($clientUserRow = mysqli_fetch_assoc($clientUserResult))
{
#echo $row['sPassword'] . "<br>" . md5($password);
if ((strcmp($clientUserRow['logonPWD'], md5($password)) != 0) || (strcmp($clientUserRow['statusID'],"24") != 0))
{
header("Location: ../index.php?flg=red&username=".$username); exit;
}
// set standard session variables...
$_SESSION['LOGIN_TYPE'] = "client";
$_SESSION['LOGED_USERID'] = $clientUserRow['clientUserID'];
$_SESSION['LOGED_USER_CLIENTID'] = $clientUserRow['clientID'];
$_SESSION['USER_STATUS'] = $clientUserRow['statusID'];
$_SESSION['USERNAME'] = $username;
$_SESSION['LOGGEDIN'] = true;
$_SESSION['FNAME'] = $clientUserRow['fname'];
$_SESSION['LNAME'] = $clientUserRow['lname'];
header("Location: ../welcome.php"); exit;
}
else
{
header("Location: ../index.php?flg=red&username=".$username); exit;
}
}
}
else
{
// check for password, active state, user type, and then send to appropriate section...
if ($row = mysqli_fetch_assoc($result))
{
#echo $row['sPassword'] . "<br>" . md5($password);
if ((strcmp($row['logonPWD'], md5($password)) != 0) || (strcmp($row['statusID'],"1") != 0))
{
header("Location: ../index.php?flg=red&username=".$username); exit;
}
// set standard session variables...
$_SESSION['LOGIN_TYPE'] = $row['loginType'];
$_SESSION['LOGIN_POSITION_NAME'] = $row['positionName'];
$_SESSION['LOGED_USER_CLIENTID'] = 0;
$_SESSION['LOGED_USERID'] = $row['userID'];
$_SESSION['USER_STATUS'] = $row['statusID'];
$_SESSION['USERNAME'] = $username;
$_SESSION['LOGGEDIN'] = true;
$_SESSION['FNAME'] = $row['fname'];
$_SESSION['LNAME'] = $row['lname'];
header("Location: ../welcome.php"); exit;
}
else
{
header("Location: ../index.php?flg=red&username=".$username); exit;
}
}
?>
home.php
<?php
require_once 'scripts/SESSION_CONNECT.php';
require_once 'scripts/functions.php';
$LoginType = "";
$refresh = "";
$leftMenu = "";
$mainPage = "";
$defaultPanelIndex = -1;
$LogedUserID = $_SESSION['LOGED_USERID'];
$LoginType = $_SESSION['LOGIN_TYPE'];
$LoginPositionName = $_SESSION['LOGIN_POSITION_NAME'];
$FirstLogin = $_SESSION['INITIAL_LOGIN'];
//Page creation and redirection for a DISPATCHER login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "dispatch"))
{
$leftMenu = "sideMenu.php";
$mainPage = "dispatchMain.php";
}
elseif (isset($LoginType) && isset($_GET['mainPage']) && ($LoginType == "dispatch"))
{
$leftMenu = "sideMenu.php";
if ($_GET['mainPage'] == "dispatchMain")
{
$mainPage = "dispatchMain.php";
}
elseif ($_GET['mainPage'] == "shiftReportList")
{
$mainPage = "shiftReportList.php";
}
elseif ($_GET['mainPage'] == "dailyReport")
{
$mainPage = "dailyReportForm.php";
}
elseif ($_GET['mainPage'] == "carAssign")
{
$mainPage = "carAssign.php";
}
elseif ($_GET['mainPage'] == "alarmReports")
{
$mainPage = "alarmReports.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
elseif ($_GET['mainPage'] == "addClient")
{
$mainPage = "addClient.php";
}
}
Page creation and redirection for a CLIENT login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "client"))
{
$leftMenu = "sideMenu.php";
$mainPage = "clientMain.php";
}
elseif (isset($LoginType) && isset($_GET['mainPage']) && ($LoginType == "client"))
{
$leftMenu = "sideMenu.php";
if ($_GET['mainPage'] == "clientMain")
{
$mainPage = "clientMain.php";
}
elseif ($_GET['mainPage'] == "alarmReports")
{
$mainPage = "alarmReports.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
}
Page creation and redirection for a PATROLLER login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "patrol"))
{
$leftMenu = "sideMenu.php";
$mainPage = "patrolMain.php";
}
elseif (isset($LoginType) && isset($_GET['mainPage']) && ($LoginType == "patrol"))
{
$leftMenu = "sideMenu.php";
if ($_GET['mainPage'] == "patrolMain")
{
$mainPage = "patrolMain.php";
}
elseif ($_GET['mainPage'] == "shiftReportList")
{
$mainPage = "shiftReportList.php";
}
elseif ($_GET['mainPage'] == "dailyReport")
{
$mainPage = "dailyReportForm.php";
}
elseif ($_GET['mainPage'] == "alarmReports")
{
$mainPage = "alarmReports.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
elseif ($_GET['mainPage'] == "patroller")
{
$mainPage = "patroller.php";
}
}
Page creation and redirection for a ADMINISTRATOR login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "admin"))
{
$leftMenu = "sideMenu.php";
$mainPage = "dispatchMain.php";
}
elseif (isset($LoginType) && isset($_GET['mainPage']) && ($LoginType == "admin"))
{
$leftMenu = "sideMenu.php";
if ($_GET['mainPage'] == "dispatchMain")
{
$mainPage = "dispatchMain.php";
}
elseif ($_GET['mainPage'] == "addUser")
{
$mainPage = "addUser.php";
}
elseif ($_GET['mainPage'] == "addAlarmCo")
{
$mainPage = "addAlarmCo.php";
}
elseif ($_GET['mainPage'] == "addClient")
{
$mainPage = "addClient.php";
}
elseif ($_GET['mainPage'] == "addSite")
{
$mainPage = "addSite.php";
}
elseif ($_GET['mainPage'] == "addCar")
{
$mainPage = "addCar.php";
}
elseif ($_GET['mainPage'] == "addDirective")
{
$mainPage = "addDirective.php";
}
elseif ($_GET['mainPage'] == "addFiles")
{
$mainPage = "addFiles.php";
}
elseif ($_GET['mainPage'] == "addAlarmType")
{
$mainPage = "addAlarmType.php";
}
elseif ($_GET['mainPage'] == "carAssign")
{
$mainPage = "carAssign.php";
}
elseif ($_GET['mainPage'] == "shiftReportList")
{
$mainPage = "shiftReportList.php";
}
elseif ($_GET['mainPage'] == "dailyReport")
{
$mainPage = "dailyReportForm.php";
}
elseif ($_GET['mainPage'] == "addTemplate")
{
$mainPage = "addTemplate.php";
}
elseif ($_GET['mainPage'] == "alarmReports")
{
$mainPage = "alarmReports.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
elseif ($_GET['mainPage'] == "addDepartment")
{
$mainPage = "addDepartment.php";
}
elseif ($_GET['mainPage'] == "alarmCallPeak")
{
$mainPage = "alarmPeakForm.php";
}
elseif ($_GET['mainPage'] == "scheduleListReport")
{
$mainPage = "scheduleListReport.php";
}
elseif ($_GET['mainPage'] == "alarmStats")
{
$mainPage = "alarmStatsForm.php";
}
elseif ($_GET['mainPage'] == "preventiveStats")
{
$mainPage = "preventiveStatsForm.php";
}
}
Page creation and redirection for a ROOT login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "root"))
{
$leftMenu = "sideMenu.php";
$mainPage = "dispatchMain.php";
}
elseif (isset($LoginType) && isset($_GET['mainPage']) && ($LoginType == "root"))
{
$leftMenu = "sideMenu.php";
if ($_GET['mainPage'] == "dispatchMain")
{
$mainPage = "dispatchMain.php";
}
elseif ($_GET['mainPage'] == "addUser")
{
$mainPage = "addUser.php";
}
elseif ($_GET['mainPage'] == "addClientUser")
{
$mainPage = "addClientUser.php";
}
elseif ($_GET['mainPage'] == "addAlarmCo")
{
$mainPage = "addAlarmCo.php";
}
elseif ($_GET['mainPage'] == "addClient")
{
$mainPage = "addClient.php";
}
elseif ($_GET['mainPage'] == "addSite")
{
$mainPage = "addSite.php";
}
elseif ($_GET['mainPage'] == "addCar")
{
$mainPage = "addCar.php";
}
elseif ($_GET['mainPage'] == "addDirective")
{
$mainPage = "addDirective.php";
}
elseif ($_GET['mainPage'] == "addFiles")
{
$mainPage = "addFiles.php";
}
elseif ($_GET['mainPage'] == "addAlarmType")
{
$mainPage = "addAlarmType.php";
}
elseif ($_GET['mainPage'] == "addDepartment")
{
$mainPage = "addDepartment.php";
}
elseif ($_GET['mainPage'] == "carAssign")
{
$mainPage = "carAssign.php";
}
elseif ($_GET['mainPage'] == "shiftReportList")
{
$mainPage = "shiftReportList.php";
}
elseif ($_GET['mainPage'] == "dailyReport")
{
$mainPage = "dailyReportForm.php";
}
elseif ($_GET['mainPage'] == "addTemplate")
{
$mainPage = "addTemplate.php";
}
elseif ($_GET['mainPage'] == "alarmReports")
{
$mainPage = "alarmReports.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
elseif ($_GET['mainPage'] == "alarmCallPeak")
{
$mainPage = "alarmPeakForm.php";
}
elseif ($_GET['mainPage'] == "scheduleListReport")
{
$mainPage = "scheduleListReport.php";
}
elseif ($_GET['mainPage'] == "alarmStats")
{
$mainPage = "alarmStatsForm.php";
}
elseif ($_GET['mainPage'] == "preventiveStats")
{
$mainPage = "preventiveStatsForm.php";
}
elseif ($_GET['mainPage'] == "BillingRulesSelection")
{
$mainPage = "billingRulesSelection.php";
}
elseif ($_GET['mainPage'] == "createInvoice")
{
$mainPage = "createInvoice.php";
}
elseif ($_GET['mainPage'] == "findInvoice")
{
$mainPage = "findInvoice.php";
}
elseif ($_GET['mainPage'] == "autoSuggest")
{
$mainPage = "autosuggest/AutoSuggest.html";
}
}
Page creation and redirection for a MANAGERS login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "manager"))
{
$leftMenu = "sideMenu.php";
$mainPage = "dispatchMain.php";
}
elseif (isset($LoginType) && isset($_GET['mainPage']) && ($LoginType == "manager"))
{
$leftMenu = "sideMenu.php";
if ($_GET['mainPage'] == "dispatchMain")
{
$mainPage = "dispatchMain.php";
}
elseif ($_GET['mainPage'] == "addUser")
{
$mainPage = "addUser.php";
}
elseif ($_GET['mainPage'] == "addAlarmCo")
{
$mainPage = "addAlarmCo.php";
}
elseif ($_GET['mainPage'] == "addFiles")
{
$mainPage = "addFiles.php";
}
elseif ($_GET['mainPage'] == "addClient")
{
$mainPage = "addClient.php";
}
elseif ($_GET['mainPage'] == "addSite")
{
$mainPage = "addSite.php";
}
elseif ($_GET['mainPage'] == "addCar")
{
$mainPage = "addCar.php";
}
elseif ($_GET['mainPage'] == "addDirective")
{
$mainPage = "addDirective.php";
}
elseif ($_GET['mainPage'] == "carAssign")
{
$mainPage = "carAssign.php";
}
elseif ($_GET['mainPage'] == "addAlarmType")
{
$mainPage = "addAlarmType.php";
}
elseif ($_GET['mainPage'] == "shiftReportList")
{
$mainPage = "shiftReportList.php";
}
elseif ($_GET['mainPage'] == "dailyReport")
{
$mainPage = "dailyReportForm.php";
}
elseif ($_GET['mainPage'] == "addTemplate")
{
$mainPage = "addTemplate.php";
}
elseif ($_GET['mainPage'] == "alarmReports")
{
$mainPage = "alarmReports.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
elseif ($_GET['mainPage'] == "alarmCallPeak")
{
$mainPage = "alarmPeakForm.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
elseif ($_GET['mainPage'] == "alarmStats")
{
$mainPage = "alarmStatsForm.php";
}
elseif ($_GET['mainPage'] == "preventiveStats")
{
$mainPage = "preventiveStatsForm.php";
}
}
Page creation and redirection for a SENIOR DISPATCHER login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "seniorDispatch"))
{
$leftMenu = "sideMenu.php";
$mainPage = "dispatchMain.php";
}
elseif (isset($LoginType) && isset($_GET['mainPage']) && ($LoginType == "seniorDispatch"))
{
$leftMenu = "sideMenu.php";
if ($_GET['mainPage'] == "dispatchMain")
{
$mainPage = "dispatchMain.php";
}
elseif ($_GET['mainPage'] == "addUser")
{
$mainPage = "addUser.php";
}
elseif ($_GET['mainPage'] == "addAlarmCo")
{
$mainPage = "addAlarmCo.php";
}
elseif ($_GET['mainPage'] == "addClient")
{
$mainPage = "addClient.php";
}
elseif ($_GET['mainPage'] == "addSite")
{
$mainPage = "addSite.php";
}
elseif ($_GET['mainPage'] == "addCar")
{
$mainPage = "addCar.php";
}
elseif ($_GET['mainPage'] == "addDirective")
{
$mainPage = "addDirective.php";
}
elseif ($_GET['mainPage'] == "carAssign")
{
$mainPage = "carAssign.php";
}
elseif ($_GET['mainPage'] == "shiftReportList")
{
$mainPage = "shiftReportList.php";
}
elseif ($_GET['mainPage'] == "dailyReport")
{
$mainPage = "dailyReportForm.php";
}
elseif ($_GET['mainPage'] == "alarmReports")
{
$mainPage = "alarmReports.php";
}
elseif ($_GET['mainPage'] == "preventiveReports")
{
$mainPage = "preventiveReports.php";
}
elseif ($_GET['mainPage'] == "addTemplate")
{
$mainPage = "addTemplate.php";
}
}
Page creation and redirection for the TIMEZONE login and menu updates
if (isset($LoginType) && !isset($_GET['mainPage']) && ($LoginType == "timeZone"))
{
$leftMenu = "sideMenu.php";
$mainPage = "timezones.php";
}
This variable controls how often the page is refreshed and is in seconds
if($mainPage == "dispatchMain.php" && ($LoginType == "dispatch" || $LoginType == "admin"))
{
$reloadTime = "30000";
$retryTime = "5000";
}
else if ($LoginType == "patrol" && $mainPage == "patrolMain.php")
{
$reloadTime = "300000";
$retryTime = "5000";
}
else if ($LoginType == "seniorDispatch" && $mainPage == "dispatchMain.php")
{
$reloadTime = "30000";
$retryTime = "5000";
}
else if ($LoginType == "client" && $mainPage == "clientMain.php")
{
$reloadTime = "60000";
$retryTime = "5000";
}
else if ($LoginType == "timeZone")
{
$reloadTime = "30000";
$retryTime = "5000";
}
else
{
$reloadTime = "4320000000";
$retryTime = "4320000000";
}
if ($LoginType == "patrol")
{
$getCarIDSQL = "SELECT carID, code FROM car WHERE patrollerUserID = '".$LogedUserID."'";
$getCarIDResult = mysqli_query($con,$getCarIDSQL) or die('Query failed: ' . mysqli_error($con));
$numOfRows = mysqli_num_rows($getCarIDResult);
if ($numOfRows != 0)
{
$_SESSION['PATROLER_CAR_ID'] = mysqli_fetch_row($getCarIDResult,0,"carID");
$_SESSION['CAR_CODE'] = mysqli_fetch_row($getCarIDResult,0,"code");
$infoDisplay = "Voiture assign: ".$_SESSION['CAR_CODE'];
}
else
{
$_SESSION['CAR_CODE'] = "non assign";
$_SESSION['PATROLER_CAR_ID'] = 0;
$infoDisplay = "Aucune voiture vous a t assigner; AVISER RPARTITION";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>C.A.D. Menu Principal</title>
<link rel="stylesheet" href="css/layout.css" type="text/css"/>
<style type="text/css" media="screen">
#menu {
margin-top:55px;
width: 140px;
background: #336699;
}
#menu ul {
list-style: none;
margin: 0;
width: 140px;
padding: 0;
}
#menu a, #menu h2 {
font: bold 11px/16px arial, helvetica, sans-serif;
display: block;
border-width: 1px;
border-style: solid;
border-color: #ccc #888 #555 #bbb;
margin: 0;
padding: 2px 3px;
}
#menu a:hover {
color: #a00;
background: #fff;
}
#menu li {
position: relative;
}
#menu ul ul ul {
position: absolute;
top: 0;
left: 100%;
width: 100%;
}
div#menu ul ul ul,
div#menu ul ul li:hover ul ul
{display: none;}
div#menu ul ul li:hover ul,
div#menu ul ul ul li:hover ul
{display: block;}
</style>
<!--[if IE]>
<style type="text/css" media="screen">
#menu ul li {float: left; width: 100%;}
</style>
<![endif]-->
<!--[if lt IE 7]>
<style type="text/css" media="screen">
body {
behavior: url(csshover.htc);
font-size: 100%;
}
#menu ul li {float: left; width: 100%;}
#menu ul li a {height: 1%;}
#menu a, #menu h2 {
font: bold 0.7em/1.4em arial, helvetica, sans-serif;
}
</style>
<![endif]-->
<script type="text/javascript" src="JSCal2/js/jscal2.js"></script>
<script type="text/javascript" src="JSCal2/js/lang/fr.js"></script>
<script type="text/javascript" src="javascript/functions.js"></script>
<script type="text/javascript" src="javascript/formatdate.js"></script>
<script type="text/javascript" src="autosuggest/js/AutoSuggest.js"></script>
<script type="text/javascript" src="javascript/ddaccordion.js"></script>
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<link rel="stylesheet" href="autosuggest/css/autosuggest_inquisitor.css" type="text/css" media="screen"/>
<link rel="stylesheet" type="text/css" href="JSCal2/css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="JSCal2/css/steel/steel.css" />
<script type="text/javascript" language="javascript">
function confirmTenCode(TenCode, Location, PassedID, CarID, ExternalID, Type)
{
confirmResponse = "";
confirmResponse = confirm("Êtes-vous vraiement en " + TenCode + " pour " + Location + "?");
if(confirmResponse)
{
var passedString = 'scripts/tenCodeSave.php?passedID=' + PassedID + '&tenCode=' + TenCode + '&type=' + Type + '&location=' + Location + '&carID=' + CarID + '&externalID=' + ExternalID;
//alert(passedString);
tenCodePopUp = popUp(passedString,'console',300,200,'TenCodeSaveWin');
tenCodePopUp.focus();
return true;
}
else
{
return false;
}
}
function confirmLogOff()
{
<?php
if (($FirstLogin == false) && ($LoginType != "manager") && ($LoginType != "root") && ($LoginType != "client") && ($LoginType != "admin") && ($LoginType != "timeZone"))
{
echo "\tconfirmResponse = \"\";\r\n";
echo "\tconfirmResponse = confirm('Si c\'est la fin de votre quart, est-ce que vous avez fait votre \"10-38\"?');\r\n";
echo "\tif(confirmResponse)\r\n";
echo "\t{\r\n";
echo "\t\tdocument.location='scripts/logout.php';\r\n";
echo "\t\treturn true;\r\n";
echo "\t}\r\n";
echo "\telse\r\n";
echo "\t{\r\n";
echo "\t\treturn false;\r\n";
echo "\t}\r\n";
}
else
{*/
echo "document.location='scripts/logout.php';\r\n";
echo "return true;\r\n";
//}
?>
}
function clientConfirmLogOff()
{
document.location='scripts/client_logout.php';
return true;
}
//Function used to collapse all information containers on the main page
function collapseAllInPage()
{
ddaccordion.collapseall('alarmResponse');
ddaccordion.collapseall('specialPreventiveTemplate');
ddaccordion.collapseall('preventiveTemplate');
}
//Function used to expand all information containers on the main page
function expandAllInPage()
{
ddaccordion.expandall('alarmResponse');
ddaccordion.expandall('specialPreventiveTemplate');
ddaccordion.expandall('preventiveTemplate');
}
<?php
if (($FirstLogin == true) && ($LoginType != "manager") && ($LoginType != "root") && ($LoginType != "client") && ($LoginType != "admin") && ($LoginType != "timeZone"))
{
echo "customAlert('noubliez pas de faire votre 10-35 si c\'est le début de votre quart!!!');";
$_SESSION['INITIAL_LOGIN'] = false;
}
?>
function reloadPage()
{
window.location.reload();
window.setTimeout('reloadPage()',<?php echo $reloadTime; ?>);
}
function place()
{
globalPlace();
updateDateTimeNow();
<?php if ($LoginType == "timeZone") echo "timeZone();"; ?>
}
function quickCarAssignChange(passedID, initialCarCode, initialCarID, carSaveType)
{
if (carSaveType == "alarm")
{
finalCarCode = document.getElementById('CarAssignList-A-' + passedID).options[document.getElementById('CarAssignList-A-' + passedID).selectedIndex].text;
finalCarID = document.getElementById('CarAssignList-A-' + passedID).value;
}
else if (carSaveType == "preventive")
{
finalCarCode = document.getElementById('CarAssignList-P-' + passedID).options[document.getElementById('CarAssignList-P-' + passedID).selectedIndex].text;
finalCarID = document.getElementById('CarAssignList-P-' + passedID).value;
}
if (finalCarCode == "n/a")
{
confirmResponse = confirm('Etes vous sur d\'assigner la voiture ' + finalCarCode + ' a cette alarme?');
}
else
{
confirmResponse = confirm('Etes vous sur d\'assigner la voiture ' + initialCarCode + ' a ' + finalCarCode + '?');
}
if(confirmResponse)
{
passedString = 'scripts/quickCarAssignSave.php?passedID=' + passedID + '&carID=' + finalCarID + '&carSaveType=' + carSaveType + '&initialCarID=' + initialCarID;
quickCarAssignPopUp = popUp(passedString,'fixed',400,150,'quickCarAssignSaveWindow');
window.opener.focus();
return true;
}
else
{
return false;
}
}
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
alert('Browser used: ' + BrowserDetect.browser + ' version: ' + BrowserDetect.version);
</script>
<script type="text/javascript">
var cal = Calendar.setup({
weekNumbers: true,
fdow: 0,
onSelect: function(cal) { cal.hide() }
});
</script>
</head>
<body onload="place()">
<!-- This is the header area of the site-->
<div class="header">
<?php
if ($LoginType != "client")
{
$assignedCarListSQL = "SELECT * FROM carassignmentLog cal, user, car WHERE car.carID = cal.carID AND cal.patrollerUserID = user.userID AND cal.shiftEndDateTime IS NULL
AND cal.carID >= '50' ORDER BY user.lname ASC";
$assignedCarListResult = mysqli_query($con,$assignedCarListSQL) or die('Query[assignedCarListSQL] failed: ' . mysqli_error($con));
$assignedCarListNumOfRows = mysqli_num_rows($assignedCarListResult);
if ($assignedCarListNumOfRows)
{
echo "<table border=\"0\" width=\"100%\" align=\"right\">\n";
echo "\t<tr>\n";
for ($i = 0; $i < $assignedCarListNumOfRows; $i++)
{
if ($i%2 == 0 && $i != 0){
echo "</tr><tr>\n";
}
if (mysqli_fetch_row($assignedCarListResult, $i, "car.state") == "alarm")
echo "\t\t<td style=\"background-color: #CC0033;\"><b>".mysqli_fetch_row($assignedCarListResult,$i,"car.code")."</b> - ".mysqli_fetch_row($assignedCarListResult,$i,"user.lname").", ".substr(mysqli_fetch_row($assignedCarListResult,$i,"user.fname"),0,1)." | ".mysqli_fetch_row($assignedCarListResult,$i,"cal.shiftStartTime")." à ".mysqli_fetch_row($assignedCarListResult,$i,"cal.shiftEndTime")." | <i>".mysqli_fetch_row($assignedCarListResult,$i,"cal.sector")."</i></td>\n";
else if (mysqli_fetch_row($assignedCarListResult, $i, "car.state") == "preventive")
echo "\t\t<td style=\"background-color: #FFEE00;color:black;\"><b>".mysqli_fetch_row($assignedCarListResult,$i,"car.code")."</b> - ".mysqli_fetch_row($assignedCarListResult,$i,"user.lname").", ".substr(mysqli_fetch_row($assignedCarListResult,$i,"user.fname"),0,1)." | ".mysqli_fetch_row($assignedCarListResult,$i,"cal.shiftStartTime")." à ".mysqli_fetch_row($assignedCarListResult,$i,"cal.shiftEndTime")." | <i>".mysqli_fetch_row($assignedCarListResult,$i,"cal.sector")."</i></td>\n";
else
echo "\t\t<td><b>".mysqli_fetch_row($assignedCarListResult,$i,"car.code")."</b> - ".mysqli_fetch_row($assignedCarListResult,$i,"user.lname").", ".substr(mysqli_fetch_row($assignedCarListResult,$i,"user.fname"),0,1)." | ".mysqli_fetch_row($assignedCarListResult,$i,"cal.shiftStartTime")." à ".mysqli_fetch_row($assignedCarListResult,$i,"cal.shiftEndTime")." | <i>".mysqli_fetch_row($assignedCarListResult,$i,"cal.sector")."</i></td>\n";
}
echo "\t</tr>\n";
echo "</table>\n";
}
}
?>
</div>
<!-- This is the left menu side of the site -->
<div class="leftMenu">
<div id="menu">
<?php
include ($leftMenu); //Call the appropriate left Menu depending on who logs in
?>
</div>
</div>
<!-- This is the main displaying area of the site-->
<div class="main">
<?php
include ($mainPage);
?>
</div>
<!-- This sections is always the same -->
<div class="footer">
<?php include("homeFooter.php"); ?>
</div>
</body>
<script type="text/javascript" language="javascript">
window.setTimeout('reloadPage()',<?php echo $reloadTime; ?>);
</script>
</html>
A voir également:
- Problème lors de conversion Mysql a Mysqli
- Mysql community server - Télécharger - Bases de données
- Logiciel gratuit conversion calendrier républicain - Télécharger - Études & Formations
- Monnaie conversion - Télécharger - Banque & Budget
- Conversion mb en mo ✓ - Forum Bureautique
- Mysql a répondu : documentation connexion impossible : paramètres incorrects. - Forum Bases de données
5 réponses
Bonjour,
Tout d'abord ....
Je t'invite à TOUS les corriger de cette manière histoire d'alléger ton code.
Ensuite... une grande partie de ton code est illisible (pas dans les balises de code du forum ou sans indentation ! )
Je te demanderait de reposter ton code PROPREMENT en utilisant les balises de code ( ET en y précisant le langage... : Explications disponibles ici : https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code
Pense également à ajouter les lignes suivantes AU DEBUT de ton code:
et pour finir .. pour pouvoir voir les éventuelles erreurs... tu dois, le temps des tests, désactiver (les mettre en commentaire ...) les différentes REDIRECTIONS DE PAGE que tu as dans ton code.
Tout d'abord ....
//tes IF/ELSEIF .. if ($_GET['mainPage'] == "dispatchMain") { $mainPage = "dispatchMain.php"; } elseif ($_GET['mainPage'] == "shiftReportList") { $mainPage = "shiftReportList.php"; } elseif ($_GET['mainPage'] == "dailyReport") { $mainPage = "dailyReportForm.php"; } elseif ($_GET['mainPage'] == "carAssign") { $mainPage = "carAssign.php"; } elseif ($_GET['mainPage'] == "alarmReports") { $mainPage = "alarmReports.php"; } elseif ($_GET['mainPage'] == "preventiveReports") { $mainPage = "preventiveReports.php"; } elseif ($_GET['mainPage'] == "addClient") { $mainPage = "addClient.php"; } //Se résument en : $mainPage = !empty($_GET['mainPage']) ? $_GET['mainPage'].".php" : "";
Je t'invite à TOUS les corriger de cette manière histoire d'alléger ton code.
Ensuite... une grande partie de ton code est illisible (pas dans les balises de code du forum ou sans indentation ! )
Je te demanderait de reposter ton code PROPREMENT en utilisant les balises de code ( ET en y précisant le langage... : Explications disponibles ici : https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code
Pense également à ajouter les lignes suivantes AU DEBUT de ton code:
//Affichage des erreurs php error_reporting(E_ALL); ini_set('display-errors','on');
et pour finir .. pour pouvoir voir les éventuelles erreurs... tu dois, le temps des tests, désactiver (les mettre en commentaire ...) les différentes REDIRECTIONS DE PAGE que tu as dans ton code.
yg_be
Messages postés
23541
Date d'inscription
Statut
Contributeur
Dernière intervention
Ambassadeur
1 584
bonsoir,
j'imagine que ta page loggedin.php exécute l’instruction suivante:
malheureusement, tu as choisi de ne pas différencier les différentes redirections vers la page index.php.
et tu ne nous montres pas le contenu de cette page.
je te suggère de retourner un code spécifique permettant de différencier les différents appels à index.php. par exemple en passant un code d’erreur unique à index.php, et en laissant index.php afficher ce code d'erreur.
j'imagine que ta page loggedin.php exécute l’instruction suivante:
header("Location: ../index.php?flg=red&username=".$username);
malheureusement, tu as choisi de ne pas différencier les différentes redirections vers la page index.php.
et tu ne nous montres pas le contenu de cette page.
je te suggère de retourner un code spécifique permettant de différencier les différents appels à index.php. par exemple en passant un code d’erreur unique à index.php, et en laissant index.php afficher ce code d'erreur.
Je viens de trouver ce qui me manquait
Est ce que une personne peux m'aider a faire la convetion de ceci en my_sqli svp
Est ce que une personne peux m'aider a faire la convetion de ceci en my_sqli svp
$query = "SELECT * FROM user, position WHERE user.positionID = position.positionID AND logonName = '".$username."'";
mysql_pconnect($_SESSION['MYSQL_SERVER'],$_SESSION['MYSQL_LOGIN'],$_SESSION['MYSQL_PASS']) or die("Unable to connect to SQL server");
mysql_select_db($_SESSION['MYSQL_DB']) or die("Unable to select database");
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
Non ce ne sont pas ces lignes la ...
Elles sont déjà bien présentes dans ton code en mysqli...
Le message d'erreur que tu obtiens concerne la table client_user qui n'existe pas !
Donc cette parti du code :
Et en effet.. quand je regarde ton imprime écran avec la liste des tables... et bien... elle n'existe, en effet.., pas !
Elles sont déjà bien présentes dans ton code en mysqli...
Le message d'erreur que tu obtiens concerne la table client_user qui n'existe pas !
Donc cette parti du code :
$clientUserSQL = "SELECT * FROM client_user WHERE logonName = '".$username."'"; $clientUserResult = mysqli_query($con,$clientUserSQL) or die ("Invalide Query[clientUserSQL]: " . mysqli_error($con));
Et en effet.. quand je regarde ton imprime écran avec la liste des tables... et bien... elle n'existe, en effet.., pas !
[27-Mar-2017 01:41:39 Europe/Berlin] PHP Warning: mysqli_fetch_all() expects at most 2 parameters, 3 given in C:\xampp\htdocs\cad\scripts\SESSION_CONNECT.php on line 23
il me sort ce code d'erreur la j'avais mal mis une information pour que le log me sorte
Et pour le fichier SESSION_CONNECT je te le met dans la prochaine réponse pour voir si tu voit quel erreur dans le code
il me sort ce code d'erreur la j'avais mal mis une information pour que le log me sorte
Et pour le fichier SESSION_CONNECT je te le met dans la prochaine réponse pour voir si tu voit quel erreur dans le code
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
La ligne 23 ces celle la
$UserStatus = mysqli_fetch_all($getUserAccountStatusResult,0,"status.statusName");
$UserStatus = mysqli_fetch_all($getUserAccountStatusResult,0,"status.statusName");
<?php
header("Expires: Thu, 17 May 2001 10:17:17 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
session_start();
if (!isset($_SESSION['SESSION'])) require ( "session_init.php");
require_once("DB_CONNECT.php");
if ($_SESSION['LOGGEDIN'] != true)
{
header("Location: index.php");
exit;
}
else if ($_SESSION['LOGGEDIN'] == true && $_SESSION['LOGIN_TYPE'] != "client")
{
$UserID = $_SESSION['LOGED_USERID'];
$getUserAccountStatusSQL = "SELECT status.statusName FROM user INNER JOIN status ON user.statusID = status.statusID WHERE user.userID = '$UserID'";
$getUserAccountStatusResult = mysqli_query($con,$getUserAccountStatusSQL) or die ('Query[getUserAccountStatusSQL] failed: ' . mysqli_error($con));
$UserStatus = mysqli_fetch_all($getUserAccountStatusResult,0,"status.statusName");
if($UserStatus != 'Actif')
{
header("Location: index.php");
exit;
}
}
elseif ($_SESSION['LOGGEDIN'] == true && $_SESSION['LOGIN_TYPE'] == "client")
{
$ClientUserID = $_SESSION['LOGED_USERID'];
$getClientUserAccountStatusSQL = "SELECT status.statusName FROM client_user INNER JOIN status ON client_user.statusID = status.statusID WHERE client_user.clientUserID = '$ClientUserID'";
$getClientUserAccountStatusResult = mysqli_query($con,$getClientUserAccountStatusSQL) or die ('Query[getClientUserAccountStatusSQL] failed: ' . mysqli_error($con));
$ClientUserStatus = mysqli_fetch_all($getClientUserAccountStatusResult,0,"status.statusName");
if($ClientUserStatus != 'Actif')
{
header("Location: index.php");
exit;
}
}
?>
Invalide Query[clientUserSQL]: Table 'cbina.client_user' doesn't exist
et pourtant l'utilisateur existe
Le problème semble qui ne va pas lire dans la baser user
Je voudrais bien te montrer une photo de la facon donc mes table sont fait dans ma DB mais je croit qu'on peux pas