Commit 8529af72 authored by Benjamin Sonntag's avatar Benjamin Sonntag

fixing disable/destroy cron, not using

parent d7b71780
...@@ -62,11 +62,14 @@ while ($c=mysql_fetch_array($r)) { ...@@ -62,11 +62,14 @@ while ($c=mysql_fetch_array($r)) {
$random=md5(rand().rand().rand()); $random=md5(rand().rand().rand());
echo "Changing password for user ".$c["jabberid"]."\n"; echo "Changing password for user ".$c["jabberid"]."\n";
fputs($f,'user:password("'.$c["jabberid"].'@'.$domain.'","'.$random."\")\n"); $cmd='user:password("'.$c["jabberid"].'","'.$random."\")\n";
if ($debug) echo "launching command:$cmd\n";
fputs($f,$cmd);
$s=fgets($f,1024); $s=fgets($f,1024);
if ($debug) echo ":".$s.":<br>"; if ($debug) echo ":".$s.":<br>";
if (trim($s)=="| OK: User password changed") { if (trim($s)=="| OK: User password changed") {
mysql_query("UPDATE accounts SET disabledate=NOW() WHERE jabberid='".addslashes($c["jabberid"]."@".$domain)."';"); mysql_query("UPDATE accounts SET disabledate=NOW() WHERE jabberid='".addslashes($c["jabberid"])."';");
echo mysql_error();
echo "Disabled account ".$c["jabberid"]."\n"; echo "Disabled account ".$c["jabberid"]."\n";
} else { } else {
if ($debug) { $s=fgets($f,1024); echo ":".$s.":<br>"; } if ($debug) { $s=fgets($f,1024); echo ":".$s.":<br>"; }
...@@ -106,11 +109,11 @@ while ($c=mysql_fetch_array($r)) { ...@@ -106,11 +109,11 @@ while ($c=mysql_fetch_array($r)) {
} }
echo "Deleting user ".$c["jabberid"]."\n"; echo "Deleting user ".$c["jabberid"]."\n";
fputs($f,'user:delete("'.$c["jabberid"].'@'.$domain.'"'.")\n"); fputs($f,'user:delete("'.$c["jabberid"].'"'.")\n");
$s=fgets($f,1024); $s=fgets($f,1024);
if ($debug) echo ":".$s.":<br>"; if ($debug) echo ":".$s.":<br>";
if (trim($s)=="| OK: User deleted") { if (trim($s)=="| OK: User deleted") {
mysql_query("DELETE FROM accounts WHERE jabberid='".addslashes($c["jabberid"]."@".$domain)."';"); mysql_query("DELETE FROM accounts WHERE jabberid='".addslashes($c["jabberid"])."';");
echo "Destroyed account ".$c["jabberid"]."\n"; echo "Destroyed account ".$c["jabberid"]."\n";
} else { } else {
if ($debug) { $s=fgets($f,1024); echo ":".$s.":<br>"; } if ($debug) { $s=fgets($f,1024); echo ":".$s.":<br>"; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment