<?php
/*
Name: index.php
Description: main page for the ticket system
Purpose: main subbmission form.
Maker: lee johnstone
Site: www.freakcms.com
Support: http://freakcms.com/contact.php
--------------------------------------------------------------------------------------------------------------------------
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://freakcms.com/contact.php
--------------------------------------------------------------------------------------------------------------------------
* Start of the class usage
*
* in this example it shows how to use
* this script to its full advantage.
*
* include 'class.tickets.php'; - include the class (needed)
* $ticket = new tickets(); - start the class (needed)
* $ticket->sitename - sets your site name (optional)
* $ticket->pagetitle - sets your page title (optional)
* $ip=$_SERVER['REMOTE_ADDR']; - users ip addedress (needed)
* $tick = $ticket->MakeTicket($_POST['email'],$_POST['fname'],32) - make a new ticket with the users details. (32 can be anything between 10-64 ) (needed)
* $ticket->checkEmail( Email_String, Email_String) - add if you would like to check 2 emails for a match on submission (opt)
* $ticket->CheckSec($_POST['sc']) - add if u would like to check the secert question and answer (opt)
* $ticket->sq - secert question for the forms (needed on forms if security checking is added) (opt)
*
* Submission array layout example.
*
* $data = array(
* 'name' => $_POST['fname'].' '.$_POST['lname'],
* 'email' => $_POST['email'],
* 'site' => $_POST['site'],
* 'ticket' => $tick,
* 'subject' => $_POST['sub'],
* 'msg' => $_POST['msg'],
* 'ip' => $ip,
* 'date' => date('Y-m-d'),
* 'time' => date('g:i:s'),
* 'valid' => 0,
* 'state' => 0
* );
* $ticket->NewTicket($data)- submit the new ticket for user validation.
*
* --to check a ticket before removing call
* $ticket->CheckToRemove(Ticket_String, Email_String);
*
* --to remove a ticket call
* $ticket->RemoveTicket(Ticket_String, Email_String);
*
* --To check the status of a ticket call
* $ticket->CheckStatus(Ticket_String, Email_String);
*
* '$dontshow' is just used to hide stuff when we dont need it.
* not part of the class and does not need to be used.
*/
if(file_exists ('./install_lite.php')){
header ("location: ./install_lite.php");
}
include 'data/class.tickets.php';
$ticket = new tickets();
$ticket->Config();
$ticket->sq = $ticket->Cfg[secert_q];
$ip=$_SERVER['REMOTE_ADDR'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?php echo $ticket->Cfg[site_name].' '.$ticket->Cfg[page_title];?></title>
<meta name="keywords" content="php, mysql, phpfilter, inputfilter, classes, secure, email, ticketing system, help system, email system">
<meta name="description" content="Easy ticket system 1.0 development site, please visit www.freakcms.com for more information">
<link rel="stylesheet" type="text/css" href="data/ticket.css" />
</head>
<body>
<div align="center">
<h1><?php echo $ticket->Cfg[site_name].' '.$ticket->Cfg[page_title];?></h1>
<?php
/*
* get the status of a ticket
*/
if(isset($_GET['status'])){
$ticket->CheckStatus($_GET['ticket'], $_GET['email']);
$dontshow = true;
}
/*
* removing a ticket after the form is passed
*/
if(isset($_POST['godelete'])){
$ticket->CheckToRemove($_POST['ticket'], $_POST['email']);
$dontshow = true;
}
/*
* removing a ticket after the validated
*/
if(isset($_GET['delete'])){
$ticket->RemoveTicket($_GET['ticket'], $_GET['email']);
$dontshow = true;
}
/*
* show the form to remove a ticket
*/
if(isset($_GET['remove'])){
if(!$dontshow){?>
<form method="POST" action="">
<h2>Remove Your Submission</h2>
<p>Enter the Email u used to submit<br>
<input class="needed" type="text" name="email" size="20">
<br>
Human Check<br>
<?php echo $ticket->Cfg[secert_q];?><br>
<input class="needed" type="text" name="sc" size="20">
<br>
<input type="hidden" name="ticket" value="<?php echo $_GET['ticket'];?>">
<input class="button" type="submit" value="Submit your ticket" name="godelete">
</p>
</form>
</div>
<?php
$dontshow = true;
}
}
/*
* validate a ticket link.
*/
if(isset($_GET['validate'])){
$ticket->ValidateEmailCheck($_GET['ticket'], $_GET['email']);
$dontshow = true;
}
/*
* submit the new ticket submission
*/
if(isset($_POST['goticket'])){
$tick = $ticket->MakeTicket($_POST['email'],$_POST['fname'],32); // make a new ticket with the users details. ( change 32 to which ever value u wish )
$ticket->checkEmail($_POST['email'], $_POST['email2']);
$ticket->CheckSec($_POST['sc']);
$data = array(
'name' => $_POST['fname'].' '.$_POST['lname'],
'email' => $_POST['email'],
'site' => $_POST['site'],
'ticket' => $tick,
'subject' => $_POST['sub'],
'msg' => $_POST['msg'],
'ip' => $ip,
'date' => date('Y-m-d'),
'time' => date('g:i:s'),
'valid' => 0,
'state' => 0
);
//$ticket->NewTicket($data);
}else{
/*
* show the submission form
*/
if(!$dontshow){
?>
<div class="main">
<form method="POST" action="">
<h1>Ticket Submission</h1>
<p>Sumit a support or request ticket</p>
<fieldset class="main"> <fieldset>
<legend>First Name</legend>
<input class="needed" type="text" name="fname" size="60" maxlength="50">
</fieldset>
<fieldset>
<legend>Last Name</legend>
<input type="text" name="lname" size="60" maxlength="50">
</fieldset>
<fieldset>
<legend>Email</legend>
<input class="needed" type="text" name="email" size="60" maxlength="120">
</fieldset>
<fieldset>
<legend>Email Again</legend>
<input class="needed" type="text" name="email2" size="60" maxlength="120">
</fieldset>
<fieldset>
<legend> Web Site</legend>
<input type="text" name="site" size="60" maxlength="120">
</fieldset>
<fieldset>
<legend>Subject</legend>
<input class="needed" type="text" name="sub" size="60" maxlength="200">
</fieldset>
<fieldset>
<legend> Message</legend>
<textarea class="needed" rows="13" name="msg" cols="45"></textarea>
</fieldset>
<fieldset>
<legend>Human Check</legend>
<!-- security question start-->
<?php echo $ticket->sq;?><br>
<input class="needed" type="text" name="sc" size="20">
</fieldset>
<fieldset>
<legend>Submit</legend>
<!-- security question end-->
<button type="submit" name="goticketss">Submit your ticket</button>
</fieldset> </fieldset>
</form>
</div>
<?php
}
}
/*
* Please try to keep this intact, even if u mod it to your liking or move it, but its not required.
*/
echo '<div align="center">
<footer><a class="adm_link" href="'.$ticket->Cfg[adm_link].'">Administration</a>
<p>(PETS) PHP Easy ticket system 1.1 by lee Johnstone</p>
<address><a class="footer" href="http://freakcms.com">http://freakcms.com</a></address>
</footer>
</div>';
?>
</body>
</html>
|