+ Подробные коменты в не [[]]
This commit is contained in:
@ -436,7 +436,8 @@
|
||||
}
|
||||
|
||||
$xmlstring='<?xml version="1.0" encoding="utf-8"?><metadata fn="1"><type n="'.$typename.'" id="'.$result[0].'"></type></metadata>';
|
||||
header('Content-type: text/xml');
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xmlstring;
|
||||
Exit();
|
||||
}else
|
||||
@ -545,7 +546,8 @@
|
||||
$result = $stmt->fetch(PDO::FETCH_NUM); //$obj_id
|
||||
if($result[0]==''){ $result[0]=$obj_id; }
|
||||
$xmlstring='<?xml version="1.0" encoding="utf-8"?><metadata fn="2"><type n="'.$typename.'" id="'.$result[0].'"></type></metadata>';
|
||||
header('Content-type: text/xml');
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xmlstring;
|
||||
Exit();
|
||||
}else
|
||||
@ -583,7 +585,8 @@
|
||||
$xmlstring.='<metadata fn="3">';
|
||||
$xmlstring.=" <type n=\"".$typename."\" id=\"".$obj_id."\"></type>\n";
|
||||
$xmlstring.="</metadata>\n";
|
||||
header('Content-type: text/xml');
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xmlstring;
|
||||
Exit();
|
||||
}else
|
||||
@ -920,11 +923,62 @@
|
||||
|
||||
if($cmd==0) //Restore password by email
|
||||
{
|
||||
$res = $db->query("select 1 from '.$Schema.'_Users where del=false and email = '$login';");
|
||||
$recovery=false;
|
||||
$res = $db->query("select email from ".$Schema."_Users where del=false and (email = '$login' or login = '$login');");
|
||||
if($res->rowCount()>0)
|
||||
{
|
||||
mail($login,'rigor.kz','Not implement',"Content-type: text/html; charset=utf-8\r\nFrom: rigor Site <info@rigor.kz>");
|
||||
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
|
||||
/*$pos++;
|
||||
if (($pagepos!=-1)&&(($pos<($pagepos*$rowspagecount))||($pos>=$pagepos*$rowspagecount+$rowspagecount))) { continue; }
|
||||
|
||||
//разрешать или запрещять редактировать запись надо проверять в хранимке а также запрещять либо разрешать редактировать колонку
|
||||
//для каждой записи формируеться строка настроек со значениями что нужно запретить в таком виде "iuds"
|
||||
//$access=$row["access"];
|
||||
$access=''; //u = enable update field, d = enable delete field
|
||||
if(!array_key_exists("_u",$row)) { $access.="u"; } else { $access.=$row["email"]; }*/
|
||||
|
||||
$password = getPassword(6);
|
||||
$sql = 'update ' . $Schema . '_users set password=md5(:password) where email=:email';
|
||||
$stmt = $db->prepare($sql);
|
||||
$stmt->bindValue(':password', $password, PDO::PARAM_STR);
|
||||
$stmt->bindValue(':email', $row["email"], PDO::PARAM_STR);
|
||||
try {
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
//$result = $stmt->fetch(PDO::FETCH_NUM);
|
||||
$recovery = true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$db->rollBack();
|
||||
sendError(1, $e->getMessage());
|
||||
}
|
||||
|
||||
$html = '<html><head><title>Message</title></head><body>';
|
||||
$html .= '<h1>New password:</h1>';
|
||||
$html .= '<b>' . $password . '</b>';
|
||||
$html .= '</body></html>';
|
||||
//mail($login,'rigor.kz','Not implement',"Content-type: text/html; charset=utf-8\r\nFrom: rigor Site <info@rigor.kz>");
|
||||
if (!mail($login, 'Password for transit.istt.kz', $html, "Content-type: text/html; charset=utf-8\r\nFrom: Transit Site <no-reply@istt.kz>")) {
|
||||
sendError("Failed to send mail to: " . $row["email"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($recovery) {
|
||||
$xs = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
||||
$xs .= '<metadata fn="7"><![CDATA[OK]]></metadata>';
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xs;
|
||||
exit();
|
||||
}else{
|
||||
$xs = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
||||
$xs .= '<metadata fn="7"><![CDATA[ERROR]]></metadata>';
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xs;
|
||||
exit();
|
||||
}
|
||||
|
||||
}elseif($cmd==1) //Logout
|
||||
{
|
||||
$sql='delete from '.$Schema.'_Logins where sessionid='.getSQLValue('string',$_COOKIE['GUID']).' and user_id='.getSQLValue('object',$_SESSION['USER_ID']).';';
|
||||
@ -935,21 +989,17 @@
|
||||
}
|
||||
unset($_SESSION['USER_ID']);
|
||||
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
|
||||
$xs='<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
$xs.='<metadata fn="7">'."\n";
|
||||
$xs.=' <cmd><![CDATA['.$cmd.']]></cmd><login><![CDATA[0]]></login><sesid><![CDATA['.session_id().']]></sesid><sesname><![CDATA['.session_name().']]></sesname>'."\n";
|
||||
$xs.='</metadata>';
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xs;
|
||||
exit();
|
||||
|
||||
}elseif($cmd==2) //Проверить залогинен ли пользователь
|
||||
{
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
|
||||
$xs='<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
$xs.='<metadata fn="7">'."\n";
|
||||
if(!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID']=='')
|
||||
@ -969,6 +1019,8 @@
|
||||
}
|
||||
$xs.='</metadata>';
|
||||
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xs;
|
||||
exit();
|
||||
|
||||
@ -990,8 +1042,6 @@
|
||||
$patronymic=$result['patronymic'];
|
||||
|
||||
}
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
$xs='<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
$xs.='<metadata fn="7">'."\n";
|
||||
$xs.='<![CDATA['.$ans.']]>';
|
||||
@ -1001,6 +1051,8 @@
|
||||
$xs.=' <sesid><![CDATA['.session_id().']]></sesid>'."\n";
|
||||
$xs.=' <sesname><![CDATA['.session_name().']]></sesname>'."\n";
|
||||
$xs.='</metadata>';
|
||||
header('Content-type: text/xml');
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
echo $xs;
|
||||
exit();
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user