
Error en PHP
Publicado por anonymous (41 intervenciones) el 12/09/2014 16:53:55
Que tal, tengo este error y 2 warnings en php, el error es el siguiente:
Strict Standards: Declaration of ezSQL_mysql::query() should be compatible with ezSQLcore::query() in /home/alsuper/public_html/proveedores/class/class_General.php on line 242
Strict Standards: Declaration of ezSQL_mysql::escape() should be compatible with ezSQLcore::escape() in /home/alsuper/public_html/proveedores/class/class_General.php on line 242
Warning: Cannot modify header information - headers already sent by (output started at /home/alsuper/public_html/proveedores/class/class_General.php:242) in /home/alsuper/public_html/proveedores/valida.php on line 47
Pienso que los warnings del principio son por funciones que estan obsoletas, mysql usa el ezSQLcore, tendre que cambiaralas por mysqli, pero el otro error es el que me llama la atencion ya que en otras pcs esta funcionando bien pero aqui no, dejo los dos codigos:
valida.php
En el siguiente post dejo Class_General.php
Strict Standards: Declaration of ezSQL_mysql::query() should be compatible with ezSQLcore::query() in /home/alsuper/public_html/proveedores/class/class_General.php on line 242
Strict Standards: Declaration of ezSQL_mysql::escape() should be compatible with ezSQLcore::escape() in /home/alsuper/public_html/proveedores/class/class_General.php on line 242
Warning: Cannot modify header information - headers already sent by (output started at /home/alsuper/public_html/proveedores/class/class_General.php:242) in /home/alsuper/public_html/proveedores/valida.php on line 47
Pienso que los warnings del principio son por funciones que estan obsoletas, mysql usa el ezSQLcore, tendre que cambiaralas por mysqli, pero el otro error es el que me llama la atencion ya que en otras pcs esta funcionando bien pero aqui no, dejo los dos codigos:
valida.php
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
<?php
session_start();
include_once "class/class_Core.php";
include_once "class/class_General.php";
$db = new ezSQL_mysql(DB_USER,DB_PASSWORD,DB_NAME,DB_HOST);
if(!empty($_POST)){
$usuario = htmlentities(trim(stripslashes($_POST['usuario'])));
$contrasena = htmlentities(trim(stripslashes($_POST['contrasena'])));
$contrasena2 = htmlentities(trim(stripslashes($_POST['contrasena'])));
$usuarioStrlen = strlen($usuario);
$contrasenaStrlen = strlen($contrasena);
if($usuarioStrlen < 20 && $contrasenaStrlen < 20){
$sqlcmd =" SELECT proveedor, contrasena, nom_banco, num_cuenta, tipo_pago
FROM proveedor
WHERE proveedor = '$usuario' AND contrasena = '$contrasena' ";
$rs = $db->get_row($sqlcmd);
$proveedor = $rs->proveedor;
$contrasena = $rs->contrasena;
$nom_banco = $rs->nom_banco;
$num_cuenta = $rs->num_cuenta;
$tipo_pago = $rs->tipo_pago;
if(empty($rs)){
$sqlcmd2 =" SELECT a.proveedor, a.usuario, a.clave, a.existencias, a.ventas, a.ordencompra,
a.cheques, a.promocontrol, b.nom_banco, b.num_cuenta, b.tipo_pago
FROM usuarios a
INNER JOIN proveedor b ON a.proveedor = b.proveedor
WHERE a.usuario = '".$usuario."' AND a.clave = '".$contrasena2."'";
$rs2 = $db->get_row($sqlcmd2);
$proveedor2 = $rs2->proveedor;
$usuario = $rs2->usuario;
$contrasena2 = $rs2->clave;
$nom_banco2 = $rs2->nom_banco;
$num_cuenta2 = $rs2->num_cuenta;
$tipo_pago2 = $rs2->tipo_pago;
$existencias = $rs2->existencias;
$ventas = $rs2->ventas;
$ordencompra = $rs2->ordencompra;
$cheques = $rs2->cheques;
$promocontrol = $rs2->promocontrol;
}
if (!empty($proveedor) && !empty($contrasena)){
$_SESSION["proveedor"] = $proveedor;
$_SESSION["contrasena"] = $contrasena;
$_SESSION["nom_banco"] = $nom_banco;
$_SESSION["num_cuenta"] = $num_cuenta;
$_SESSION["tipo_pago"] = $tipo_pago;
header("Location: agree.php");
} elseif (!empty($usuario) && !empty($contrasena2) && !empty($proveedor2)) {
$_SESSION["proveedor"] = $proveedor2;
$_SESSION["usuario"] = $usuario;
$_SESSION["clave"] = $clave;
$_SESSION["nom_banco"] = $nom_banco2;
$_SESSION["num_cuenta"] = $num_cuenta2;
$_SESSION["tipo_pago"] = $tipo_pago2;
$_SESSION["existencias"] = $existencias;
$_SESSION["ventas"] = $ventas;
$_SESSION["ordencompra"] = $ordencompra;
$_SESSION["cheques"] = $cheques;
$_SESSION["promocontrol"] = $promocontrol;
header("Location: agree.php");
} else {
$error = 'Usuario o contraseña no son validos';
header( 'Location: index.php?error=$error' );
}
} else {
$error = 'Acceso denegado1';
header( 'Location: index.php?error=$error' );
}
} else {
$error = 'Acceso denegado';
header( 'Location: index.php?error=$error' );
}
?>
En el siguiente post dejo Class_General.php
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
/**********************************************************************
*Author: Justin Vincent (jv@jvmultimedia.com)
*Web...: http://twitter.com/justinvincent
*Name..: ezSQL_mysql
*Desc..: mySQL component (part of ezSQL databse abstraction library)
*
*/
/**********************************************************************
*ezSQL error strings - mySQL
*/
// ==================================================================
// User Settings -- CHANGE HERE
define("DB_USER", "alsuper_provee1"); // <-- mysql db user
define("DB_PASSWORD", "Alsuper01"); // <-- mysql db password
define("DB_NAME", "alsuper_proveedor"); // <-- mysql db pname
define("DB_HOST", "72.249.76.230"); // <-- mysql server host
/**********************************************************************
*ezSQL Database specific class - mySQL
*/
$ezsql_mysql_str = array
(
1 => 'Require $dbuser and $dbpassword to connect to a database server',
2 => 'Error establishing mySQL database connection. Correct user/password? Correct hostname? Database server running?',
3 => 'Require $dbname to select a database',
4 => 'mySQL database connection is not active',
5 => 'Unexpected error while trying to select database'
);
if ( ! function_exists ('mysql_connect') ) die('<b>Fatal Error:</b> ezSQL_mysql requires mySQL Lib to be compiled and or linked in to the PHP engine');
if ( ! class_exists ('ezSQLcore') ) die('<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used');
class ezSQL_mysql extends ezSQLcore
{
var $dbuser = false;
var $dbpassword = false;
var $dbname = false;
var $dbhost = false;
/**********************************************************************
* Constructor - allow the user to perform a qucik connect at the
* same time as initialising the ezSQL_mysql class
*/
function ezSQL_mysql($dbuser='alsuper_provee1', $dbpassword='Alsuper01', $dbname='alsuper_proveedor', $dbhost='72.249.76.230')
{
$this->dbuser = $dbuser;
$this->dbpassword = $dbpassword;
$this->dbname = $dbname;
$this->dbhost = $dbhost;
}
/**********************************************************************
* Short hand way to connect to mySQL database server
* and select a mySQL database at the same time
*/
function quick_connect($dbuser='', $dbpassword='', $dbname='', $dbhost='localhost')
{
$return_val = false;
if ( ! $this->connect($dbuser, $dbpassword, $dbhost,true) ) ;
else if ( ! $this->select($dbname) ) ;
else $return_val = true;
return $return_val;
}
/**********************************************************************
* Try to connect to mySQL database server
*/
function connect($dbuser='', $dbpassword='', $dbhost='localhost')
{
global $ezsql_mysql_str; $return_val = false;
// Must have a user and a password
if ( ! $dbuser )
{
$this->register_error($ezsql_mysql_str[1].' in '.__FILE__.' on line '.__LINE__);
$this->show_errors ? trigger_error($ezsql_mysql_str[1],E_USER_WARNING) : null;
}
// Try to establish the server database handle
else if ( ! $this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword,true) )
{
$this->register_error($ezsql_mysql_str[2].' in '.__FILE__.' on line '.__LINE__);
$this->show_errors ? trigger_error($ezsql_mysql_str[2],E_USER_WARNING) : null;
}
else
{
$this->dbuser = $dbuser;
$this->dbpassword = $dbpassword;
$this->dbhost = $dbhost;
$return_val = true;
}
return $return_val;
}
/**********************************************************************
* Try to select a mySQL database
*/
function select($dbname='')
{
global $ezsql_mysql_str; $return_val = false;
// Must have a database name
if ( ! $dbname )
{
$this->register_error($ezsql_mysql_str[3].' in '.__FILE__.' on line '.__LINE__);
$this->show_errors ? trigger_error($ezsql_mysql_str[3],E_USER_WARNING) : null;
}
// Must have an active database connection
else if ( ! $this->dbh )
{
$this->register_error($ezsql_mysql_str[4].' in '.__FILE__.' on line '.__LINE__);
$this->show_errors ? trigger_error($ezsql_mysql_str[4],E_USER_WARNING) : null;
}
// Try to connect to the database
else if ( !@mysql_select_db($dbname,$this->dbh))
{
// Try to get error supplied by mysql if not use our own
if ( !$str = @mysql_error($this->dbh))
$str = $ezsql_mysql_str[5];
$this->register_error($str.' in '.__FILE__.' on line '.__LINE__);
$this->show_errors ? trigger_error($str,E_USER_WARNING) : null;
}
else
{
$this->dbname = $dbname;
$return_val = true;
}
return $return_val;
}
/**********************************************************************
* Format a mySQL string correctly for safe mySQL insert
* (no mater if magic quotes are on or not)
*/
function escape($str)
{
return mysql_escape_string(stripslashes($str));
}
/**********************************************************************
* Return mySQL specific system date syntax
* i.e. Oracle: SYSDATE Mysql: NOW()
*/
function sysdate()
{
return 'NOW()';
}
/**********************************************************************
* Perform mySQL query and try to detirmin result value
*/
function query($query)
{
// Initialise return
$return_val = 0;
// Flush cached values..
$this->flush();
// For reg expressions
$query = trim($query);
// Log how the function was called
$this->func_call = "\$db->query(\"$query\")";
// Keep track of the last query for debug..
$this->last_query = $query;
// Count how many queries there have been
$this->num_queries++;
// Use core file cache function
if ( $cache = $this->get_cache($query) )
{
return $cache;
}
// If there is no existing database connection then try to connect
if ( ! isset($this->dbh) || ! $this->dbh )
{
$this->connect($this->dbuser, $this->dbpassword, $this->dbhost);
$this->select($this->dbname);
}
// Perform the query via std mysql_query function..
$this->result = @mysql_query($query,$this->dbh);
// If there is an error then take note of it..
if ( $str = @mysql_error($this->dbh) )
{
$is_insert = true;
$this->register_error($str);
$this->show_errors ? trigger_error($str,E_USER_WARNING) : null;
return false;
}
// Query was an insert, delete, update, replace
$is_insert = false;
if ( preg_match("/^(insert|delete|update|replace)\s+/i",$query) )
{
$this->rows_affected = @mysql_affected_rows();
// Take note of the insert_id
if ( preg_match("/^(insert|replace)\s+/i",$query) )
{
$this->insert_id = @mysql_insert_id($this->dbh);
}
// Return number fo rows affected
$return_val = $this->rows_affected;
}
// Query was a select
else
{
// Take note of column info
$i=0;
while ($i < @mysql_num_fields($this->result))
{
$this->col_info[$i] = @mysql_fetch_field($this->result);
$i++;
}
// Store Query Results
$num_rows=0;
while ( $row = @mysql_fetch_object($this->result) )
{
// Store relults as an objects within main array
$this->last_result[$num_rows] = $row;
$num_rows++;
}
@mysql_free_result($this->result);
// Log number of rows the query returned
$this->num_rows = $num_rows;
// Return number of rows selected
$return_val = $this->num_rows;
}
// disk caching of queries
$this->store_cache($query,$is_insert);
// If debug ALL queries
$this->trace || $this->debug_all ? $this->debug() : null ;
return $return_val;
}
function limpiarpost() {
foreach ($_POST as $p=>$d) {
if(is_array($d)) {
continue;
}
$_POST[$p]=addslashes(strip_tags($d));
}
}
function alerta($tipo,$mensaje) {
switch($tipo) {
case "bien":
echo "
<div class='alert success'>$mensaje</div>
";
break;
case "error":
echo "
<div class='alert warning'>$mensaje</div>
";
break;
default:
return false;
}
}
}
?>
Valora esta pregunta


0