<?php
session_save_path("/home/users/web/b557/sl.flyingcoachlimo/public_html/cgi-bin/tmp");
session_start();
if (!isset($_SESSION["verified"])) {
header ("Location: index.php");
exit();
}
// Connect to the database
if (isset($_GET['limoID']))
$limoID = $_GET['limoID'];
if (isset($_POST['limoID']))
$limoID = $_POST['limoID'];
include("incDBConnectAdmin.php");
$query = "SELECT * FROM limos WHERE eID='" . $limoID . "'";
// Place results into variables
$result = mysql_query($query);
if(!$result)
{
echo 'Query failed: '.mysql_error();
}
while($row = mysql_fetch_array($result))
{
$limoname = $row[1];
$limoload = $row[2];
$limodetails = $row[3];
}
// Determine if the user had submitted new data and update the database
if (isset($_POST["submitselect"])) {
$limoID = $_POST['limoID'];
$limoLink = $_POST['limoLink'];
$query = "UPDATE imagesLimos SET eLink = '" . $limoID . "' WHERE eFilename = '" . $limoLink . "'";
mysql_query($query) or die("<br>error");
echo "<br><h3 style=color:red>Limousine photo has been set</h3>";
}
if (isset($_POST["submitunselect"])) {
$limoID = $_POST['limoID'];
$limoLink = $_POST['limoLink'];
$query = "UPDATE imagesLimos SET eLink = '0' WHERE eFilename = '" . $limoLink . "'";
mysql_query($query) or die("<br>error");
echo "<br><h3 style=color:red>Limousine photo has been set</h3>";
}
?>
<link rel="stylesheet" href="../stylesheet.css" type="text/css" />
<table align="center" border="0" width="350">
<tr valign="top" height="25" colspan="4">
<td colspan="4">
<h1>
www.LetUsDesign.it - Edit.it CMS v1.0.7
</h1>
</td>
</tr>
<tr colspan="4">
<td colspan="4">
<br/><br/>
Set Limousine Photos
<br/><br/>
Limo Name: <?php echo $limoname; ?><br/>
<tr colspan="4">
<td colspan="4">
<br/><br/><br/>
The following photos are allocated to the <?php echo $limoname; ?>:
<hr>
</td>
</tr>
<tr>
<?php
$query2 = "SELECT eName FROM limos";
$result2 = mysql_query($query2);
$limoArray[] = mysql_fetch_array($result2);
$query = "SELECT eFilename, eLink FROM imagesLimos WHERE eLink = '" . $limoID ."'";
$counter = 0;
// Place results into variables
$result = mysql_query($query);
if(!$result)
{
echo 'Query failed: '.mysql_error();
}
while($row = mysql_fetch_array($result))
{
if ($counter == 0)
echo "<tr>";
echo "<td>";
echo "<form action='setlimo.php' method='POST'>";
echo "<a href='../images/limos/" . $row[0] . "'>" . $row[0] . "</a>";
echo "<br>";
echo "<br>";
echo "<input type='submit' name='submitunselect' value='Unset photo'>";
echo "<br>";
echo "<input type='hidden' name='limoID' value='" . $limoID . "'>";
echo "<input type='hidden' name='limoLink' value='" . $row[0] . "'>";
echo "</form>";
echo "<br>";
echo "<br>";
echo "</td>";
if ($counter == 3) {
echo "</tr>";
$counter = -1;
}
$counter++;
}
?>
</tr>
<tr colspan="4">
<td colspan="4">
<br/><br/><br/>
The following photos are **NOT** allocated to the <?php echo $limoname; ?>:
<hr>
</td>
</tr>
<tr>
<?php
$query2 = "SELECT eName FROM limos";
$result2 = mysql_query($query2);
$limoArray[] = mysql_fetch_array($result2);
$query = "SELECT eFilename, eLink FROM imagesLimos WHERE eLink <> '" . $limoID ."'";
$counter = 0;
// Place results into variables
$result = mysql_query($query);
if(!$result)
{
echo 'Query failed: '.mysql_error();
}
while($row = mysql_fetch_array($result))
{
if ($counter == 0)
echo "<tr>";
echo "<td>";
echo "<form action='setlimo.php' method='POST'>";
echo "<a href='../images/limos/" . $row[0] . "'>" . $row[0] . "</a>";
echo "<br>";
echo "<br>";
echo "<input type='submit' name='submitselect' value='Set photo'>";
echo "<br>";
echo "<input type='hidden' name='limoID' value='" . $limoID . "'>";
echo "<input type='hidden' name='limoLink' value='" . $row[0] . "'>";
echo "</form>";
echo "<br>";
echo "<br>";
echo "</td>";
if ($counter == 3) {
echo "</tr>";
$counter = -1;
}
$counter++;
}
?>
</tr>
</td>
</tr>
<tr>
<td>
<br/><br/>
<a href="main.php">Go Back To Main Menu</a>
<br/><br/>
<a href="logout.php">Logout of Page Editor</a>
</td>
</tr>
</table>
</form>
</body>
</html>