-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparticipate.php
More file actions
32 lines (24 loc) · 861 Bytes
/
participate.php
File metadata and controls
32 lines (24 loc) · 861 Bytes
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
<?php
//enable this when finished
//error_reporting(0);
session_start();
if (file_exists('config.php')) {
include('config.php');
}
else {
include('../../config.php');
}
$conn = mysql_connect($sqlHost, $sqlUser, $sqlPass) or die("Can't connect to host : " . mysql_error());
$db = mysql_select_db($sqlDatabase, $conn) or die("Can't database to database: " . mysql_error());
$error = "";
// [insert code here to check if owner of post is = userid of session]
$post_id= $_POST['post_id'];
$userID = $_SESSION['login_user'];
$post_id = stripslashes($post_id);
$post_id = mysql_real_escape_string($post_id);
$userID = stripslashes($userID);
$userID = mysql_real_escape_string($userID);
$sql = "INSERT INTO Participants Values(".$post_id.", ".$userID.")";
$execute = mysql_query($sql, $conn) or die($sql . " : " . mysql_error());
mysql_close($conn);
?>