Bonsoir,
Je galère depuis 1H pour modifier mon code, en degageant MYSQL au profit de MYSQLI et il semblerait que les fichiers include ou inquire me posent des problemes.
Fichier conx.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <?php function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $Date_start = getmicrotime(); $DBhost = "xxxx"; $DBowner = "xxxxx"; $DBpw = "xxxxxx"; $DBName = $DBowner; $mysqli = new mysqli($DBhost, $DBowner, $DBpw, $DBName); $suff_table="extra2_";
config.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 <?php $mysqli->real_query("SELECT * FROM `".$suff_table."config` where idC='1'"); // Requête $res = $mysqli->use_result(); while ($cl = $res->fetch_assoc()){ ....... $base_site='http://'.$url_index.'/'.$rep_extranet.'/accueil.php'; $base_site_err='http://'.$url_index.'/'.$rep_extranet.'/'; } function enleveaccents($chaine, $charset='utf-8') { $chaine = htmlentities($chaine, ENT_NOQUOTES, $charset); $chaine = preg_replace('#&([A-za-z])(?:acute|cedil|caron|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $chaine); $chaine = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $chaine); // pour les ligatures e.g. 'œ' $chaine = preg_replace('#&[^;]+;#', '', $chaine); // supprime les autres caract�res $chaine=str_replace(' ','-',$chaine); return $chaine; } function enleveaccents_0($chaine){$chaine = htmlentities($chaine, ENT_NOQUOTES, "UTF-8"); if ( !function_exists('htmlspecialchars_decode')){function htmlspecialchars_decode($chaine){return strtr($chaine, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));}}return $chaine;} function enleveaccents_1($str, $charset='utf-8') { $url = $str; $url = preg_replace("#'#", "_", $url); $url = preg_replace("# #", "_", $url); $url = preg_replace('#Ç#', 'C', $url); $url = preg_replace('#ç#', 'c', $url); $url = preg_replace('#è|é|ê|ë#', 'e', $url); $url = preg_replace('#È|É|Ê|Ë#', 'E', $url); $url = preg_replace('#à|á|â|ã|ä|å#', 'a', $url); $url = preg_replace('#@|À|Á|Â|Ã|Ä|Å#', 'A', $url); $url = preg_replace('#ì|í|î|ï#', 'i', $url); $url = preg_replace('#Ì|Í|Î|Ï#', 'I', $url); $url = preg_replace('#ð|ò|ó|ô|õ|ö#', 'o', $url); $url = preg_replace('#Ò|Ó|Ô|Õ|Ö#', 'O', $url); $url = preg_replace('#ù|ú|û|ü#', 'u', $url); $url = preg_replace('#Ù|Ú|Û|Ü#', 'U', $url); $url = preg_replace('#ý|ÿ#', 'y', $url); $url = preg_replace('#Ý#', 'Y', $url); $url = stripslashes($url); return ($url); } function enleveaccents_2($str, $charset='utf-8') { $url = $str; $url = preg_replace('#Ç#', 'C', $url); $url = preg_replace('#ç#', 'c', $url); $url = preg_replace('#è|é|ê|ë#', 'e', $url); $url = preg_replace('#È|É|Ê|Ë#', 'E', $url); $url = preg_replace('#à|á|â|ã|ä|å#', 'a', $url); $url = preg_replace('#@|À|Á|Â|Ã|Ä|Å#', 'A', $url); $url = preg_replace('#ì|í|î|ï#', 'i', $url); $url = preg_replace('#Ì|Í|Î|Ï#', 'I', $url); $url = preg_replace('#ð|ò|ó|ô|õ|ö#', 'o', $url); $url = preg_replace('#Ò|Ó|Ô|Õ|Ö#', 'O', $url); $url = preg_replace('#ù|ú|û|ü#', 'u', $url); $url = preg_replace('#Ù|Ú|Û|Ü#', 'U', $url); $url = preg_replace('#ý|ÿ#', 'y', $url); $url = preg_replace('#Ý#', 'Y', $url); return ($url); } function code($txt) { $txt = htmlentities($txt, ENT_QUOTES, "UTF-8"); $txt = preg_replace('`\<b>(.+)\</b>`isU', '<b>$1</b>', $txt); $txt = preg_replace('`\<b style="color:red">(.+)\</b>`isU', '<b style="color:red">$1</b>', $txt); $txt = preg_replace('`\<b style="color:green">(.+)\</b>`isU', '<b style="color:green">$1</b>', $txt); $txt = preg_replace('`\<b style="color:blue">(.+)\</b>`isU', '<b style="color:blue">$1</b>', $txt); $txt = preg_replace('`\<p>(.+)\</p>`isU', '<p>$1</p>', $txt); $txt = preg_replace('`\<ul>(.+)\</ul>`isU', '<ul>$1</ul>', $txt); $txt = preg_replace('`\<li>(.+)\</li>`isU', '<li>$1</li>', $txt); $txt = preg_replace('`\<i>(.+)\</i>`isU', '<i>$1</i>', $txt); $txt = preg_replace('`\<u>(.+)\</u>`isU', '<u>$1</u>', $txt); $txt = preg_replace('`\<div style="clear:both"></div>`isU', '<div style="clear:both"></div>', $txt); $txt = preg_replace('`\<img src="(.+)\" alt="(.+)\" style="float:left; margin:0 5px 5px 0">`isU', '<img src="$1" alt="$2" style="float:left; margin:0 5px 5px 0">', $txt); $txt = preg_replace('`\<strike>(.+)\</strike>`isU', '<strike>$1</strike>', $txt); $txt = preg_replace('`<a href="(.+)\">(.+)\</a>`isU', '<a href="$1">$2</a>', $txt); $txt = preg_replace('`<a href="(.+)\" target="_blank\">(.+)\</a>`isU', '<a href="$1" target="_blank">$2</a>', $txt); return $txt; } $copysimple ='<div class="copyright">2014 - 2016 © IOBnet.com - Extranet V15. </div>';
session.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 <?php if (($_GET['action'] == 'logout')) { $utlog=$_GET['utlog']; $date_compare = strtotime(date("Y-m-d")); $date_con = strtotime(date("Y-m-d H:i:s")); $mysqli->real_query("SELECT * FROM `".$suff_table."journal` where idUT='$utlog' and date='$date_compare' and connexion<>''"); $res = $mysqli->use_result(); $nbres=mysql_num_rows($res); if ($nbres<>"0"){$mysqli->query("UPDATE `".$suff_table."journal` SET `deconnexion` = '$date_con' where idUT='$utlog' and date='$date_compare' and connexion<>''");} $_SESSION = array(); session_destroy(); header('Location: '.$base_site_err); } if (($_GET['action'] <> 'logout')) { if (isset($_POST) && (!empty($_POST['username'])) && (!empty($_POST['password']))) { extract($_POST); $cmail = (isset($_POST['username'])) ? $_POST['username'] : ''; $cpass = (isset($_POST['password'])) ? $_POST['password'] : ''; $cpass=md5($cpass); } else { $cmail = $_SESSION['username']; $cpass = $_SESSION['password']; } $mailOK= false; if ($cmail<>'') { $mysqli->real_query("SELECT * FROM `".$suff_table."utilisateur` where a_mail='$cmail' or a_pseudo='$cmail'"); $req = $mysqli->use_result(); $nbcon=mysql_num_rows($req); if ($nbcon =="1") { $data = mysql_fetch_assoc($req); $idUT=$data['idUT']; $passdata=$data['a_pass']; if ($cpass==$passdata and $data['a_acc']=="1") { if($data['a_pseudo']==""){$_SESSION['username'] = $data['a_mail'];}else {$_SESSION['username'] = $data['a_pseudo'];} $_SESSION['password'] = $data['a_pass']; $mailOK = true; $mysqli->query("UPDATE `".$suff_table."utilisateur` SET `a_ip` = '$ip' where idUT='$idUT'"); $MB_ip=$data['ip']; $mysqli->query("UPDATE extra_utilisateur SET a_dateconx='".strtotime(date("Y-m-d H:i:s"))."' where idUT='$idUT'"); $MB_mail=$data['a_mail']; $MB_pass=$data['a_pass']; $MB_pseudo=$data['a_pseudo']; ..... $connexion="ok"; if ($MB_idUT<>$id_iobnet) { $date_compare = strtotime(date("Y-m-d")); $date_con = strtotime(date("Y-m-d H:i:s")); $mysqli->real_query("SELECT * FROM `".$suff_table."journal` where idUT='$MB_idUT' and date='$date_compare' and connexion<>''"); $res = $mysqli->use_result(); $nbres=mysql_num_rows($res); if ($nbres=="0"){$mysqli->query("INSERT INTO `".$suff_table."journal` (idUT, date, connexion,ip) VALUES ('$MB_idUT', '$date_compare', '$date_con', '$ip')");} } } if ($cpass<>$passdata) {header('Location: '.$base_site_err.'?error=error');} if ($data['a_acc']=='0') {header('Location: '.$base_site_err.'?error=comptesupprime');} } else {header('Location: '.$base_site); } } else {header('Location: '.$base_site_err);} } ?>
et enfin ma page qui ne veut pas s'ouvrir a cause des include ou require
accueil.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <?php session_start(); include ('conx.php'); include ('config.php'); include ('session.php'); $toto=@$_GET['toto']; header('Content-Type: text/html; charset=UTF-8'); extract($_POST); include ('menu.php');
Alors que menu.php appelle aussi une fonction mysqli :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 <?php session_start(); include ('session.php'); $mysqli->query("SELECT * FROM `".$suff_table."dem_com` where toto='$toto"); $com = $mysqli->use_result(); $nb_com =mysql_num_rows($com); echo $nb_com;
En conclusion a cause du fichier menu.php, la page accueil.php ne s'affiche pas completement, il semblerait que la page bloque au niveau de l'appel de l'include.
Il ne faut pas quand meme que je rappel le fichier conx.php dans tous les include et require quand meme ?
Merci pour toute votre aide et si le code ci-dessous est pourri n'hesitait pas, j'ai besoin d'optimiser et de progresser.
Bonne soirée a tous
Guillaume
Partager