<?php
/*
Name: adm.php
Description: admin control page for pets ( php easy ticket system )
Purpose: to change settings and read, reply, delete tickets
Maker: lee johnstone
Site: www.freakcms.com
Support: info@freakcms.com
--------------------------------------------------------------------------------------------------------------------------
YOU MAY NOT
1. Use this for commercial usage
2. Claim the code as your own
3. Remove any copyrights from its original authors
YOU MAY
1. Upgrade, Update, Adjust, Modify this script, providing you keep all original comments.
2. Redistribute this code under the same license and none other.
3. Modify and use this script on your own site as you wish, providing you keep the copyright markings from original authors.
More information here.
http://www.freakcms.com/licensing.php
--------------------------------------------------------------------------------------------------------------------------
*/
session_start();
include 'data/class.tickets.php';
$ticket = new tickets();
$ticket->CheckSession();
$ticket->Config();
$ip=$_SERVER['REMOTE_ADDR'];
$show = true;
if(isset($_GET['logout'])){
$ticket->AdminLogout();
}
if(isset($_POST['login'])){
$ticket->DoAdminLogin($_POST['pwd'],$_POST['name']);
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?=$ticket->Cfg[site_name].' '.$ticket->Cfg[page_title];?></title>
<link rel="stylesheet" type="text/css" href="data/css.css" />
</head>
<body>
<div align="center"><?php
if($ticket->IsAdmin){
$show = false;
$ticket->AdminCookie();
?>
<h1>Administration Center</h1>
<div class="menu">
<a class="menu" href="adm.php">Tickets</a> |
<a class="menu" href="adm.php?setup">Settings</a> |
<a class="menu" href="<?=$ticket->Cfg['site_link'];?>">Submit Form</a> |
<a class="menu" href="adm.php?logout">Logout</a>
</div>
<hr>
<?php
if(isset($_POST['reply'])){
$ticket->ReplyTicket($_POST['ticket'], $_POST['email'], $_POST['response']);
}
if(isset($_POST['settings'])){
$UpdateArray = array(
'site_name'=>$_POST['site_name'],
'page_title'=>$_POST['page_title'],
'secert_q'=>$_POST['secert_q'],
'secert_a'=>$_POST['secert_a'],
'check_ip'=>$_POST['check_ip'],
'check_em'=>$_POST['check_em'],
'adm_mail'=>$_POST['adm_mail'],
'script_mail'=>$_POST['script_mail'],
'site_mail'=>$_POST['site_mail'],
'site_link'=>$_POST['site_link'],
'adm_link'=>$_POST['adm_link'],
'valid_link'=>$_POST['valid_link'],
'rem_link'=>$_POST['rem_link'],
'remval_link'=>$_POST['remval_link'],
'status_link'=>$_POST['status_link'],
'mark_link'=>$_POST['mark_link']
);
$ticket->UpdateConfig($UpdateArray);
}
if(isset($_GET['read'])){
$ticket->ReadTicket($_GET['read']);
?>
<div align="center" class="read">
<h1 >Reading Ticket <?=$ticket->ReadArray['subject'];?></h1>
<table class="read"><tr>
<td class="menu" align="center" colspan=2>
<a class="menu" href="adm.php?reply=<?=$ticket->ReadArray['ticket'];?>">Reply</a> |
<a class="menu" href="adm.php?delete=<?=$ticket->ReadArray['ticket'].'&email='.$ticket->ReadArray['email'];?>">Delete</a> |
<a class="menu" href="adm.php">Return</a> </td><tr>
<td class="read_name">Subject</td>
<td class="read_dets"><?=$ticket->ReadArray['subject'];?></td></tr><tr>
<td class="read_name">Date</td>
<td class="read_dets"><?=$ticket->ReadArray['date'];?></td></tr><tr>
<td class="read_name">Time</td>
<td class="read_dets"><?=$ticket->ReadArray['time'];?></td></tr><tr>
<td class="read_name">Ip</td>
<td class="read_dets"><?=$ticket->ReadArray['ip'];?></td></tr><tr>
<td class="read_name">name</td>
<td class="read_dets"><?=$ticket->ReadArray['name'];?></td></tr><tr>
<td class="read_name">email</td>
<td class="read_dets"><a class="read" href="mailto:<?=$ticket->ReadArray['email'];?>"><?=$ticket->ReadArray['email'];?></a></td></tr><tr>
<td class="read_name">site</td>
<td class="read_dets"><a class="read" href="<?=$ticket->ReadArray['site'];?>"><?=$ticket->ReadArray['site'];?></a></td></tr><tr>
<td class="read_name">valid</td>
<td class="read_dets"><?=$ticket->NiceStates($ticket->ReadArray['valid']);?></td></tr><tr>
<td class="read_name">state</td>
<td class="read_dets"><?=$ticket->NiceStates($ticket->ReadArray['state']);?></td></tr><tr>
<?php
if($ticket->NiceStates($ticket->ReadArray['state'])=='true'){
?>
<td class="read_name">check date</td>
<td class="read_dets"><?=$ticket->ReadArray['cdate'];?></td></tr><tr>
<td class="read_name">check time</td>
<td class="read_dets"><?=$ticket->ReadArray['ctime'];?></td></tr><tr>
<?php
}
?>
<td class="read_dets" colspan=2><hr><?=$ticket->ReadArray['msg'];?><hr></td></tr>
<table>
</div>
<?php
}elseif(isset($_GET['delete'])){
$ticket->RemoveTicket($_GET['delete'], $_GET['email']);
}elseif(isset($_GET['setup'])){
$ticket->Config();
?>
<div align="center" class="set"><form method="POST" action="adm.php">
<table class=set>
<tr>
<td class="set_name"><h3>Core</h3></td>
<td class="set_input"></td>
<td class="set_desc"> </td>
</tr>
<tr class=set>
<td class="set_name">Site name</td>
<td class="set_input"><input class="set" type="text" name="site_name" size="20" value="<?=$ticket->Cfg[site_name];?>"></td>
<td class="set_desc"><label>Your Web Site Name Example ( Example: Freakcms )</label></td>
</tr>
<tr class=set>
<td class="set_name" >Site title</td>
<td class="set_input"><input class="set" type="text" name="page_title" size="20" value="<?=$ticket->Cfg[page_title];?>"></td>
<td class="set_desc"><label>Ticket System Page Title ( Example: Freakcms Ticket System )</label></td>
</tr>
<tr>
<td class="set_name"><h3>Security</h3></td>
<td class="set_desc"></td>
<td> </td>
</tr>
<tr class=set>
<td class="set_name">secret question</td>
<td class="set_input"><input class="set" type="text" name="secert_q" size="20" value="<?=$ticket->Cfg[secert_q];?>"> </td>
<td class="set_desc"><label>Used for the submit and deletion forms</label></td>
</tr>
<tr class=set>
<td class="set_name">secret answer</td>
<td class="set_input"><input class="set" type="text" name="secert_a" size="20" value="<?=$ticket->Cfg[secert_a];?>"></td>
<td class="set_desc"><label>Used for the submit and deletion forms</label></td>
</tr>
<tr class=set>
<td class="set_name">check ips</td>
<td class="set_input"><select class="set" size="1" name="check_ip">
<option value="1">true</option>
<option value="0">false</option>
</select> </td>
<td class="set_desc"><label>Checks tickets for duplicate ips entrys.</label></td>
</tr>
<tr class=set>
<td class="set_name">check emails</td>
<td class="set_input"><select class="set" size="1" name="check_em">
<option value="1">true</option>
<option value="0">false</option>
</select> </td>
<td class="set_desc"><label>Check tickets for duplicate email entrys and email validation</label></td>
</tr>
<tr>
<td class="set_name"><h3>Mail</h3></td>
<td class="set_input"></td>
<td class="set_desc"> </td>
</tr>
<tr class=set>
<td class="set_name">Admin email</td>
<td class="set_input"><input class="set" type="text" name="adm_mail" size="20" value="<?=$ticket->Cfg[adm_mail];?>"></td>
<td class="set_desc"><label>Ticket system administer email</label></td>
</tr>
<tr class=set>
<td class="set_name">Script Email</td>
<td class="set_input"><input class="set" type="text" name="script_mail" size="20" value="<?=$ticket->Cfg[script_mail];?>"></td>
<td class="set_desc"> <label>Email used to send ticket information to users</label></td>
</tr>
<tr class=set>
<td class="set_name">Site mail</td>
<td class="set_input"><input class="set" type="text" name="site_mail" size="20" value="<?=$ticket->Cfg[site_mail];?>"></td>
<td class="set_desc"><label>Main site email</label></td>
</tr>
<tr>
<td class="set_name"><h3>Links</h3></td>
<td class="set_input"></td>
<td class="set_desc"><label>Make sure to define either http:// or https://</label></td>
</tr>
<tr class=set>
<td class="set_name">site link</td>
<td class="set_input"><input class="set" type="text" name="site_link" size="20" value="<?=$ticket->Cfg[site_link];?>"></td>
<td class="set_desc"><label>direct link to the ticket page</label></td>
</tr>
<tr class=set>
<td class="set_name">Admin link</td>
<td class="set_input"><input class="set" type="text" name="adm_link" size="20" value="<?=$ticket->Cfg[adm_link];?>"></td>
<td class="set_desc"><label>direct link to the admin page</label></td>
</tr>
<tr class=set>
<td class="set_name">remove link</td>
<td class="set_input"><input class="set" type="text" name="rem_link" size="20" value="<?=$ticket->Cfg[rem_link];?>"></td>
<td class="set_desc"><label>direct link to the remove form</label></td>
</tr>
<tr class=set>
<td class="set_name">status link</td>
<td class="set_input"><input class="set" type="text" name="status_link" size="20" value="<?=$ticket->Cfg[status_link];?>"></td>
<td class="set_desc"><label>direct link to the status form</label></td>
</tr>
<tr class=set>
<td class="set_name">valid link</td>
<td class="set_input"><input class="set" type="text" name="valid_link" size="20" value="<?=$ticket->Cfg[valid_link];?>"></td>
<td class="set_desc"><label>direct link to the validation form</label></td>
</tr>
<tr class=set>
<td class="set_name">remove valid link</td>
<td class="set_input"><input class="set" type="text" name="remval_link" size="20" value="<?=$ticket->Cfg[remval_link];?>"></td>
<td class="set_desc"><label>direct link to the remove validation page</label></td>
</tr>
</table>
<input class="adm_button" type="submit" value="update core settings" name="settings"></p></form></div>
<?php
}elseif(isset($_GET['reply'])){
$ticket->GetTicket($_GET['reply']);
?>
<div class="reply">
<h1> Reply to <?=$ticket->ReadArray[subject];?></h1>
<table class="reply">
<td class="menu" align="center" colspan=2>
<a class="menu" href="adm.php?read=<?=$ticket->ReadArray['ticket'];?>">Read</a> |
<a class="menu" href="adm.php?delete=<?=$ticket->ReadArray['ticket'].'&email='.$ticket->ReadArray['email'];?>">Delete</a> |
<a class="menu" href="adm.php">Return</a> </td><tr>
<tr><td class="reply">
<form method="POST" action="adm.php">
<textarea class="reply" rows="11" name="response" cols="35"></textarea><br>
<input class="reply" type="hidden" name="ticket" value="<?=$ticket->ReadArray[ticket];?>">
<input class="reply" type="hidden" name="email" value="<?=$ticket->ReadArray[email];?>">
<input class="adm_button" type="submit" value="Submit" name="reply">
</form></td></tr>
<tr><td class="reply"><h3>Orginal message</h3></td></tr>
<tr><td class="reply"><p> Message by: <?=$ticket->ReadArray[name];?></p><td></tr>
<tr><td class="reply"><hr><?=$ticket->ReadArray[msg];?><hr></td></tr>
</table>
</div>
<?php
}else{
$ticket->TicketList();
}
}
if($show){
?>
<h1>Administration login</h1>
<form action="adm.php" method="post">
<input name="name" type="text"><label>name</label> <br />
<input name="pwd" type="text"><label>pass </label> <br />
<input class="button" type="submit" value="login to admin" name="login">
</form></div>
<?php
}
?>
</body>
</html> |