All pastes #942064 Raw Edit

Stuff

public text v1 · immutable
·published 2008-03-14 05:44 UTC
rendered paste body
<?php
session_start();

ini_set ("display_errors", "1");
error_reporting(E_ALL);

mysql_connect("****", "****", "****");
mysql_select_db("****");

include ("functions.php");

$timeoutseconds = 180;
$timestamp = time();
$timeout = $timestamp-$timeoutseconds;
$ip = $_SERVER['REMOTE_ADDR'];
if(isset($_SESSION['email'])) {
  $registered = "1";
} else {
  $registered = "0";
}
$usersonlineinsert = mysql_query("INSERT INTO usersonline (timestamp, ip, registered) VALUES ('$timestamp','$ip', '$registered')") or die(mysql_error());
$usersonlinetruncate = mysql_query("DELETE FROM usersonline WHERE timestamp<$timeout");

if(!isset($_GET['action']) && !isset($_GET['control'])) {
  $hitcount = mysql_query("SELECT * FROM hitcounter") or die(mysql_error());
  $row = mysql_fetch_array($hitcount);
  $hits = $row['hits'];
  $hits++;
  $updatehits = mysql_query("UPDATE hitcounter SET hits='$hits' WHERE hitid='1'") or die(mysql_error());
}

$ip = $_SERVER['REMOTE_ADDR'];
$selectunique = mysql_query("SELECT * FROM uniquehits WHERE ip='$ip'") or die(mysql_error());
$checkip = mysql_num_rows($selectunique);

