我需要一些关于我的阻止用户脚本的帮助。我试图让它插入值,然后将被阻止的列从“0”设置为“1”。
它可以很好地插入值,我的意思是它在没有问题的情况下插入了 user_id 和 blocked_id,但是当我尝试将其从“0”设置为“1”时,它会导致我的语法错误。
谁能告诉我我哪里出错了,谢谢。
代码:
<?php
require_once('includes/session.php');
require_once('includes/functions.php');
require('includes/_config/connection.php');
session_start();
confirm_logged_in();
if (isset ($_GET['to'])) {
$user_to_id = $_GET['to'];
}
if (!isset($_GET['to']))
exit('No user specified.');
$user_id = $_GET['to'];
$result1 = mysql_query("INSERT INTO ptb_block_user (user_id, blocked_id) VALUES (".$_SESSION['user_id'].", ".$user_to_id.")")
$result2 = mysql_query("SELECT ptb_block_user SET blocked='1' WHERE id=".$_SESSION['user_id']."")
or $result3 = mysql_query("DELETE FROM ptb_block_user WHERE user_id = ".$_SESSION['user_id']." AND blocked_id = ".$user_to_id.""); header("Location: {$_SERVER['HTTP_REFERER']}");
if($result1)
{
$_SESSION['message2']="<div class=\"infobox-profile\"><strong>User Blocked</strong> - This user has successfully been blocked. You will no longer be abler to interact with each other's profiles.</div><div class=\"infobox-close\"></div>";
header("Location: {$_SERVER['HTTP_REFERER']}");
}
else
if($result3)
{
$_SESSION['message2']="<div class=\"infobox-favourites\"><strong>User Unblocked</strong> - This user has successfully been unblocked. You can now interact with each other's profiles.</div><div class=\"infobox-close4\"></div>";
header("Location: {$_SERVER['HTTP_REFERER']}");
}
?>