-
Notifications
You must be signed in to change notification settings - Fork 0
/
compatibility.7.0.php
99 lines (97 loc) · 2.94 KB
/
compatibility.7.0.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
<?php
// funzioni di retro compatibilità con le versioni 5.x per la versione 7.0 di php
// ver 0.1 - 23/06/2017
if(
!function_exists("mysql_pconnect") &&
!function_exists("mysql_select_db") &&
!function_exists("mysql_query") &&
!function_exists("mysql_fetch_row") &&
!function_exists("mysql_fetch_array") &&
!function_exists("mysql_fetch_assoc") &&
!function_exists("mysql_escape_string") &&
!function_exists("mysql_num_rows") &&
!function_exists("mysql_data_seek") &&
!function_exists("mysql_free_result") &&
!function_exists("mysql_close") &&
!function_exists("mysql_real_escape_string") &&
!function_exists("mysql_error") &&
!function_exists("mysql_result")
)
{
$_host = "";
$_user = "";
$_pass = "";
$_db = "";
function mysql_pconnect($host, $user, $pass, $db){
global $con, $_host, $_user, $_pass, $_db;
$_host = $host;
$_user = $user;
$_pass = $pass;
$_db = $db;
$con = mysqli_connect("p:" . $_host,$_user,$_pass,$_db);
if(mysqli_connect_errno()){
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
die(mysqli_error());
}
return $con;
}
function mysql_select_db($db, $con){
global $con, $_host, $_user, $_pass, $_db;
mysqli_select_db($con, $db);
}
function mysql_query($query, $con){
return mysqli_query($con, $query);
}
function mysql_fetch_row($result){
return mysqli_fetch_row($result);
}
function mysql_fetch_array($result){
return mysqli_fetch_array($result);
}
function mysql_fetch_assoc($result){
return mysqli_fetch_assoc($result);
}
function mysql_num_rows($result){
return mysqli_num_rows($result);
}
function mysql_data_seek($result, $num){
return mysqli_data_seek($result, $num);
}
function mysql_free_result($result){
mysqli_free_result($result);
}
function mysql_close($con){
mysqli_close($con);
}
function mysql_real_escape_string($string){
global $con;
return mysqli_real_escape_string($con, $string);
}
function mysql_error(){
global $con;
return mysqli_error($con);
}
function mysql_result($result, $row, $col){
return mysqli_result($result, $row, $col);
}
function mysql_escape_string($string){ // alias di mysql_real_escape_string
return mysql_real_escape_string($string);
}
}
if(!function_exists("mysqli_result")){
function mysqli_result($res,$row=0,$col=0){
$numrows = mysqli_num_rows($res);
if ($numrows && $row <= ($numrows-1) && $row >=0){
mysqli_data_seek($res,$row);
$resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
if (isset($resrow[$col])){
return $resrow[$col];
}
}
return false;
}
}
?>