error en codigo php en log in
Publicado por Laura (1 intervención) el 24/06/2019 01:43:49
Error que sale
Notice: Undefined variable: mysqli in /storage/ssd1/396/9813396/public_html/index.php on line 10
Fatal error: Uncaught Error: Call to a member function escape_string() on null in /storage/ssd1/396/9813396/public_html/index.php:10 Stack trace: #0 /storage/ssd1/396/9813396/public_html/index.php(55): GetSQLValueString('claradiaz@gmail...', 'text') #1 {main} thrown in /storage/ssd1/396/9813396/public_html/index.php on line 10
_______________________________-
CODIGO:
Notice: Undefined variable: mysqli in /storage/ssd1/396/9813396/public_html/index.php on line 10
Fatal error: Uncaught Error: Call to a member function escape_string() on null in /storage/ssd1/396/9813396/public_html/index.php:10 Stack trace: #0 /storage/ssd1/396/9813396/public_html/index.php(55): GetSQLValueString('claradiaz@gmail...', 'text') #1 {main} thrown in /storage/ssd1/396/9813396/public_html/index.php on line 10
_______________________________-
CODIGO:
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php require_once('Connections/conn_login.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION > 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
//LINEA 10// $theValue = function_exists("mysql_real_escape_string") ? $mysqli->real_escape_string($theValue) : $mysqli->escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['Usuario'])) {
$loginUsername=$_POST['Usuario'];
$password=$_POST['Clave'];
$MM_fldUserAuthorization = "ROL_ID";
$MM_redirectLoginSuccess = "clases.php";
$MM_redirectLoginFailed = "erroringresar.php";
$MM_redirecttoReferrer = false;
$conn_login->select_db($database_conn_login);
//LINEA 55// $LoginRS__query=sprintf("SELECT USU_EMAIL from usuarios WHERE USU_EMAIL=%s",GetSQLValueString($loginUsername,"text"));
$LoginRS__query=sprintf("SELECT PASSWORD from usuarios HERE PASSWORD=%s",GetSQLValueString($password,"text"));
$LoginRS__query=sprintf("SELECT ROL_ID from usuarios");
$LoginRS = mysqli_query($conn_login,$LoginRS__query) or die(mysqli_error());
$loginFoundUser = mysqli_num_rows($LoginRS);
if ($loginFoundUser) {
$LoginRS->data_seek(0); $loginStrGroup = $LoginRS->fetch_array()['ROL_ID'];
if (PHP_VERSION >6) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sin título</title>
</head>
<body>
<form action="<?php echo $loginFormAction; ?>" method="POST" name="form1">
<table width="200" border="1">
<tr>
<td>Usuario</td>
<td><label for="Usuario"></label>
<input type="text" name="Usuario" id="Usuario"></td>
</tr>
<tr>
<td>Contraseña</td>
<td><label for="Clave"></label>
<input type="text" name="Clave" id="Clave"></td>
</tr>
<tr>
<td> </td>
<td><input name="Conectar" type="submit" value="Conectar"> </td>
</tr>
</table>
</form>
</body>
Valora esta pregunta


0