Location: PHPKode > projects > PHP easy ticket and help system > php-easy-ticket-and-help-system/index.php
<?php
/*
Name: install.php
Description: submission form for pets ( php easy ticket system )
Purpose: main subbmission form.
Maker: lee johnstone
Site: www.freakcms.com
Support: hide@address.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

--------------------------------------------------------------------------------------------------------------------------

* 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.
*/

include 'data/class.tickets.php';
$ticket = new tickets();
$ticket->Config();
$ip=$_SERVER['REMOTE_ADDR']; 
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?=$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/css.css" />
</head>

<body>
<div align="center">
<h1><?=$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>
						<?=$ticket->Cfg[secert_q];?><br>
						<input  class="needed" type="text" name="sc" size="20"><br>
						<input type="hidden" name="ticket" value="<?=$_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 align="center">
				<form method="POST" action="">
						<h2>Add Your Submission</h2>
						<p>First Name<br>
						<input class="needed" type="text" name="fname" size="20"  maxlength="50"><br>
						Last Name<br>
						<input class="notneeded" type="text" name="lname" size="20"  maxlength="50"><br>
						Email<br>
						<input class="needed" type="text" name="email" size="20"  maxlength="120"><br>
						Email Again<br>
						<input class="needed" type="text" name="email2" size="20" maxlength="120"><br>
						Web Site<br>
						<input class="notneeded" type="text" name="site" size="20" maxlength="120"><br>
						Subject<br>
						<input class="needed" type="text" name="sub" size="20" maxlength="200"><br>
						Message<br>
						NO HTML OR BBCODE<br>
						<textarea class="needed" rows="13" name="msg" cols="47"></textarea><br>
						<!-- security question start-->
						Human Check<br>
						<?=$ticket->sq;?><br>
						<input  class="needed" type="text" name="sc" size="20"><br>
						<!-- security question end-->
						<input class="button" type="submit" value="Submit your ticket" name="goticket"></p>
			  </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"><a href="'.$ticket->Cfg[adm_link].'">Administration</a><br/>Easy ticket system 1.0 by lee Johnstone <a href="http://www.freakcms.com">www.freakcms.com</a></div>';
?>


</body>
</html>
Return current item: PHP easy ticket and help system