-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchangeupdate.php
39 lines (32 loc) · 987 Bytes
/
changeupdate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include('header.php');
#$userid=isloggedin();
if ($userid)
{
$question = $_POST['question'];
$room = $_POST['room'];
if ($room==GetQuestionRoom($question))
{
$urlquery = CreateQuestionURL($question, $room);
$sql = "SELECT * FROM updates WHERE question = ".$question." AND user = ".$userid." LIMIT 1 ";
$response = mysql_query($sql);
$row = mysql_fetch_array($response);
if ($row)
{
$sql = "DELETE FROM updates WHERE updates.question = " . $question . " AND updates.user = " . $userid . " ";
if (!mysql_query($sql)) error("Database update failed");
#mysql_query($sql);
}else{
$how="asap";
$sql = 'INSERT INTO `updates` (`user`, `question`, `how`) VALUES (\'' . $userid . '\', \'' . $question . '\', \'' . $how . '\');';
if (!mysql_query($sql)) error("Database update failed");
#mysql_query($sql);
}
}
header("Location: viewquestion.php".$urlquery);
}
else
{
header("Location: login.php");
}
?>