-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
108 lines (97 loc) · 2.58 KB
/
index.php
File metadata and controls
108 lines (97 loc) · 2.58 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
<?php
require_once('dbconnect.php');
$should_submit = $_GET['s'];
$display_quote = $_GET['q'];
$specific_quote = $_GET['quote'];
$one_quote = false;
if (isset($specific_quote)) $one_quote = true;
function get_specific($s) {
$query = mysql_query("select * from quotes where id=$s");
$quote = mysql_fetch_array($query);
echo $quote['quote'].'<br><span class="author">'.$quote['author'].'</span></br><span><a class="num" href="./?quote='.($s + 1).'">next</a><a class="num" href=".">random</a></span>';
}
$submit = false;
if ($should_submit == 'q') $submit = true;
function get_quote() {
$query = mysql_query("select count(id) from quotes");
$quotecount = mysql_fetch_array($query);
$quote = rand(1, $quotecount[0]);
$query2 = mysql_query("select quote, author from quotes where id= $quote");
$actualquote = mysql_fetch_array($query2);
echo $actualquote['quote'].'<br><span class="author">'.$actualquote['author'].'</span></br><span><a class="num" href="./?quote='.$quote.'">'.$quote.'</a></span>';
}
/* COOKIE MONSTER */
?>
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Lora' rel='stylesheet' type='text/css'>
<style>
body {
margin:50px 0px;
padding:100px;
text-align:center;
}
.container {
margin:0px auto;
border:3px solid #001010;
padding:20px;
text-align:center;
background-color:#eee;
-moz-box-shadow: 1px 1px 500px #fff;
-webkit-box-shadow: 1px 1px 500px #fff;
box-shadow: 1px 1px 500px #fff;
}
.quote {
font-size:32px;
color:black;
font-family:'Lora', serif;
}
.submit {
color:black;
font-size:32px;
font-family:'Lora', serif;
}
.author {
color:#666;
font-size:18px;
font-family:'Lora', serif;
}
.num {
padding:20px;
}
input {
height:25px;
font-size:20px;
width:200px;
}
a {
color:white;
text-decoration:none;
}
</style>
<title>Your Daily Quote</title>
</head>
<body bgcolor="#ccc" onload="change_bgcolor()">
<?php if ($submit) { ?>
<div class="submit">
<form method="POST" action="quote.php">
Quote<br><input type="text" size="30" name="quote" /><br>
Author<br><input type="text" size="30" name="author" /><br>
<input type="submit" value="Submit" />
</form>
</div>
<?php } else if ($one_quote) { ?>
<div class="container">
<span class="quote"><?php get_specific($specific_quote); ?></span>
</div>
<?php } else { ?>
<div class="container">
<span class="quote"><?php get_quote(); ?></span>
</div>
<?php } ?>
<?php mysql_close($c); ?>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="uistuff.js"></script>
</body>
</html>