0.5.1
[gfh.git] / modapp.php
bloba54dfb516cef9a9abefdf67d48f2353643084955
1 <?
2 include "con.inc";
3 function auth($userid, $password) {
4 $sql="SELECT username FROM users WHERE username='$userid' AND userpass='$password'";
5 $result=mysql_query($sql);
6 if(!mysql_num_rows($result)) return 0;
7 else {
8 $query_data=mysql_fetch_row($result);
9 return $query_data[0];
12 $username=auth($uname,$pword);
13 if (!$username)
15 echo "You are not <a href=login.php>logged in</a>.";
16 exit;
18 if (!$submit)
21 <form method=post action=modapp.php>
22 What time of day do you browse GameFAQ's Hell? (Include your timezone): <input type=text name=timeofday><br>
23 Write here what you think would make you a good moderator and a postitive contributor to GameFAQ's Hell:<br><textarea cols=60 rows=6 name=bodbod2></textarea><br>
24 <br><Input type=submit name=submit value="Apply!">
25 </form>
28 if ($submit)
30 if (!$bodbod2)
32 echo "You must enter an application essay to apply.<br><br>";
34 <form method=post action=modapp.php>
35 What time of day do you browse GameFAQ's Hell? (Include your timezone): <input type=text name=timeofday><br>
36 Write here what you think would make you a good moderator and a postitive contributor to GameFAQ's Hell:<br><textarea cols=60 rows=6 name=bodbod2></textarea><br>
37 <br><Input type=submit name=submit value="Apply!">
38 </form>
40 exit;
42 if (!$timeofday)
44 echo "You must enter the time of day you browse GameFAQs Hell.<br><br>";
46 <form method=post action=modapp.php>
47 What time of day do you browse GameFAQ's Hell? (Include your timezone): <input type=text name=timeofday><br>
48 Write here what you think would make you a good moderator and a postitive contributor to GameFAQ's Hell:<br><textarea cols=60 rows=6 name=bodbod2></textarea><br>
49 <br><Input type=submit name=submit value="Apply!">
50 </form>
52 exit;
54 $bodbod="<b>Browses at:</b> ".$timeofday."\n\n<b>Application:</b> ".$bodbod2;
55 $bodbod=ereg_replace("\n","<br>",$bodbod);
56 $bodbod=ereg_replace("&lt;i&gt;","<i>",$bodbod);
57 $bodbod=ereg_replace("&lt;/i&gt;","</i>",$bodbod);
58 $bodbod=ereg_replace("&lt;b&gt;","<b>",$bodbod);
59 $bodbod=ereg_replace("&lt;B&gt;","<b>",$bodbod);
60 $bodbod=ereg_replace("&lt;/B&gt;","</b>",$bodbod);
61 $bodbod=ereg_replace("&lt;I&gt;","<i>",$bodbod);
62 $bodbod=ereg_replace("&lt;/I&gt;","</i>",$bodbod);
63 $bodbod=ereg_replace("&lt;/b&gt;","</b>",$bodbod);
64 $sql="SELECT * FROM users WHERE username='$uname'";
65 $result=mysql_query($sql);
66 $myrow=mysql_fetch_array($result);
67 $usename=$myrow["username"];
68 $hasaura=$myrow["cookies"];
69 $toptit="Application for ".$usename." with ".$hasaura." aura.";
70 $sql="SELECT * FROM topics WHERE topicname='$toptit' AND boardnum=19";
71 $result=mysql_query($sql);
72 if (mysql_num_rows($result)>=1)
74 echo "A topic with this title has already been posted.";
75 exit;
77 $posttime=time();
78 $datedate=date("Y-n-j H:i");
79 $sql="INSERT INTO topics (topicname,boardnum,topicby,timesec,active,postdate) VALUES ('$toptit','19','$usename','$posttime','1','$datedate')";
80 $result=mysql_query($sql);
81 $topicid=mysql_insert_id($db);
82 $sql="INSERT INTO messages (topic,messby,messsec,messbody,mesboard,theorder,postdate) VALUES ('$topicid','$usename','$posttime','$bodbod','19','1','$datedate')";
83 $result=mysql_query($sql);
84 $datedate=date("n/j/y H:i:s");
85 $sql="UPDATE users SET lastactivity='$datedate' WHERE username='$uname'";
86 $result=mysql_query($sql);
87 echo "Your application is now to be processed. Return to <a href=index.php>home</a>.";