Der Gewinner bekommt die Möglichkeit, seinen Account vor der automatischen Löschung zu schützen.main
parent
3594b26dcd
commit
db79561dc1
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @copyright (c) 2010 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
//Konstanten
|
||||
define("admin", 1);
|
||||
define("tester", 2);
|
||||
define("entwickler", 3);
|
||||
define("designer", 4);
|
||||
define("Werbung_an", 5);
|
||||
define("inaktiv_loeschschutz", 6);
|
||||
define("aktiv_loeschschutz", 7);
|
||||
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
|
||||
|
||||
function getUserGroups($user) {
|
||||
$qry = null;
|
||||
$groups = array();
|
||||
|
||||
//prüfen welcher wert für user steht (id oder name)
|
||||
if(is_numeric($user)) {
|
||||
$test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz
|
||||
INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id
|
||||
WHERE ugz.user_id = \''.$user.'\'';
|
||||
$qry = mysql_query($test);
|
||||
} else if (validateString($user) != null) {
|
||||
$test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz
|
||||
INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id
|
||||
INNER JOIN user as u ON u.id=ugz.user_id
|
||||
WHERE u.nickname = \''.$user.'\'';
|
||||
$qry = mysql_query($test);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($result = mysql_fetch_assoc($qry)) {
|
||||
$groups[$i] = array("gruppen_id" => $result['gruppen_id'], "gruppen_name" => $result['gruppen_name']);
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
function isUserInGroup($usergrouparray, $group) {
|
||||
for($i = 0; $i < count($usergrouparray); $i++) {
|
||||
if($usergrouparray[$i]['gruppen_id'] == $group) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeUserFromGroup($user, $group) {
|
||||
if($user !== NULL) {
|
||||
if ($group !== NULL && $group >= 0) {
|
||||
$qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$user.
|
||||
'\') AND gruppen_id = '.$group.';';
|
||||
mysql_query($qry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function addUserToGroup($user, $group) {
|
||||
if($user !== NULL) {
|
||||
if ($group !== NULL && $group >= 0) {
|
||||
$qry = 'INSERT INTO user_gruppe_zuordnung(user_id, gruppen_id)
|
||||
VALUES((SELECT id FROM user WHERE nickname = \''.$user.'\'), '.$group.');';
|
||||
mysql_query($qry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
?>
|
Loading…
Reference in new issue