Skip to content

Instantly share code, notes, and snippets.

@allometry
Created March 25, 2009 03:41
Show Gist options
  • Save allometry/84543 to your computer and use it in GitHub Desktop.
Save allometry/84543 to your computer and use it in GitHub Desktop.
<? if (!isset($html)) header("content-type:javascript/json\n"); ?>
<?=$javascript->Object($this->data)?>
function login() {
Configure::write('debug', 0);
$this->data=json_decode($HTTP_RAW_POST_DATA, true);
$io=fopen("./jsondebug","w+");
//fwrite($io, "DEBUG: " . print_r($this->data, true) . "\n");
fwrite($io, "DEBUG: " . $HTTP_RAW_POST_DATA . "\n");
fclose($io);
//$this->render("/utility/json", "ajax"); exit;
/*
$user=(array)null;
$user=$this->User->find("first",array("conditions"=>array("username"=>$this->data["User"]["username"], "password"=>$this->data["User"]["password"])));
$this->data=(array)null;
if($user) {
$this->Session->write("auth",$user["User"]["name"]);
$this->data["User"]["authenticated"]=true;
} else {
$this->data["User"]["authenticated"]=false;
}
*/
$this->render("/utility/json", "ajax");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment