После проверки кода на безопасность
This commit is contained in:
@ -102,20 +102,24 @@ function getAccess($key)
|
||||
global $db;
|
||||
|
||||
$result=false;
|
||||
$sql="select main.p_getaccess(:user_id,:key) as acc;";
|
||||
$stmt = $db->prepare($sql);
|
||||
if(isset($_SESSION['USER_ID']))
|
||||
$sql="select main.p_getaccess(".$_SESSION['USER_ID'].",'".$key."') as acc;";
|
||||
$stmt->bindValue(':user_id', $_SESSION['USER_ID'], PDO::PARAM_INT);
|
||||
else
|
||||
$sql="select main.p_getaccess(0,'".$key."') as acc;";
|
||||
$stmt->bindValue(':user_id', 0, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':key', $key, PDO::PARAM_STR);
|
||||
$res=null;
|
||||
try
|
||||
{
|
||||
$res = $db->query($sql);
|
||||
$res=$stmt->execute();
|
||||
}catch (Exception $e)
|
||||
{
|
||||
echo $e->getMessage();
|
||||
}
|
||||
if($res!=NULL && $res->rowCount()>0)
|
||||
if($res && $stmt->rowCount()>0)
|
||||
{
|
||||
while ($row = $res->fetch(PDO::FETCH_NUM))
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM))
|
||||
{
|
||||
$result=$row[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user