<?php
/******************************************************************************
************** Simple SMS Site Software *********************************
************** SSSSv1.0*****************************************************
************** by (aq) limited http://aql.com *******************************
************** All Rights Reserved ******************************************
************** Please read COPYRIGHT file prior to modification********
********************************************************************************/
session_start();
$user = $_SESSION['user'];
$pass = $_SESSION['pass'];
$the_ref = $_GET['id'];
$the_user = $_GET['repuser'];
include("inc/dbinfo.inc.php");
include("inc/validate.inc.php");
include("inc/options.inc.php");
?>
<html>
<body>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<LINK REL=StyleSheet HREF="inc/style/style.php" TYPE="text/css">
<title><?echo $title;?></title>
</head>
<?
if ($access == "forbidden") {
include("inc/restricted.inc.php");
}
elseif ($access == "locked") {
include("inc/restricted.inc.php");
}
elseif ($access == "admin" || $user == $the_user) {
include("inc/dbinfo.inc.php");
?>
<h1>Message Report Viewer</h1>
<?
// query db, make array of destination numbers
$query = "SELECT destinationnum FROM delrep WHERE reference=$the_ref";
$result = mysql_query($query);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$dest_row = mysql_fetch_row($result);
// query db, make array of report codes
$query = "SELECT reportcode FROM delrep WHERE reference=$the_ref";
$result = mysql_query($query);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$code_row = mysql_fetch_row($result);
if ($access == "admin") {
$query = "SELECT * FROM sent_messages WHERE id='$the_ref'";
}
else {
$query = "SELECT * FROM sent_messages WHERE id='$the_ref' AND username='$user'";
}
$result = mysql_query($query);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
if ($code_row[0] == 1) {
$the_code = "Delivered";
}
elseif ($code_row[0] == 2) {
$the_code = "Failed";
}
elseif ($code_row[0] == 4) {
$the_code = "Buffered";
}
elseif ($code_row[0] == 8) {
$the_code = "Accepted by SMSC";
}
elseif ($code_row[0] == 16) {
$the_code = "Rejected by SMSC";
}
else {
$the_code = "Failed";
}
if ($row[0]){
?>
<table width=350>
<tr> <td width=125><b>Username</b></td> <td width=225><?echo $row[1];?></td> </tr>
<tr> <td width=125><b>Destination</b></td> <td width=225><?echo $dest_row[0];?></td> </tr>
<tr> <td width=125><b>Status</b></td> <td width=225><?echo $the_code;?></td> </tr>
<tr> <td width=125><b>Time sent</b></td> <td width=225><?echo $row[7];?></td> </tr>
<tr> <td width=125><b>Originator</b></td> <td width=225><?echo $row[3];?></td> </tr>
<tr> <td width=125><b>Message type</b></td> <td width=225><?echo $row[4];?></td> </tr>
<tr> <td width=125><b>Flash Message</b></td> <td width=225><?echo $row[5];?></td> </tr>
<tr> <td width=125><b>Contents</b></td> <td width=225><?echo $row[6];?></td> </tr>
<tr> <td width=125><b>Wap Address</b></td> <td width=225><?echo $row[2];?></td> </tr>
</table>
<?
}
else {
include ("restricted.inc.php");
}
}
else {
include ("restricted.inc.php");
}
?>