Change function calls from mysql_* to mysqli_*
Sourced from: https://raw.githubusercontent.com/soul9/AlternC/470ed9cd1535461c7a809ce6c8d55919b76f14a0/stretch/quota_init.diff @see https://github.com/AlternC/AlternC/issues/222
This commit is contained in:
parent
177d76bd85
commit
29a213cc26
|
@ -23,37 +23,39 @@ $quota=$argv[2];
|
|||
|
||||
include("/usr/share/alternc/panel/class/local.php");
|
||||
|
||||
if (!mysql_connect($L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD)) {
|
||||
if (!mysqli_connect($L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD)) {
|
||||
echo "Cannot connect to Mysql !\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!mysql_select_db($L_MYSQL_DATABASE)) {
|
||||
$co = mysqli_connect($L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD);
|
||||
|
||||
if (!mysqli_select_db($co, $L_MYSQL_DATABASE)) {
|
||||
echo "Cannot connect to Mysql database $L_MYSQL_DATABASE !\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
$r=mysql_query("DELETE FROM defquotas WHERE quota='$name';");
|
||||
if (mysql_errno()) {
|
||||
echo "Mysql Error : ".mysql_error()."\n";
|
||||
$r=mysqli_query($co, "DELETE FROM defquotas WHERE quota='$name';");
|
||||
if (mysqli_errno($co)) {
|
||||
echo "Mysql Error : ".mysqli_error($co)."\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
$r=mysql_query("INSERT INTO defquotas (quota,value) VALUES ('$name','$quota');");
|
||||
if (mysql_errno()) {
|
||||
echo "Mysql Error : ".mysql_error()."\n";
|
||||
$r=mysqli_query($co, "INSERT INTO defquotas (quota,value) VALUES ('$name','$quota');");
|
||||
if (mysqli_errno($co)) {
|
||||
echo "Mysql Error : ".mysqli_error($co)."\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
$r=mysql_query("SELECT uid FROM membres;");
|
||||
if (mysql_errno()) {
|
||||
echo "Mysql Error : ".mysql_error()."\n";
|
||||
$r=mysqli_query($co, "SELECT uid FROM membres;");
|
||||
if (mysqli_errno($co)) {
|
||||
echo "Mysql Error : ".mysqli_error($co)."\n";
|
||||
return 1;
|
||||
}
|
||||
while ($c=mysql_fetch_array($r)) {
|
||||
$s=mysql_query("SELECT name FROM quotas WHERE uid='$c[uid]' AND name='$name';");
|
||||
if (!mysql_num_rows($s)) {
|
||||
mysql_query("INSERT INTO quotas (uid,name,total) VALUES ('$c[uid]','$name','$quota') on DUPLICATE KEY UPDATE total=$quota;");
|
||||
while ($c=mysqli_fetch_array($r)) {
|
||||
$s=mysqli_query("SELECT name FROM quotas WHERE uid='$c[uid]' AND name='$name';");
|
||||
if (!mysqli_num_rows($s)) {
|
||||
mysqli_query("INSERT INTO quotas (uid,name,total) VALUES ('$c[uid]','$name','$quota') on DUPLICATE KEY UPDATE total=$quota;");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue