Skip to content

Instantly share code, notes, and snippets.

@sisco
Created April 6, 2010 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sisco/357222 to your computer and use it in GitHub Desktop.
Save sisco/357222 to your computer and use it in GitHub Desktop.
<?php
#Brian Sisco
#CS 1520 assignment 3
#April 2nd, 2010
#Admin usage page
#This page redirects to the login page if you aren't logged in.
session_start();
#don't let the user in if they haven't logged in or if they chose logout.
if( (!isset($_SESSION["id"]) and !isset($_POST["adminChoice"])) or $_POST["adminChoice"] == "Logout")
{
session_destroy();
header("Location: adminlogin.php");
exit;
}
#if they have selected a ticket, go to the ticket page
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "View Selected Ticket")
{
header("Location: ticket2.php");
exit;
}
#to check their login details, we must open the database
$db = mysql_connect('localhost', 'SiscoBr', "pets-bibs"); #the password is in plain text here because only the grader and I will really see this file.
if($db) #if we connected, select the database
{
mysql_select_db('SiscoBr');
}
else #if we didn't connect, there is no more we can do.
{
die("Could not connect to database " . mysql_error());
}
#we look for a row with the name & password they gave
if(!$_POST["adminChoice"])
{
$hash = md5($_POST["password"]);
$name = $_POST["name"];
$query = "select * from Admins where Admins.name = '$name' AND Admins.password = '$hash'";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
#if there aren't any such rows, then the log in details are invalid, so EXIT.
if($num_rows < 1)
{
session_destroy();
header("Location: adminlogin.php");
exit;
}
$_SESSION["id"] = $name;#trim($_POST["name"]);
}
#If we are still executing this, we have successfully checked their credentials.
#Display the main screen. Start by getting the info for the display table.
#This info depends on their previous input or lack thereof, so we must test that.
#First we'll handle the sorting of the table.
if(!isset($_SESSION["sort"])) #we start out with a default sort
{
$_SESSION["sort"] = "Tickets.id";
}
#if their selection was sort, then we switch to that one based on which radio button was selected
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "Sort")
{
switch($_POST["sortby"])
{
case 0:
$_SESSION["sort"] = "Tickets.id";
break;
case 1:
$_SESSION["sort"] = "thedate";
break;
case 2:
$_SESSION["sort"] = "fName";
break;
case 3:
$_SESSION["sort"] = "Ticket_Details.email";
break;
case 4:
$_SESSION["sort"] = "subject";
break;
}
}
$sort = $_SESSION["sort"];
#next we set up the toggle for showing only open tickets or all
if(!isset($_SESSION["allOpen"])) #we start out with a default sort
{
$_SESSION["allOpen"] = "Tickets.status = \"open\" and";
}
#if they hit the button, toggle!
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "View All Tickets")
{
$_SESSION["allOpen"] = "";
}
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "View Open Tickets")
{
$_SESSION["allOpen"] = "Tickets.status = \"open\" and";
}
$allOpen = $_SESSION["allOpen"];
#Now lets set up the response for if they select View My Tickets
#if they select this, we will add a condition to the where clause of the select below by making $my non-null
if(!isset($_SESSION["my"])) #default to everyone
{
$_SESSION["my"] = "";
}
#if they hit the button, toggle!
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "View My Tickets")
{
$id = $_SESSION["id"];
$_SESSION["my"] = "and Admins.name = \"$id\"";
}
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "View All Techs Tickets")
{
$_SESSION["my"] = "";
}
$my = $_SESSION["my"];
#Let's set up the toggle for View Unassigned Tickets.
if(!isset($_SESSION["unassigned"])) #default to showing all
{
$_SESSION["unassigned"] = "";
}
#if they hit the button, toggle!
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "View Unassigned Tickets")
{
$id = $_SESSION["id"];
$_SESSION["unassigned"] = "and Admins.id = 9"; #9 is the value for unassigned
}
if(isset($_POST["adminChoice"]) and $_POST["adminChoice"] == "View Regardless of Assignment")
{
$_SESSION["unassigned"] = "";
}
$un = $_SESSION["unassigned"];
#Perhaps they only want to see tickets from one person
if($_POST["adminChoice"] == "View tickets from this Submitter")
{
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$singleperson = "and Ticket_Details.fname = '$fname' and Ticket_Details.lname = '$lname'";
}
else
{
$singleperson = "";
}
#Now that we've set up the customizations to the query, we can finally do it!
$query = "select Tickets.id, thedate, fName, lName, Ticket_Details.email, subject, Admins.name, status, techId, Admins.id
from Tickets, Ticket_Details, Admins
where $allOpen Tickets.id = Ticket_Details.id and techId = Admins.id $my $un $singleperson
order by $sort";
$result = mysql_query($query);
if($result)
{
$num_rows = mysql_num_rows($result);
}
else
{
$num_rows = 0;
}
#make the table
?>
<html>
<head>
<title>Admin Page</title>
<SCRIPT type = "text/javascript">
//This JavaScript is for passing the selected value on to ticket.php
function setSelect(val)
{
var sel = document.getElementById('selectVal');
if(sel)
{
sel.value = val;
}
//alert(val);
}
</SCRIPT>
</head>
<body>
<center>
<?php
#Making sure the caption is accurate
if($_SESSION["allOpen"] == "")
{
echo "All Technical Support Tickets";
}
else
{
echo "Open Technical Support Tickets";
}
?>
</center>
</br><table border = "border" align = center>
<tr align = center>
<td>Ticket #</td>
<td>Received</td>
<td>Sender Name</td>
<td>Sender Email</td>
<td>Subject</td>
<td>Tech</td>
<td>Status</td>
<td>Select</td>
</tr>
<form id = "selectForm" action="ticket.php" method = "POST" style="display: inline;">
<?php
#the indexes in $row[] are the order that the columns were requested in the select above.
for($i = 0; $i < $num_rows; $i++)
{
$row = mysql_fetch_array($result);
echo "<tr>";
echo "<td>";
echo $row[0];
echo "</td>";
echo "<td>";
echo $row[1];
echo "</td>";
echo "<td>";
echo $row[2]." ".$row[3];
echo "</td>";
echo "<td>";
echo $row[4];
echo "</td>";
echo "<td>";
echo $row[5];
echo "</td>";
echo "<td>";
echo $row[6];
echo "</td>";
echo "<td>";
echo $row[7];
echo "</td>";
?>
<td><input type = "radio" name = "selectRadio" value="<?php echo $row[0] ?>" onClick = "setSelect(<?php echo $row[0] ?>)"></td>
</tr>
<?php
}
#Next the row at the bottom where they can select a column by which to sort.
?>
</form>
<form name = "adminForm" action="admin.php" method = "POST" style="display: inline;">
<tr align = center>
<?php
for($i = 0; $i < 5; $i++)
{
echo "<td>Sort By <input type = \"radio\" name = \"sortby\" value= $i></td>";
}
?>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
</td>
</table>
<center>
</br>
<?php
if($_SESSION["allOpen"] == "")
{
?><input type = "submit" name = "adminChoice" value = "View Open Tickets" /><?php
}
else
{
?><input type = "submit" name = "adminChoice" value = "View All Tickets" /><?php
}
?>
<input type = "submit" name = "adminChoice" value = "Sort" />
</form>
<form id = "selectForm" action="ticket.php" method = "POST" style="display: inline;">
<input type = "submit" name = "adminChoice" value = "View Selected Ticket" />
<textarea cols = "0" id = "selectVal" name = "selectVal" value = "" style = "visibility: hidden; display: inline;"></textarea>
</br>
</form>
<form name = "adminForm" action="admin.php" method = "POST" style="display: inline;">
<?php
if($_SESSION["my"] == "")
{
?><input type = "submit" name = "adminChoice" value = "View My Tickets" /><?php
}
else
{
?><input type = "submit" name = "adminChoice" value = "View All Techs Tickets" /><?php
}
?>
<input type = "submit" name = "adminChoice" value = "Logout" />
<?php
if($_SESSION["unassigned"] == "")
{
?><input type = "submit" name = "adminChoice" value = "View Unassigned Tickets" /><?php
}
else
{
?><input type = "submit" name = "adminChoice" value = "View Regardless of Assignment" /><?php
}
?>
</br>
</center>
</form>
</body>
</html>
<?php
session_start();
$_SESSION["id"] = "";
#Brian Sisco
#CS 1520 assignment 3
#April 2nd, 2010
#Technical Support Login Page
?>
<html>
<head>
<title>Technical Support Login Page</title>
<script type = "text/javascript">
// This function checks whether the fields are filled out and is called upon hitting submit.
function checkComplete()
{
//get the elements of the form. The last one is the submit button, the others are the text fields.
var elements = document.loginForm.elements;
//we check each one for blankness. We don't check the submit button, so we do "elements.length - 1"
for(var i = 0; i < elements.length - 1; i++)
{
//if one is blank, we tell them to fix it, give focus to the first blank one, and do not submit the form yet
if(elements[i].value == "")
{
alert("All fields are required. Please complete the form and resubmit.");
elements[i].focus();
return false;
}
}
#set this session variable so the next page will know they came from here
$_SESSION["id"] = elements[0].value;
return true;
}
</script>
</head>
<body>
<p>
Hello, welcome to Technical Support Admin Login!
</p>
<p>All fields are required.</p>
<form name = "loginForm" action="admin.php" method = "POST" onsubmit = "return checkComplete()">
Name: <INPUT type = "text" name = "name" value = ""> <BR/>
Password: <INPUT type = "password" name = "password" value = ""> <BR/>
<input type = "submit" value = "Submit/Login" />
</form>
</body>
</html>
<?php
#Brian Sisco
#CS 1520 assignment 3
#April 2nd, 2010
#Database set up file
#This script initializes the database so that it ready and always starts in the same state.
#It does this by openning the database, creating the necessary tables, and then populating them with data from flat files.
#First we open the database
$db = mysql_connect('localhost', 'SiscoBr', "pets-bibs"); #the password is in plain text here because only the grader and I will really see this file.
if($db) #if we connected, select the database
{
mysql_select_db('SiscoBr');
}
else #if we didn't connect, there is no more we can do.
{
die("Could not connect to database " . mysql_error());
}
#Next we clear the tables we will be using to remove changes from previous runs.
mysql_query("drop table Admins");
mysql_query("drop table Tickets");
mysql_query("drop table Ticket_Details");
#now for each table we add it and its data
$result = mysql_query("create table Admins(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name CHAR(30) NOT NULL,
password CHAR(32) NOT NULL,
email CHAR(30) NOT NULL)");
$admins = file("Admins.flat");
foreach($admins as $adminString)
{
$adminString = rtrim($adminString);
$admin = preg_split("/ +/", $adminString);
$admin[1] = preg_replace("/0/", "&nbsp;", $admin[1]);
$hash = md5($admin[2]);
$query = "insert into Admins values('$admin[0]', '$admin[1]', '$hash', '$admin[3]')";
mysql_query($query) or die ("Invalid insert " . mysql_error());
}
#Now for Tickets
$result = mysql_query("create table Tickets(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
status CHAR(6) NOT NULL,
techId int)");
$tickets = file("Tickets.flat");
foreach($tickets as $ticketString)
{
$ticketString = rtrim($ticketString);
$ticket = preg_split("/ +/", $ticketString);
$query = "insert into Tickets values('$ticket[0]', '$ticket[1]', '$ticket[2]')";
mysql_query($query) or die ("Invalid insert " . mysql_error());
}
#Now for Ticket_Details
#the date will be read in as 14 digit number in the form YYYYMMDDHHMMSS.
#original line: ticket_id FOREIGN KEY (ticket_id) REFERENCES Tickets(id),
$result = mysql_query("create table Ticket_Details(
id int PRIMARY KEY NOT NULL,
fName CHAR(30) NOT NULL,
lName CHAR(30) NOT NULL,
email CHAR(30) NOT NULL,
subject CHAR(30) NOT NULL,
description CHAR(255) NOT NULL,
thedate DATETIME NOT NULL)");#
$ticket_details = file("Ticket_Details.flat");
foreach($ticket_details as $ticket_detailsString)
{
$ticket_detailsString = rtrim($ticket_detailsString);
$details = preg_split("/ +/", $ticket_detailsString);
$details[4] = preg_replace("/_/", " ", $details[4]);
$details[5] = preg_replace("/_/", " ", $details[5]);
$query = "insert into Ticket_Details values('$details[0]', '$details[1]', '$details[2]', '$details[3]', '$details[4]', '$details[5]', '$details[6]')";
mysql_query($query) or die ("Invalid insert " . mysql_error());
}
#now we can close the database
mysql_close($db);
?>
<html>
<head>
<title>Database Setup</title>
</head>
<body>
<p>The database has been initialized.</p>
<p>To submit a ticket, please go to: <a href = "submitTicket.php">Ticket Submission Page</a></p>
</body>
</html>
<?php
#Brian Sisco
#CS 1520 assignment 3
#April 2nd, 2010
#User ticket confirmation page
#This page
# -confirms to the user that their ticket was submitted
# -sends email confirmations to the user and to all tech admins
# -adds the ticket to the database
#if the data was passed from the previous page (ie they didn't come straight here but got here from submitting the form)
if(isset($_POST["firstName"]))
{
#print to screen the confirmation
?>
<html>
<head>
<title>Ticket Received!</title>
</head>
<body>
<p>Your ticket has been submitted. A tech will be assigned and get back to you shortly.</p>
Thank you!
</body>
</html>
<?php
#send the emails. Let's start with the one to the user
#Let's start by stripping tags for safety. We create a new array and add stripped versions of the input to it.
$strippedPost = array();
foreach($_POST as $key => $value)
{
$strippedPost[$key] = strip_tags($value);
}
#extract the users user name, then put that in my email so that the email goes to me, but with their name specified
$sendId = explode("@", $strippedPost["email"]);
$receiver = "bps16+".$sendId[0]."@pitt.edu";
#mail asks for: mail(string $to, string $subject, string $message)
$message = $strippedPost["firstName"]." ".$strippedPost["lastName"].", your ticket has been submitted.";
mail($receiver, "Tech Support Ticket", $message);
#To send the email to the tech admins, we must open the database and get their emails.
#Then while the database is open, we'll add the ticket.
$db = mysql_connect('localhost', 'SiscoBr', "pets-bibs"); #the password is in plain text here because only the grader and I will really see this file.
if($db) #if we connected, select the database
{
mysql_select_db('SiscoBr');
}
else #if we didn't connect, there is no more we can do.
{
die("Could not connect to database " . mysql_error());
}
#The database is now open, so we can now query away!
$query = "select email from Admins";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
$subject = $strippedPost["subject"];
for($i = 0; $i < $num_rows; $i++)
{
$row = mysql_fetch_array($result);
mail($row[0], "Attention Techs", "A new ticket has been filed with subject \"$subject\".");
}
#now we add it to the database
$fName = $strippedPost["firstName"];
$lName = $strippedPost["lastName"];
#$receiver = $receiver;
#$subject = $strippedPost["subject"];
$description = $strippedPost["description"];
$date = date("YmdHis");
#find max id to get a new one.
$query = "select id from Tickets";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
$curr = 0;
$max = 0;
for($i = 0; $i < $num_rows; $i++)
{
$row = mysql_fetch_array($result);
$curr = $row[0];
if($curr > $max)
{
$max = $curr;
}
}
$max++;
$query = "insert into Ticket_Details values('$max', '$fName', '$lName', '$receiver', '$subject', '$description', '$date')";
$result = mysql_query($query);
#$query = "select Ticket_Details.id from Ticket_Details where thedate = '$date' ";
#$result = mysql_query($query);
#echo "result:".$result;
#echo "num rows of result:".mysql_num_rows($result);
#$row = mysql_fetch_array($result);
#$newId = $row[0];
#echo $newId + 1;
$query = "insert into Tickets values('$max', \"open\", 9)";
$result = mysql_query($query);
}
else
{ #if the post data is here, ask them to go to ticket submission
?>
<html>
<head>
<title>Technical Support</title>
</head>
<body>
<p>To submit a ticket, please go to: <a href = "submitTicket.php">Ticket Submission Page</a></p>
Thank you!
</body>
</html>
<?php
}
?>
<?php
#Brian Sisco
#CS 1520 assignment 3
#April 2nd, 2010
#User ticket submission page
?>
<html>
<head>
<title>Ticket Submission</title>
<script type = "text/javascript">
// This function checks whether the fields are filled out and is called upon hitting submit.
function checkComplete()
{
//get the elements of the form. The last one is the submit button, the others are the text fields.
var elements = document.ticketForm.elements;
//we check each one for blankness. We don't check the submit button, so we do "elements.length - 1"
for(var i = 0; i < elements.length - 1; i++)
{
//if one is blank, we tell them to fix it, give focus to the first blank one, and do not submit the form yet
if(elements[i].value == "")
{
alert("All fields are required. Please complete the form and resubmit.");
elements[i].focus();
return false;
}
}
//maybe add checks for if the email address is valid? (with regex?)
return true;
}
</script>
</head>
<body>
<p>
Hello, welcome to Technical Support!
</p>
<p>To receive help, please fill out the following form and we will assign a technician to help you.
<br/>All fields are required.</p>
<form name = "ticketForm" action="processTicket.php" method = "POST" onsubmit = "return checkComplete()">
First Name: <INPUT type = "text" name = "firstName" value = ""> <BR/>
Last Name: <INPUT type = "text" name = "lastName" value = ""> <BR/>
Email address: <INPUT type = "text" name = "email" value = ""> <BR/>
Subject of the problem: <INPUT type = "text" name = "subject" value = ""> <BR/>
Description of the problem: <INPUT type = "textarea" name = "description" value = ""> <BR/>
<input type = "submit" value = "Submit Ticket" />
</form>
</body>
</html>
<?php
#Brian Sisco
#CS 1520 assignment 3
#April 2nd, 2010
#Ticket details page for a particular ticket chosen by an admin
#This page redirects to the login page if you aren't logged in.
session_start();
if( (!isset($_SESSION["id"]) ))#and !isset($_POST["adminChoice"])) or $_POST["adminChoice"] != "View Selected Ticket")
{
session_destroy();
header("Location: adminlogin.php");
exit;
}
#some of the basic page html
?>
<html>
<head>
<title>Ticket Details Page</title>
<script type = "text/javascript">
function getInput()
{
var subject = prompt("What is the subject of the email?");
var body = prompt("What shall the email contain?");
var subEl = document.getElementById('emailSub');
if(subEl)
{
subEl.value = subject;
}
var bodyEl = document.getElementById('emailBody');
if(bodyEl)
{
bodyEl.value = body;
}
}
</script>
</head>
<body>
<?php
#to display the ticket, we must first open the database
$db = mysql_connect('localhost', 'SiscoBr', "pets-bibs"); #the password is in plain text here because only the grader and I will really see this file.
if($db) #if we connected, select the database
{
mysql_select_db('SiscoBr');
}
else #if we didn't connect, there is no more we can do.
{
die("Could not connect to database " . mysql_error());
}
$id = $_POST["selectVal"];
#if they got here by choosing to close the ticket
if($_POST["ticketChoice"] == "Close ticket")
{
#send a query that closes the ticket
$query = "update Tickets set status = 'closed' where id = '$id' and status != 'closed' ";
$resultClose = mysql_query($query);
#we'll send them an email later after we've found their ticket
}
#if they got here by choosing to assign themself to this ticket
if($_POST["ticketChoice"] == "Assign self to ticket")
{
#use a query to get the id that corresponds to the name of the current admin
$adminName = $_SESSION["id"];
$query = "select id, name from Admins where name = '$adminName' ";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$adminId = $row[0];
#send a query that assigns the ticket by updating a row
$query = "update Tickets set techId = $adminId where id = '$id' ";
$result = mysql_query($query);
#the effect of this will be evidenced in the display of the ticket below
}
#if they got here by choosing to remove themself from this ticket
if($_POST["ticketChoice"] == "Remove self from ticket")
{
#send a query that unassigns the ticket
$query = "update Tickets set techId = 9 where id = '$id' ";
$result = mysql_query($query);
#the effect of this will be evidenced in the display of the ticket below
}
#if they got here by choosing to email the submitter
if($_POST["ticketChoice"] == "Email the submitter")
{
#get the variables for the email
$subject = $_POST["emailSub"];
$body = $_POST["emailBody"];
$target = $_POST["emailTarget"];
mail($target, $subject, $body);
echo "The email has been sent to the submitter.";
}
#if they got here by choosing to delete this ticket
if($_POST["ticketChoice"] == "Delete this ticket")
{
#send two queries that delete the ticket, one query for each table the ticket is represented in
$query = "delete from Tickets where id = '$id' ";
$result = mysql_query($query);
$query = "delete from Ticket_Details where id = '$id' ";
$result = mysql_query($query);
#if we delete the ticket, there isn't a ticket to display, so display output:
?>
<p>Ticket deleted.</p>
<p><a href = "admin.php">Go back to Admin Page</a></p>
</body>
</html>
<?php
}
#echo $_POST["selectVal"];
if($_POST["ticketChoice"] != "Delete this ticket") #ie do nothing more if the ticket has been deleted
{
#Querying for the ticket
$query = "select * from Ticket_Details where id = '$id' ";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
#echo "</br>";
#echo $num_rows;
if($num_rows != 1)
{
echo "Invalid ticket.";
}
else
{
$row = mysql_fetch_array($result);
$query = "select status, Admins.name, Admins.id from Admins, Tickets where Tickets.id = '$id' and Admins.id = techId";
$secondResult = mysql_query($query);
$secondRow = mysql_fetch_array($secondResult);
?>
<center>Ticket Details
<table border = \"border\" align = center>
<tr>
<td>Submitter Name:</td>
<td><?php echo $row[1]." ".$row[2]; ?></td>
</tr>
<tr>
<td>Submitter Email:</td>
<td><?php echo $row[3]; ?></td>
</tr>
<tr>
<td>Subject:</td>
<td><?php echo $row[4]; ?></td>
</tr>
<tr>
<td>Description:</td>
<td><?php echo $row[5]; ?></td>
</tr>
<tr>
<td>Submission Date:</td>
<td><?php echo $row[6]; ?></td>
</tr>
<tr>
<td>Status:</td>
<td><?php echo $secondRow[0]; ?></td>
</tr>
<tr>
<td>Tech:</td>
<td><?php echo $secondRow[1]; ?></td>
</tr>
</table>
<form name = "ticketForm" action="ticket.php" method = "POST" style="display: inline;">
<input type = "submit" name = "ticketChoice" value = "Close ticket" /></br>
<?php
if($secondRow[2] == 9)
{
?><input type = "submit" name = "ticketChoice" value = "Assign self to ticket" /></br><?php
}
if($secondRow[1] == $_SESSION["id"]) #ie, the logged in tech is assigned to this ticket
{
?><input type = "submit" name = "ticketChoice" value = "Remove self from ticket" /></br><?php
}
?>
<input type = "submit" name = "ticketChoice" value = "Email the submitter" onclick = "getInput()"/></br>
<input type = "submit" name = "ticketChoice" value = "Delete this ticket" /></br>
<!-- The following are textareas for sending data -->
<input type = "textarea" cols = "0" id = "emailSub" name = "emailSub" value = "" style = "visibility: hidden; display: inline;">
<input type = "textarea" cols = "0" id = "emailBody" name = "emailBody" value = "" style = "visibility: hidden; display: inline;">
<textarea cols = "0" id = "emailTarget" name = "emailTarget" value = "" style = "visibility: hidden; display: inline;"><?php echo $row[3] ?></textarea>
<textarea cols = "0" id = "selectVal" name = "selectVal" value = "" style = "visibility: hidden; display: inline;"><?php $id = $_POST["selectVal"]; echo $id?></textarea>
</form>
<form name = "backForm" action="admin.php" method = "POST" style="display: inline;">
<input type = "submit" name = "adminChoice" value = "View tickets from this Submitter" /></br>
<input type = "submit" name = "adminChoice" value = "Go back to Admin Page" /></br>
<textarea cols = "0" id = "fname" name = "fname" value = "" style = "visibility: hidden; display: inline;"><?php echo $row[1] ?></textarea>
<textarea cols = "0" id = "lname" name = "lname" value = "" style = "visibility: hidden; display: inline;"><?php echo $row[2] ?></textarea>
</form>
</center>
<?php
if($_POST["ticketChoice"] == "Close ticket" and $resultClose == 1) #$resultClose will equal one if above one ticket was closed. This is to prevent emails upon multiple "closings" of one ticket.
{
#if this ticket was JUST closed, we send the user an email here, letting them know their ticket was closed
$receiver = $row[3];
#mail asks for: mail(string $to, string $subject, string $message)
$message = $row[1]." ".$row[2].", your ticket has been closed.";
mail($receiver, "Tech Support Ticket", $message);
}
}
?>
</body>
</html>
<?php
} #this bracket goes with (if not deleted) so it should be last.
?>
@eligioz
Copy link

eligioz commented Jul 7, 2018

how do i get updates about m9bitcoin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment