کد PHP:
<?php require_once('Connections/cn.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php require_once('Connections/cn.php'); ?>
<?php
$maxRows_rs2 = 10;
$pageNum_rs2 = 0;
if (isset($_GET['pageNum_rs2'])) {
$pageNum_rs2 = $_GET['pageNum_rs2'];
}
$startRow_rs2 = $pageNum_rs2 * $maxRows_rs2;
$colname_rs2 = "-1";
if (isset($_POST['txt_user'])) {
$colname_rs2 = (get_magic_quotes_gpc()) ? $_POST['txt_user'] : addslashes($_POST['txt_user']);
}
mysql_select_db($database_cn, $cn);
$query_rs2 = sprintf("SELECT * FROM `admin` WHERE `user` = '%s'", $colname_rs2);
$query_limit_rs2 = sprintf("%s LIMIT %d, %d", $query_rs2, $startRow_rs2, $maxRows_rs2);
$rs2 = mysql_query($query_limit_rs2, $cn) or die(mysql_error());
$row_rs2 = mysql_fetch_assoc($rs2);
if (isset($_GET['totalRows_rs2'])) {
$totalRows_rs2 = $_GET['totalRows_rs2'];
} else {
$all_rs2 = mysql_query($query_rs2);
$totalRows_rs2 = mysql_num_rows($all_rs2);
}
$totalPages_rs2 = ceil($totalRows_rs2/$maxRows_rs2)-1;
$maxRows_rs3 = 10;
$pageNum_rs3 = 0;
if (isset($_GET['pageNum_rs3'])) {
$pageNum_rs3 = $_GET['pageNum_rs3'];
}
$startRow_rs3 = $pageNum_rs3 * $maxRows_rs3;
$colname_rs3 = "-1";
if (isset($_POST['txt_name'])) {
$colname_rs3 = (get_magic_quotes_gpc()) ? $_POST['txt_name'] : addslashes($_POST['txt_name']);
}
$colname2_rs3 = "-1";
if (isset($_POST['txt_pass'])) {
$colname2_rs3 = (get_magic_quotes_gpc()) ? $_POST['txt_pass'] : addslashes($_POST['txt_pass']);
}
mysql_select_db($database_cn, $cn);
$query_rs3 = sprintf("SELECT * FROM `admin` WHERE `user` = '%s' AND pass = '%s'", $colname_rs3,$colname2_rs3);
$query_limit_rs3 = sprintf("%s LIMIT %d, %d", $query_rs3, $startRow_rs3, $maxRows_rs3);
$rs3 = mysql_query($query_limit_rs3, $cn) or die(mysql_error());
$row_rs3 = mysql_fetch_assoc($rs3);
if (isset($_GET['totalRows_rs3'])) {
$totalRows_rs3 = $_GET['totalRows_rs3'];
} else {
$all_rs3 = mysql_query($query_rs3);
$totalRows_rs3 = mysql_num_rows($all_rs3);
}
$totalPages_rs3 = ceil($totalRows_rs3/$maxRows_rs3)-1;
?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New Page 1</title>
<style>
ul{
float:right;
width:100%;
margin:10;
}
li{
display:inline
}
a.menu
{
float:right;
width:65pt;
text-decoration:none;
background-color:#d6aa5e;
padding:2pt 2pt;
border-right:1px solidwhite;
}
a.menu:hover{
color:#000000;
font:bold;
background-color:#FFCC66;
text-align: center;
}
.sootoon{
width:233;
height:377;
background:#d6aa5e;
}
.footer{
background:#390101;
width:auto;
height:auto;
}
.body{
background:#FFFFFF;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
}
.style1 {color: #FFFFFF}
.style3 {font-size: 10px}
.style4 {color: #990000}
</style>
</head>
<body bgcolor="#6b0000">
<p>
<img border="0" src="img/cartoon.jpg" width="179" height="163" style="position: absolute; left: 423; top: 26">
<img border="0" src="img/world%20it.jpg" width="224" height="73" style="position: absolute; left: 613; top: 21">
<img border="0" src="img/center%20download.jpg" width="246" height="73" style="position: absolute; left: 850; top: 19"></p>
<div style="position: absolute; width: 821px; height: 178px; z-index: 1; left: 402px; top: 15px" id="layer1" align="center"></div>
<p> </p>
<p> </p>
<p> </p>
<div style="position:absolute; width:821px; left: 403px; top: 180px;"><img src="img/down.jpg" width="821" height="50"></div>
<div style="position: absolute; width: 821px; height: 46px; z-index: 2; left: 402px; top: 228px; background-color: #390101; border-bottom-width: thin;" id="layer2" >
<div>
<ul>
<li><a href="index.php" class="menu">صفحه اصلی</a></li>
<li><a href="#"class="menu">گالری عکس</a></li>
<li><a href="#"class="menu">عضویت</a></li>
<li><a href="about.php"class="menu">درباره ما</a></li>
<li><a href="#"class="menu">آرشیو</a></li>
<li><a href="news.php"class="menu">اخبار</a></li>
<li><a href="contact.php"class="menu">تماس با ما</a></li>
</ul>
</div>
</div>
<div style="position:absolute; width:233px; height:772px; left: 990px; top: 278px;" class="sootoon" align="right">
<form name="form1" method="post" action="">
<label></label>
<p>
<input name="txt_username" type="text" id="txt_username" src="bottum.jpg">
</p>
<p>
<label>
<input type="submit" name="Submit" value="ورود">
<input name="txt_pass" type="password" id="txt_pass">
</label>
</p>
<p><a href="send_pass.php" class="style3">رمز خود را فراموش کرده ام</a> </p>
<p> </p>
</form>
<form name="form2" method="post" action="">
<div style="padding-top:23px" align="right">
<p>
<input name="Submit" type="submit" style="width:43px; height:21px; background:url(src="search.png") no-repeat; border:0px" value="جستجو" />
<input type="text" name="textfield">
</p>
</div>
</form>
<div>
<ol>
<li> مقالات </li>
<br>
<li> نرم افزار</li>
<br>
<li> افزار گرافیک</li>
<br>
<li> برنامه نویسی</li>
<br>
<li> آموزشی</li>
<br>
<li> بازی</li>
<br>
<li></li><br>
</ol>
</div>
</div>
<div class="footer style1" style="position:absolute; width:235px; height:21px; left:989px; top:506px">
<div align="center">اخبار</div>
</div>
<div style="position:absolute; width:821px; height:181px; left:402px; top:1049px" class="footer">
<div align="right" class="style1" style="position:absolute; left:55px; top:auto">آخرین اعضاء</div>
<div align="right" class="style1" style="position:absolute; left:329px; top:2px">پربازدید ترین مطالب</div>
<div align="right"><span class="style1"style="position:absolute; left:706px; top:1px">جدید ترین ارساله</span>ا</div>
</div>
<div style="position:absolute; width:585px; height:772px; left:401px; top:278px" class="body">
<div align="right">
<p> </p>
<p> </p>
</div>
<table width="357" height="239" border="1" align="center">
<tr>
<td colspan="3">
<p align="center">پنل مدیریت</td>
</tr>
<tr>
<td><p align="center"><a href="news_add.php"><img src="img/news_add.png" width="48" height="48"></a></p>
<p align="center"><a href="news_add.php">اخبار</a></p></td>
<td><p align="center"><a href="cat_add.php"><img src="img/package_add.png" width="48" height="48"></a></p>
<p align="center"><a href="cat_add.php">موضوعات</a></p></td>
<td><p align="center"><a href="user_add.php"><img src="img/user1_add.png" width="48" height="48"></a></p>
<p align="center"><a href="user_add.php">کاربران</a></p></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><p align="center"><a href="link_add.php"><img src="img/pawn_add.png" width="48" height="48" border="0"></a></p>
<p align="center"><a href="link_add.php">لینکها</a></p></td>
</tr>
<tr>
<td><div align="center"><a href="<?php echo $logoutAction ?>">خروج</a></div></td>
<td> </td>
<td> </td>
</tr>
</table>
<form name="form3" method="post" action="">
<label>
<div align="center">لطفا نام کاربری را وارد کنید
<input name="txt_user" type="text" id="txt_user">
<input type="submit" name="Submit2" value="جستجو">
</div><br>
</label>
<table width="306" border="0" align="center">
<tr>
<td width="75" bgcolor="#000000"><div align="center" class="style4">id</div></td>
<td width="97" bgcolor="#000000"><div align="center" class="style4">user</div></td>
<td width="85" bgcolor="#000000"><div align="center" class="style4">pass</div></td>
</tr>
<?php do { ?>
<tr>
<td bgcolor="#990000"><div align="center"><span class="style1"><?php echo $row_rs2['id']; ?></span></div></td>
<td bgcolor="#990000"><div align="center"><span class="style1"><?php echo $row_rs2['user']; ?></span></div></td>
<td bgcolor="#990000"><div align="center"><span class="style1"><?php echo $row_rs2['pass']; ?></span></div></td>
</tr>
<?php } while ($row_rs2 = mysql_fetch_assoc($rs2)); ?>
</table>
</form>
<form name="form4" method="post" action="">
<label>
<div align="center">name
<input name="txt_name" type="text" id="txt_name">
</div>
<div align="center">pass
<input name="txt_pass" type="password" id="txt_pass">
</div>
</label>
</p>
<div align="center">
<input type="submit" name="Submit3" value="search">
</div>
</form>
<table width="306" border="0" align="center">
<tr>
<td bgcolor="#000000" class="style4">id</td>
<td bgcolor="#000000" class="style4">user</td>
<td bgcolor="#000000" class="style4">pass</td>
</tr>
<?php do { ?>
<tr>
<td bgcolor="#990000"><span class="style1"><?php echo $row_rs3['id']; ?></span></td>
<td bgcolor="#990000"><span class="style1"><?php echo $row_rs3['user']; ?></span></td>
<td bgcolor="#990000"><span class="style1"><?php echo $row_rs3['pass']; ?></span></td>
</tr>
<?php } while ($row_rs3 = mysql_fetch_assoc($rs3)); ?>
</table>
</div>
<div style="position:absolute; left: 352px; top: 14px;"><img src="img/left.jpg" width="51" height="1033"></div>
<div style="position:absolute; left: 1224px; top: 14px; height: 1029px; width: 39px;"><img src="img/right.jpg" alt="1" width="51" height="1026"></div>
<div style="position: absolute; width: 92px; height: 36px; z-index: 2; left: 894px; top: 277px; background-color: #390101; border-bottom-width: thin;" id="layer" >
<div align="right" class="style1">:موضوع </div>
</div>
</body>
</html>
<?php