if ($checkip == "0") {
  $uniqueinsert = mysql_query("INSERT INTO uniquehits (ip) VALUES ('$ip')") or die(mysql_error());
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdRabbits</title>
<style type="text/css">
td {
	font-size: 8pt;
	font-family: tahoma;
}
a {
	font-size: 8pt;
	font-family: tahoma;
	text-decoration: none;
	color: #000000;
}
a:hover {
	font-size: 8pt;
	font-family: tahoma;
	text-decoration: underline;
	color: #549ced;
}
input {
	color: #000000;
	background: #FFFFFF;
	border: 1px solid #cbccce;
	width: 90px;
	height: 13px;
	font-size: 8pt;
	padding-left: 2px;
}
select {
	color: #000000;
	background: #FFFFFF;
	border: 1px solid #cbccce;
	width: 60px;
	height: 15px;
	font-size: 8pt;
}
input.submit {
	color: #000000;
	background: #FFFFFF;
	border: 1px solid #cbccce;
	width: 54px;
	height: 17px;
	font-size: 8pt;
	margin-top: 2px;
	padding-bottom: 2px;
}
input.submit2 {
	color: #000000;
	background: #FFFFFF;
	border: 1px solid #cbccce;
	height: 17px;
	font-size: 8pt;
	margin-top: 2px;
	padding-bottom: 2px;
}
.shoutbox {
	border-collapse: collapse;
	border: 1px solid #cbccce;
	border-style: solid;
	border-width: 1px;
	padding-left: 2px;
	padding-right: 0px;
	margin: 0px;
}
.style4 {
	background-image: url('images/index_10.jpg');
        padding: 6px;
}
.style5 {
	background-image: url('images/ColdRabbitsLayout02_08.jpg');
        padding: 6px;
}
.style6 {
	background-image: url('images/index_24.jpg');
        padding: 6px;
}
.style7 {
	margin-top: 2px;
}
.style8 {
	background-image: url('images/content.jpg');
        padding: 6px;
}
.style5 {
	background-image: url('images/ColdRabbitsLayout02_08.jpg');
        padding: 6px;
}
.style11 {
	background-image: url('images/index_11.jpg');
        padding: 6px;
}
.style18 {
	background-image: url('images/index_18.jpg');
        padding: 6px;
}
.style25 {
	background-image: url('images/index_25.jpg');
        padding: 6px;
}
</style>
</head>
<body>
<table style="width: 100%; height: 100%;" class="style1">
	<tr>
		<td>
		<table style="width: 650px; height: 138px" align="center" cellspacing="0" cellpadding="0">
			<tr>
				<td><img src="images/index_01.gif" alt="" /></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<table style="width: 619px" align="center" border="0" cellspacing="2" cellpadding="0">
	<tr>
		<td style="width: 108px;" align="left" valign="top">
<table style="width: 108px" cellspacing="0" cellpadding="0">
	<tr>
		<td style="width: 108px" class="style3">
		<img src="images/ColdRabbitsLayout02_03.jpg" width="108" alt="" /></td>
	</tr>
	<tr>
		<td style="width: 108px" class="style4">
		<a href='index.php'>index</a><br />
		forums<br />
                <a href='index.php?action=members'>members</a><br />
		<a href='index.php?action=downloads'>downloads</a><br />
		links<br />
		contact<br />	
		</td>
	</tr>
	<tr>
		<td style="width: 108px">
		<img src="images/index_13.jpg" width="108" height="8" alt="" /><img src="images/ColdRabbitsLayout02_07.gif" alt="" />
		</td>
	</tr>
	<tr>
		<td style="width: 108px" class="style5">
                <?php
                if(isset($_SESSION['email'])) {
	  	  $email = $_SESSION['email'];
                  $username  = usercolor($_SESSION['username']);
                  echo "welcome <b>$username</b><br /><br />";
                  $userquery = mysql_query("SELECT * FROM users WHERE email='$email'") or die(mysql_error());
                  $row = mysql_fetch_array($userquery);
                  $userid = $row['userid'];
                  $level = $row['level'];

                  if($level > "0") {
		  echo "<a href='index.php?control=users'>manage users</a><br />
                        <a href='index.php?control=news'>manage news</a><br />
                        <a href='index.php?control=downloads'>manage downloads</a><br />";
                  }
                  echo "<a href='index.php?action=editprofile&userid=$userid'>edit profile</a><br />
                  <a href='index.php?action=changepw&userid=$userid'>change password</a><br />
                  <a href='index.php?action=logout'>logout</a>";
                } else {
                  echo "<center><form method='post' action='index.php?action=login'>
		  <input name='username' type='text' style='background-image: url(images/bg/username.gif); text-align: center;'><br />
		  <input name='password' type='password' class='style7' style='background-image: url(images/bg/password.gif); text-align: center;'><br />
		  <input name='submit' type='submit' value='login' class='submit'><br />
		  </form>
		  <a href='index.php?action=register'>register</a></center>";
                }
                ?>
		</td>
	</tr>
	<tr>
		<td><img src="images/index_21.jpg" alt="" /></td>
	</tr>
	<tr>
		<td><img src="images/index_22.jpg" alt=""  /></td>
	</tr>
	<tr>
		<td style="width: 108px" class="style6">&nbsp;</td>
	</tr>
	<tr>
		<td><img src="images/ColdRabbitsLayout02_12.jpg" alt="" /></td>
	</tr>
</table>
		</td>
		<td align="center" valign="top">
<table cellpadding="0" cellspacing="0" style="width: 403px" align="center">
	<tr>
		<td>
		<img src="images/contenthead.jpg" alt="" /></td>
	</tr>
	<tr>
		<td class="style8" align=center valign=top height=200>
		<?php
                
                $action  = isset($_GET['action']) ? $_GET['action'] : '';
                
                if(!isset($_GET['control'])) {
                  switch ($action)
                  {
                    case "login":
 		    include "login.php";
 		    break;

 		    case "logout":
      		    include "logout.php";
 		    break;

 		    case "changepw":
 		    include "changepw.php";
                    break;

                    case "register":
                    include "register.php";
                    break;

                    case "members":
                    include "memberlist.php";
                    break;

                    case "editprofile":
                    include "editprofile.php";
                    break;

                    case "viewprofile":
                    include "viewprofile.php";
                    break;
		  
		    case "downloads":
		    include "downloads.php";
		    break;

                    default:
                    include "news.php";
                    break;
                  }
                } else {
                  switch ($_GET['control'])
                  {
                    case "users":
                    include "admin/users.php";
                    break;

                    case "news":
                    include "admin/news.php";
                    break;

 		    case "downloads":
		    include "admin/downloads.php";
  		    break;

                    case "messages";
                    include "admin/messages.php";
                    break;
                  }
                }
                ?>
		</td>
	</tr>
	<tr>
		<td>
		<img src="images/contentfoot.jpg" alt="" />
		</td>
	</tr>
</table>
		</td>
		<td style="width: 108px" align="right" valign="top">
<table style="width: 108px" cellspacing="0" cellpadding="0">
	<tr>
		<td style="width: 108px" class="style3">
		<img src="images/ColdRabbitsLayout02_07.jpg" width="108" alt="" /></td>
	</tr>
	<tr>
		<td style="width: 108px" class="style11">
 		<table border="0" align="center" style="width: 96px; height: 120px">
		  <tr>
		    <td valign="top" class="shoutbox">
		    <?php
		    $shoutselect = mysql_query("SELECT * FROM shoutbox ORDER BY date DESC LIMIT 5") or die(mysql_error());
                    while ($row = mysql_fetch_array($shoutselect)) {
                      $user = usercolor($row['user']);
		      $message = $row['comment'];
		      $message = strip_tags($message);
		      echo "$user: $message<br/>";
		    }
		    ?>
		    </td>
		  </tr>
		</table>
		<?php
		if(isset($_POST['shout'])) {
		  $message = $_POST['message'];
		  $user = $_SESSION['username'];
		  $date = date("d-m-Y H:i:s");
		  $length = strlen($message);
                  $maxlength = 75;
		  if(!$message) {
		    echo "please type a message..";
		  }
		  elseif($length > $maxlength) {
		    echo "Message exceeded 75 characters";
        	  } else {
		  $shoutinsert = mysql_query("INSERT INTO shoutbox (user, date, comment) VALUES ('$user', '$date', '$message')") or die(mysql_error());
		  echo "<meta http-equiv='refresh' content='0;url=index.php' />";
 		  }
 		}
		?>
		<center>
		<?php
		if(isset($_SESSION['email'])) {
		?>
                  <form method="POST" action="index.php">
		  <input name="message" type="text" style='background-image: url(images/bg/message.gif); text-align: center;' />
		  <input name="shout" type="submit" value="submit" class='submit' /><br />
		<?php
		} else {
		  echo "login to submit a comment..";
		}
		?>
		</center>
		</td>
	</tr>
	<tr>
		<td style="width: 108px">
		<img src="images/index_14.jpg" width="108" height="8" alt="" /><img src="images/ColdRabbitsLayout02_16.jpg" alt="" />
		</td>
	</tr>
	<tr>
		<td style="width: 108px" class="style18">
		<?php
		  $useramount = mysql_query("SELECT * FROM users");
		  $useramount = mysql_num_rows($useramount);
		  echo "members: $useramount<br />";
                  $hitcount = mysql_query("SELECT * FROM hitcounter") or die(mysql_error());
                  $row = mysql_fetch_array($hitcount);
                  $hits = $row['hits'];
		  echo "hits: $hits<br />";
		  $uniqueamount = mysql_query("SELECT * FROM uniquehits");
		  $uniqueamount = mysql_num_rows($uniqueamount);
                  echo "unique: $uniqueamount<br />";
		  $usersonline = mysql_query("SELECT DISTINCT ip FROM usersonline") or die(mysql_query());
		  $usersonline = mysql_num_rows($usersonline);
	 	  echo "users online: $usersonline<br />";
		  $membersonline = mysql_query("SELECT DISTINCT ip FROM usersonline WHERE registered='1'") or die(mysql_query());
		  $membersonline = mysql_num_rows($membersonline);
	 	  echo "members online: $membersonline<br />";
		?>
		</td>
	</tr>
	<tr>
		<td><img src="images/index_20.jpg" alt="" /></td>
	</tr>
	<tr>
		<td><img src="images/index_23.jpg" alt=""  /></td>
	</tr>
	<tr>
		<td style="width: 108px" class="style25">
		link 1<br />
		link 2<br />
		link 3<br />
		link 4<br />
		link 5<br />
		</td>
	</tr>
	<tr>
		<td><img src="images/index_27.jpg" alt="" /></td>
	</tr>
</table>
		</td>	
	
	</tr>
</table>
</body>
</html>