Sindbad~EG File Manager
<?php
session_start();
$Username = $_GET['Username']; // possibly passed by referring page, e.g. login.php
require_once('query.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Browse Recipes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body BGCOLOR="#ffffcc">
<P><EM>Click the name of the recipe you want to see.</EM></P>
<table border=1 cellspacing="5" cellpadding ="10">
<tr><th>Name of Dish</th><th>Posted by</th><th>Category</th><th>Nationality</th></tr>
<?php
function getName($FirstName, $LastName)
{ $Ans = $FirstName . " " . $LastName;
return $Ans;
}
if(is_null($Username))
$sql = "SELECT RecipeId,Recipes.PersonId,RecipeName,RecipeType, Nationality , FirstName,LastName, SanskritName, People.PersonId
FROM Recipes,People WHERE People.PersonId=Recipes.PersonId;";
else
$sql = "SELECT RecipeId,Recipes.PersonId,RecipeName,RecipeType, Nationality , FirstName,LastName, SanskritName, People.PersonId, Username
FROM Recipes,People WHERE People.PersonId=Recipes.PersonId AND Username = '$Username';";
$q = Query($sql);
while($q->fetchInto($row))
{ $RecipeId = $row[0];
$PersonId = $row[1];
$RecipeName = $row[2];
$RecipeType = $row[3];
$Nationality = $row[4];
$FirstName = $row[5];
$LastName = $row[6];
$SanskritName = $row[7];
$Name = getName($FirstName, $LastName);
print("<tr>");
print("<td>");
if(is_null($Username))
$link = "<A HREF=\"DisplayRecipe.php?RecipeId=$row[0]\">";
else
$link = "<A HREF=\"DisplayRecipe.php?RecipeId=$row[0]&Username=$Username\">";
print($link);
print( stripslashes($RecipeName));
printf("</A>");
print("</td>");
print("<td>");
print ($Name);
print("</td>");
print("<td>$RecipeType</td>");
print("<td>$Nationality</td>");
print("</tr>");
}
?>
</table>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists