-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinvite_user.php
119 lines (49 loc) · 1.74 KB
/
invite_user.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
session_start();
if(!(isset($_SESSION["username"]) && isset($_SESSION["id"]))){
$newURL = "login.php?e=3";
header('Location: '.$newURL);
};
$servername = "localhost";
$username = "stellaa2_costory";
$password = "CSO%YvAwSsTX";
$dbname = "stellaa2_costroy";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$story_id = $_GET["i"];
$sql2 = "SELECT name FROM stories WHERE id = '$story_id'";
$result2 = $conn->query($sql2);
$row2 = $result2->fetch_assoc();
$story_name = $row2["name"];
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<?php echo "<h4>Co Story . $story_name . Invite User</h4>" ;
echo "<a href=\"story_index.php?i=$story_id\">back to story</a>";
?>
<a href="index.php">index</a><br><br>
<form action="invite_control.php" method="post">
invite people:<br>
<input type="text" name="user_name" placeholder="user name">
<input type="hidden" name="story_id" value = "<?php echo $story_id ?>">
<br><br>
<input type="submit" value="invite">
</form>
<?php
if ($_GET["e"] == 1) {echo "<br><b> only admin can invite on this story </b>";}
else if ($_GET["e"] == 2) {echo "<br><b> you are not a writer of this story </b>";}
else if ($_GET["e"] == 3) {echo "<br><b> err3 </b>";}
else if ($_GET["e"] == 4) {echo "<br><b> you invited user sucsesfully </b>";}
else if ($_GET["e"] == 5) {echo "<br><b> there is no user that has this name </b>";}
?>
</body>
</html>