Advertisement
Advertisement
| 06.21.2008 at 01:51PM PDT, ID: 23504979 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
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: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: |
<?php
session_start();
if (!$_SESSION['authed']){
$_SESSION['authed'] = "false";
}
require_once("xajax_core/xajax.inc.php");
$xajax = new xajax();
$xajax->registerFunction("myDBReadFunction");
$xajax->registerFunction("myDBLoginFunction");
$xajax->registerFunction("myDBValidationFunction");
$xajax->registerFunction("myDBValidFunction");
$xajax->registerFunction("myDBLogoutFunction");
function myDBReadFunction($show)
{
$content = "<table class=\"sample\"><tr><td colspan=\"9\" class=\"heading\">Information</td></tr></table>";
$objResponse = new xajaxResponse();
$objResponse->assign("SomeElementId2","innerHTML", $content);
return $objResponse;
}
function myDBLoginFunction()
{
$objResponse6 = new xajaxResponse();
$objResponse6->assign("SomeElementId2","innerHTML", "Login");
$content = "
<form action=\"#\" name=\"form\" id=\"form\" method=\"POST\">
<table class=\"sample\">
<tr>
<th>Please Log In: $_SESSION[sql] << Using this to see if the form vars are actually passed...</th>
</tr>
<tr>
<td>Username: <input type=\"text\" name=\"username\" id=\"username\"></td>
</tr>
<tr>
<td>Password: <input type=\"password\" name=\"password\" id=\"password\"></td>
</tr>
<tr>
<td><input type=\"button\" name=\"button\" value=\"enter\" onclick=\"xajax_myDBValidationFunction(xajax.getFormValues('form')) \"></td>
</tr>
</table>
</form>
";
$objResponse6->assign("SomeElementId2","innerHTML",$content);
return $objResponse6;
}
function myDBValidationFunction($formajax)
{
$objResponse7 = new xajaxResponse();
foreach ($formajax as $key => $val){
$$key = $val;
}
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
//I aslo just did a simple $username = $formajax['username'], but it produces the same results...
$link = mysql_connect("myserver", "usr","pass");
mysql_select_db("db");
$sql = "select * from users where username = \"$username\" and password = \"$password\" ";
$_SESSION[sql] = $sql;
$result = mysql_query($sql);
if (mysql_num_rows($result)){
$_SESSION[authed] = "true";
$myrow = mysql_fetch_assoc($result);
$_SESSION[name] = $myrow[name];
$_SESSION[uid] = $myrow[id];
$_SESSION[level] = $myrow[level];
$objResponse7->loadCommands(myDBReadFunction());
} elseif(mysql_num_rows($result) == "0") {
$_SESSION[authed] = "false";
$objResponse7->loadCommands(myDBLoginFunction());
}
return $objResponse7;
}
function myDBValidFunction()
{
$objResponse8 = new xajaxResponse();
$objResponse8->assign("SomeElementId2","innerHTML", "Validation");
if ($_SESSION['authed'] == "true"){
$objResponse8->loadCommands(myDBReadFunction());
} else {
$objResponse8->loadCommands(myDBLoginFunction());
}
return $objResponse8;
}
function myDBLogoutFunction()
{
$objResponse9 = new xajaxResponse();
$objResponse9->assign("SomeElementId2","innerHTML", "Logged Off");
session_destroy();
$objResponse9->assign("SomeElementId","innerHTML","");
$objResponse9->assign("SomeElementId3","innerHTML","");
$objResponse9->loadCommands(myDBLoginFunction());
return $objResponse9;
}
$xajax->processRequest();
?>
<html>
<head><?php $xajax->printJavascript(); ?>
<link rel="stylesheet" href="style2.css" type="text/css" />
<script type="text/javascript">
xajax.callback.global.onRequest = function() {xajax.$('loading').style.display = 'block';}
xajax.callback.global.beforeResponseProcessing = function() {xajax.$('loading').style.display='none';}
</script>
</head>
<body onLoad="xajax_myDBValidFunction();">
<div id="mainContainer">
<div id="SomeElementId2"></div>
<div id="myform"></div>
<div id="loading" style="position: absolute; left: 0px; top: 90px; width: 100%; height: 100px; background: white;" class="loading" align="center"><img src="images/ajax-loader.gif" alt="" />Working...</div>
</div>
</body>
</html>
|