Advertisement
Advertisement
| 05.20.2008 at 01:45AM PDT, ID: 23416356 |
|
[x]
Attachment Details
|
||
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: |
<?php
session_start();
$UserName = $_SESSION['UserName'];
include("action/restrict.php");
//Connect to the database
include("config/connect.php");
//Include the functions file
include("config/functions.php");
//include settings file
include("config/settings.php");
$IDQuery = "select UserID from tbl_users where UserName = '$UserName'";
$IDResult = mysql_query($IDQuery);
$IDr = mysql_fetch_array($IDResult);
$UserID = $IDr['UserID'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
function add(){
$.ajax({
type: "POST",
url: "action/add_item.php",
data: "listtext=" + document.getElementById("listtext").value +
"&userid=" + document.getElementById("userid").value,
success: function(html){
$("#response").html(html);
}
});
}
</script>
</head>
<body>
<div id="wrapper">
<div id="header">
<br/><a href="action/logout.php">Logout</a>
</div>
<div id="content">
<table class="listtable">
<?php
$query = "SELECT * from tbl_list WHERE fld_UserID = '$UserID'";
$result = mysql_query($query);
$rownum = "0";
while ($row = mysql_fetch_assoc($result)) {
$rownum = $rownum+1;
if ($rownum&1) {
$rowclass = "row1";
} else {
$rowclass = "row2";
}
echo "<tr class=\"$rowclass\">";
echo '<td>';
echo "$rownum";
echo '</td>';
echo '<td>';
echo '<img src="images/delete.png" class="listimage"/>';
echo '</td>';
echo '<td>';
echo '<img src="images/edit.png" class="listimage"/>';
echo '</td>';
echo '<td>';
echo $row['fld_listtext'];
echo '</td>';
echo '</tr>';
}
?>
</table>
<form action="" method="post">
<input type="text" name="listtext" id="listtext"/>
<input type="hidden" name="userid" id="userid"/>
<input type="button" name="submit" id="submit" value="Add" onclick="add()"/>
</form>
<div id="response"><!-- Our message will be echoed out here --></div>
</div>
</div>
</body>
</html>
|