-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbcheckProj.php
More file actions
40 lines (26 loc) · 766 Bytes
/
dbcheckProj.php
File metadata and controls
40 lines (26 loc) · 766 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
33
34
35
36
37
38
39
40
<?php
//require_once('auth.php');
require_once('config.php');
$user_id=$_POST['user_id'];
$stato=$_POST['state'];
$proj_id=$_POST['proj_id'];
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
if ($stato==0){
$query="DELETE FROM `assign` WHERE `membersID` = '".$user_id."' AND `projectID` = ".$proj_id;
$result = mysql_query($query);
}else{
$query="INSERT INTO `assign` ( `id` , `membersID` ,`projectID` , `languageID` , `name` )
VALUES ( NULL , '".$user_id."', '".$proj_id."', '0', '')";
$result = mysql_query($query);
}
mysql_close($link);
?>