agng/ag/include/abholcodes.inc.php

25 lines
651 B

<?php
/*
* Created on 12.07.2008
*
* @copyright (c) 2009 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
function createAbholcode($charid){
$code = mt_rand(0, 44*$charid);
$code = md5($code.time());
mysql_query('DELETE from char_abholcodes where charid = '.$charid);
mysql_query('INSERT INTO char_abholcodes(charid, code) values('.$charid.', \''.$code.'\')');
}
function checkAbholcode($charid, $code){
$code_row = mysql_fetch_assoc(mysql_query('Select * from char_abholcodes where charid = '.$charid));
if($code_row){
return $code == $code_row['code'];
}
return true;
}
?>