1 <?php
include "config.php";
2 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))
10 $query_data = mysql_fetch_row($result);
11 return $query_data[0];
14 function getboard($boardid)
16 $sql = "SELECT * FROM boards WHERE boardid='$boardid'";
17 $result = mysql_query($sql);
18 $myrow = mysql_fetch_array($result);
19 return $myrow["boardlevel"];
21 function userlevel($boardid)
23 $sql = "SELECT * FROM users WHERE username='$boardid'";
24 $result = mysql_query($sql);
25 $myrow = mysql_fetch_array($result);
26 return $myrow["level"];
28 $username = auth($uname, $pword);
31 echo "You are not <a href=login.php>Logged In</a>.";
36 echo '<form method=post action=topicsearch.php>
37 <input type=text name=query><br>
38 <br><input type=submit name=submit value="Search">
44 echo 'You must enter a title for the topic you are searching for..<br><br>
45 <form method=post action=topicsearch.php>
46 <input type=text name=query><br>
47 <br><input type=submit name=submit value="Search">
52 $sql = "SELECT * FROM topics WHERE topicname LIKE '%$query%' AND active=1 ORDER BY topicid ASC LIMIT 0,50";
53 $result = mysql_query($sql);
55 echo "<table width=100%><tr><td><b>Topic Title</b></td><td><b>Posted By</b></td><td><b>Last Posted In</b></td></tr>";
56 while ($myrow = mysql_fetch_array($result))
58 $userlevel = userlevel($uname);
59 $boardlevel = getboard($myrow["boardnum"]);
60 if ($userlevel >= $boardlevel)
62 echo "<tr><td><a href=messagelist.php?board=".$myrow["boardnum"]."&topic=".$myrow["topicid"].">".$myrow["topicname"]."</a></td><td>".$myrow["topicby"]."</td><td>".$myrow["postdate"]."</td></tr>";