Skynox
Authorized Bartender
Hello,
I requested a script a week ago and decided to try to make it by myself. I've said it
before but my knowledge of PHP/MySQL are very limited, so excuse me if it's not the most optimized script but it works the way I want it.
Hope someone have some use of it.
Find in index.php.
Place this under.
At the bottom of layout.php find.
and insert this link within the admin panel.
And here is the script. Name it teammanager.php and put it in the root folder.
At the top of the script there is some config lines that you have to change.
I requested a script a week ago and decided to try to make it by myself. I've said it
before but my knowledge of PHP/MySQL are very limited, so excuse me if it's not the most optimized script but it works the way I want it.
Hope someone have some use of it.
Find in index.php.
Code:
case "adminpanel":
$topic = "Administration Panel";
$subtopic = "adminpanel";
include("adminpanel.php");
break;
Code:
case "teammanager":
$topic = "Team Manager";
$subtopic = "teammanager";
include("teammanager.php");
break;
Code:
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
Code:
<a href="index.php?subtopic=teammanager&action=update"><font color="white"><b>Team Manager</b></font></a><br>
PHP:
<?PHP
//TEAM MANAGER - CONFIGURATION//
### TUTOR CONFIG ###
$web_access_t = "0"; // Put the page access for tutors here. Set to 0 by default.
$group_access_t = "2"; // Put the group_id for tutors here. Set to 2 by default.
### SENIOR TUTOR CONFIG ###
$web_access_st = "0"; // Put the page access for senior tutors here. Set to 0 by default.
$group_access_st = "3"; // Put the group_id for senior tutors here. Set to 3 by default.
### GAMEMASTER CONFIG ###
$web_access_gm = "3"; // Put the page access for gamemasters here. Set to 3 by default.
$group_access_gm = "4"; // Put the group_id for gamemasters here. Set to 4 by default.
//END OF CONFIGURATION - DONT EDIT BELOW//
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
if((empty($action))) {
$main_content .= '<center><h2><img src="'.$layout_name.'/images/content/headline-bracer-left.gif" /> TEAM MANAGER <img src="'.$layout_name.'/images/content/headline-bracer-right.gif" /></h2><br><br>
<center><a href="?subtopic=teammanager&action=update">GAMEMASTER MANAGER</a></center>';
}
//TEAM MANAGER BY SKYNOX @ otland.net
if($action == "update") {
$player = stripslashes(ucwords(strtolower(trim($_REQUEST['character']))));
$t_access = $_POST['tutor'];
$st_access = $_POST['stutor'];
$gm_access = $_POST['gm'];
$name_prefix_gm = "GM"; // Writes GM infront of name.
if(empty($player)) {
$main_content .= '<center><h2><img src="'.$layout_name.'/images/content/headline-bracer-left.gif" /> Team Manager <img src="'.$layout_name.'/images/content/headline-bracer-right.gif" /></h2><br><br>
<form action="" method="post">
<B>Character Name:</B><br><input type="textbox" name="character">
<br><br>
<input name="tutor" type="radio" />Tutor <br>
<input name="stutor" type="radio" />Senior Tutor <br>
<input name="gm" type="radio" />Gamemaster<br>
<br>
<input type="submit" value="Submit">
</form></center><form action="?subtopic=teammanager" method="post" ></form></center>';
}
elseif (isset($_POST['gm'])) {
$player_data = $SQL->query("SELECT * FROM `players` WHERE `name` = '".$player."';")->fetch();
$SQL->query("UPDATE `accounts` SET `page_access` = '".$web_access_gm."' WHERE `id` = '".$player_data['account_id']."'");
$SQL->query("UPDATE `players` SET `group_id` = '".$group_access_gm."' WHERE `name` = '".$player_data['name']."'");
$SQL->query("UPDATE `players` SET `name` = '".$name_prefix_gm." ".$player."' WHERE `name` = '".$player_data['name']."'");
$SQL->query("UPDATE `players` SET `level` = 2 WHERE `level` = '".$player_data['level']."'");
$main_content .= '<b><center><i>'.$player.'</i> was promoted to '.$name_prefix_gm.' '.$player.' (Group ID: '.$group_access_gm.') with page access '.$access.'.<br> Do not promote a player twice using "Gameamster"-option.</b></center>
<br>
<form action="?subtopic=teammanager" method="post" ></form>';
}
elseif (isset($_POST['stutor'])) {
$player_data = $SQL->query("SELECT * FROM `players` WHERE `name` = '".$player."';")->fetch();
$SQL->query("UPDATE `accounts` SET `page_access` = '".$web_access_st."' WHERE `id` = '".$player_data['account_id']."'");
$SQL->query("UPDATE `players` SET `group_id` = '".$group_access_st."' WHERE `name` = '".$player_data['name']."'");
$SQL->query("UPDATE `players` SET `name` = '".$player."' WHERE `name` = '".$player_data['name']."'");
$main_content .= '<b><center><i>'.$player.'</i> was promoted to Senior Tutor (Group ID: '.$group_access_st.') with page access '.$web_access_st.'.</b></center>
<br>
<form action="?subtopic=teammanager" method="post" ></form>';
}
elseif (isset($_POST['tutor'])) {
$player_data = $SQL->query("SELECT * FROM `players` WHERE `name` = '".$player."';")->fetch();
$SQL->query("UPDATE `accounts` SET `page_access` = '".$web_access_t."' WHERE `id` = '".$player_data['account_id']."'");
$SQL->query("UPDATE `players` SET `group_id` = '".$group_access_t."' WHERE `name` = '".$player_data['name']."'");
$SQL->query("UPDATE `players` SET `name` = '".$player."' WHERE `name` = '".$player_data['name']."'");
$main_content .= '<b><center><i>'.$player.'</i> was promoted to Tutor (Group ID: '.$group_access_t.') with page access '.$web_access_t.'.</b><br> </center>
<br>
<form action="?subtopic=teammanager" method="post" ></form>';
}
}
}
else
{
$main_content .= 'Sorry, you have not the rights to access this page.';
}
?>