Our Scripts Vault contains many game scripts that you can use to create your own game!
function getCharSession(id){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var test = xmlhttp.responseText; if(test = "success") window.location = "game.php"; } } xmlhttp.open("GET","char.php?q="+id,true); xmlhttp.send();}
<?phprequire_once(dirname(__FILE__) . '/../config.php');require_once(dirname(__FILE__) . '/../classes/class.factory.php');try{ session_start(); $charid=$_GET["q"]; if($charid == '' || !is_numeric($charid)) throw new GeneralException('The supplied character is not valid.'); else { $db = new DB(); $factory = new Factory($db); $user = $factory -> createNewUser(); $user -> isCharUnderUser($_SESSION['uid'], $charid); $_SESSION['cid'] = $charid; $_SESSION['hash'] = md5(mysecretkey . $_SESSION['uid'] . $_SESSION['cid'] . $_SERVER['REMOTE_ADDR']); echo 'success'; }}catch(GeneralException $charException){ $charException -> displayMessage();}?>
var test = xmlhttp.responseText; if(test == "success") window.location = "game.php";
var test = xmlhttp.responseText; if(test = "success") window.location = "game.php";
I'm not setting cookies at all, I'm setting a session. Sessions are set by the server(php), cookie by the browser(javascript). Not sure I trust cookie like i trust sessions.
I can send you pics of my cocks if you want reference.
Actually there is 4th way to store session-like data, but it is just for Javascript. Window.name property can hold up up to 2 megabits of information (In Safari, In IE its 64 and FF around 12).
Quote from: raestlyn on May 23, 2010, 04:11:49 PMActually there is 4th way to store session-like data, but it is just for Javascript. Window.name property can hold up up to 2 megabits of information (In Safari, In IE its 64 and FF around 12).Interesting... I'd never heard of that before. Thanks!