-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
121 lines (88 loc) · 3.37 KB
/
index.php
File metadata and controls
121 lines (88 loc) · 3.37 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html>
<header>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<body>
<h1>Jokes Page</h1>
<!-- <a href="logout.php">Click here to log out<a>
<a href="login_form.php">Click here to login<a>
<a href="register_new_user.php">Click here to register<a><br> -->
<?php
$redirect_uri = 'http://localhost:8888/Jokes_Website/google_login.php';
echo "<p><a href='" .$redirect_uri. "?logout=1'>Log Out</a></p>";
// Connect
include "db_connect.php";
// Form
?>
<form class="form-horizontal" action="search_keyword.php">
<fieldset>
<!-- Form Name -->
<legend>Search for keyword</legend>
<!-- Search input-->
<div class="form-group">
<label class="col-md-4 control-label" for="keyword">Search Input</label>
<div class="col-md-8">
<input id="keyword" name="keyword" type="search" placeholder="e.g. chicken" class="form-control input-md">
<p class="help-block">Enter a word to search for in the jokes database</p>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4">
<button id="submit" name="submit" class="btn btn-info">Search</button>
</div>
</div>
</fieldset>
</form>
<?php
session_start();
if(isset($_SESSION['userid'])):
?>
<hr>
<form action="add_joke.php" method="get" class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Add new joke</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="newjoke">Enter the text of your new joke</label>
<div class="col-md-8">
<input id="newjoke" name="newjoke" type="text" placeholder="" class="form-control input-md">
<span class="help-block">Enter the first half of your joke</span>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="jokeanswer">Enter the answer to your joke</label>
<div class="col-md-6">
<input id="jokeanswer" name="jokeanswer" type="text" placeholder="" class="form-control input-md">
<span class="help-block">Enter the second half or punchline to your joke</span>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="add"></label>
<div class="col-md-4">
<button id="add" name="add" class="btn btn-success">Add Joke</button>
</div>
</div>
</fieldset>
</form>
<?php else: ?>
<div align="center">
<h3>Login</h3>
<div>You will need a Google account to add a new joke.</div>
<a href="google_login.php">Login here</a>
</div>
<?php endif; ?>
<?php
$mysqli->close();
?>
</body>
</header>
</html>