You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.3 KiB
75 lines
2.3 KiB
<?php
|
|
/*
|
|
* Created on 20.01.2010
|
|
*
|
|
* @copyright (c) 2010 animegame.eu
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
|
*
|
|
*/
|
|
include_once(ROOT_PATH.'/include/char.inc.php');
|
|
|
|
/**
|
|
*
|
|
* @param unknown_type $title
|
|
* @param unknown_type $charid
|
|
* @param unknown_type $userid
|
|
* @return boolean if the insert was successful
|
|
*/
|
|
function insertIntoHallOfFame($title, $charid, $userid){
|
|
$row = mysql_fetch_assoc(mysql_query('Select max(id) as round from online'));
|
|
$char = getChar($charid);
|
|
$user = mysql_fetch_assoc(mysql_query('Select * from user where id = '.$userid));
|
|
|
|
if(!$row || is_null($char) || is_null($user)){
|
|
return false;
|
|
}
|
|
|
|
return insertIntoHallOfFameFull($row['round'], $title, $charid, $char['name'], $userid, $user['nickname'], 'now()');
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param unknown_type $round
|
|
* @param unknown_type $title
|
|
* @param unknown_type $charid
|
|
* @param unknown_type $charname
|
|
* @param unknown_type $userid
|
|
* @param unknown_type $username
|
|
* @param unknown_type $date (Whatch out date is not escaped!!)
|
|
* @return unknown_type
|
|
*/
|
|
function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charname = '', $userid = '', $username = '', $date = ''){
|
|
// These Entries may not be ''
|
|
if(!is_numeric($round) || $charname == '' || $username == '' || $date == '' || $title == ''){
|
|
echo '('.$round.') ('.$charname.') ('.$username.')'.') ('.$date.')'.') ('.$title.')'.'<br>';
|
|
return false;
|
|
}
|
|
$columns = 'art, runde, datum, charname, username';
|
|
$values = '\''.$title.'\','.$round.','.$date.',\''.$charname.'\',\''.$username.'\'';
|
|
|
|
if(is_numeric($charid)){
|
|
$columns .= ',charid';
|
|
$values .= ','.$charid;
|
|
}
|
|
if(is_numeric($userid)){
|
|
$columns .= ',userid';
|
|
$values .= ','.$userid;
|
|
}
|
|
$sql = 'INSERT INTO highscore('.$columns.') values('.$values.')';
|
|
// echo $sql.'<br>';
|
|
$qry = mysql_query($sql);
|
|
return mysql_affected_rows() > 0;
|
|
}
|
|
|
|
function getHallOfFame($title, $userid) {
|
|
$row = mysql_fetch_assoc(mysql_query('Select max(id) as round from online'));
|
|
return getHallOfFameFull($row['round'],$title, $userid);
|
|
}
|
|
|
|
function getHallOfFameFull($round = '', $title = '', $userid = '') {
|
|
$sql = 'select count(*) from highscore where runde='.$round.' and userid='.$userid;
|
|
$row = mysql_fetch_row($sql);
|
|
return $row[0];
|
|
}
|
|
|
|
?>
|