Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once('settings.php');
- checkLogin('1 2 3 4 5 6 7 8');
- mysql_connect($easyhostname,$easyusername, $easypassword) OR DIE ('Unable to connect to database! Please try again later.'. mysql_error());
- mysql_select_db($easydb);
- if($_GET["cmd"]=="show" || $_POST["cmd"]=="show")
- {
- if(isset($_GET['id']) && $_GET["type"]=="image/jpeg" || $_GET["type"]=="image/pjpeg" || $_GET["type"]=="image/gif" )
- {
- $id = $_GET['id'];
- $query = "SELECT FileName, FileSize, FileData, ContentType, LinkID, Description, Name, Addedby, Permissions, Category, Rank, Locked, LastUpdate FROM Files WHERE ID = '$id'";
- $result = mysql_query($query) or die('Error, query failed');
- //list($FileName, $FileSize, $FileData, $ContentType, $LinkID, $Description, $Name, $Addedby, $Permissions, $Category, $Rank, $Locked, $LastUpdate) = mysql_fetch_array($result);
- $row = mysql_fetch_array($result);
- {
- $data = $row['FileData'];
- $type = $row['ContentType'];
- }
- Header( "Content-type: $type");
- echo $data;
- }
- if(isset($_GET['id']) && $_GET["type"]=="text")
- {
- $id = $_GET['id'];
- $query = "SELECT FileName, FileSize, FileData, ContentType, LinkID, Description, Name, Addedby, Permissions, Category, Rank, Locked, LastUpdate FROM Files WHERE ID = '$id'";
- $result = mysql_query($query) or die('Error, query failed'. mysql_error());
- list($FileName, $FileSize, $FileData, $ContentType, $LinkID, $Description, $Name, $Addedby, $Permissions, $Category, $Rank, $Locked, $LastUpdate) = mysql_fetch_array($result);
- ?>
- <table style="margin-left: 10px" cellspacing="0" cellpadding="0"><tr>
- </tr>
- <tr>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>name</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Description</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Rank to view</b></td>
- <td bgcolor="#E6FFE6"> </td>
- </tr>
- <?
- $result = mysql_query("SELECT * FROM Categories ORDER BY name");
- while($r=mysql_fetch_array($result))
- {
- $name=$r["Name"];
- $id=$r["ID"];
- $desc=$r["Description"];
- if ($r["Rank"]==7):
- $rank="Tao Incarnate";
- elseif ($r["Rank"]==1):
- $rank="Hopeful";
- elseif ($r["Rank"]==2):
- $rank="Believer";
- elseif ($r["Rank"]==3):
- $rank="Follower";
- elseif ($r["Rank"]==4):
- $rank="Disciple";
- elseif ($r["Rank"]==5):
- $rank="Adept";
- elseif ($r["Rank"]==6):
- $rank="Guide";
- endif;
- echo "<tr>";
- echo "<td style=\"padding-left: 5px; padding-right: 5px\"><b>";
- echo "<a href='?page=downloadtest&cmd=view&id=$id&name=$name'>$name</a>";
- echo "</td>";
- echo "<td class=\"downloads2\">$desc</td>";
- echo "<td class=\"downloads2\"><center>$rank</center></td>";
- echo "</tr>";
- }
- echo "<br>";
- echo nl2br($FileData);
- exit;
- }
- }
- if($_GET["cmd"]=="download" || $_POST["cmd"]=="download")
- {
- if(isset($_GET['id']))
- {
- $id = $_GET['id'];
- $query = "SELECT * FROM Files WHERE ID = '$id'";
- $result = mysql_query($query) or die('Error, query failed');
- list($FileName, $FileSize, $FileData, $ContentType) = mysql_fetch_array($result);
- header("Content-length: $FileSize");
- header("Content-type: $ContentType");
- header("Content-Disposition: attachment; filename=$FileName");
- echo $FileData;
- exit;
- }
- }
- ?>
- <table style="margin-left: 10px" cellspacing="0" cellpadding="0"><tr><td bgcolor="#336633" background="../images/darkgreen.gif">
- <table cellspacing="1" cellpadding="3">
- <tr><td colspan="65" class="minitext">
- </td></tr>
- <tr>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>name</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Description</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Rank to view</b></td>
- <td bgcolor="#E6FFE6"> </td>
- </tr>
- <?
- if(!isset($cmd))
- {
- //display all the catigoried
- $result = mysql_query("SELECT * FROM Categories ORDER BY name");
- //run the while loop that grabs all the catagories scripts
- while($r=mysql_fetch_array($result))
- {
- //grab the title and the ID of the rtatoybox
- $name=$r["Name"];//take out the name
- $id=$r["ID"];//take out the id
- $desc=$r["Description"];//take out the description
- $omgitsgod=get_level_access ( $_SESSION['user_id'] );
- // $type=$r[""];
- if ($r["Rank"]==7):
- $rank="Tao Incarnate";
- elseif ($r["Rank"]==1):
- $rank="Hopeful";
- elseif ($r["Rank"]==2):
- $rank="Believer";
- elseif ($r["Rank"]==3):
- $rank="Follower";
- elseif ($r["Rank"]==4):
- $rank="Disciple";
- elseif ($r["Rank"]==5):
- $rank="Adept";
- elseif ($r["Rank"]==6):
- $rank="Guide";
- endif;
- if ($r["Rank"]<=$omgitsgod || isadmin ( $_SESSION['user_id'] ))
- {
- echo "<tr>";
- echo "<td style=\"padding-left: 5px; padding-right: 5px\" class=\"mainlevel\"><b>";
- echo "<a href='?page=downloadtest&cmd=view&id=$id&name=$name&ugh=$id' class=\"mainlevel\">$name</a>";
- echo "</td>";
- echo "<td class=\"downloads\">$desc</td>";
- echo "<td class=\"downloads\"><center>$rank</center></td>";
- echo "</tr>";
- } else {
- echo "<tr>";
- echo "<td style=\"padding-left: 5px; padding-right: 5px\"><b>";
- echo "<div class=\"downloads\">$name</div>";
- echo "</td>";
- echo "<td class=\"downloads\">$desc</td>";
- echo "<td class=\"downloads\"><center>$rank</center></td>";
- echo "</tr>";
- }
- }
- }
- ?>
- <tr><td colspan="65" class="minitext"></td></tr>
- </table></td></tr></table>
- <?
- if ($_GET["cmd"])
- {
- $catname=$_GET["name"];
- $catid=$_GET["ugh"];
- ?>
- <p class="pageheader">\}<?=$catname?>{/</p><br>
- <br>
- <table style="margin-left: 10px" cellspacing="0" cellpadding="0"><tr><td bgcolor="#336633" background="../images/darkgreen.gif">
- <table cellspacing="1" cellpadding="3">
- <tr><td colspan="65" class="minitext">
- </td></tr>
- <tr><td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Name</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>View</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Download</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Description</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Rank to view</b></td>
- <td bgcolor="#E6FFE6" style="font-size: 8pt" align="center"><b>Edit</b></td>
- <td bgcolor="#E6FFE6"> </td></tr>
- <tr><td style="padding-left: 5px; padding-right: 5px">
- <?
- //display all the catigoried
- $result = mysql_query("SELECT * FROM Files ORDER BY name");
- //run the while loop that grabs all the catagories scripts
- while($r=mysql_fetch_array($result))
- {
- $id=$r["ID"];
- $filename=$r["FileName"];
- $catee=$r["Category"];
- if ($type=$r["ContentType"] == "text/plain" || $type=$r["ContentType"] == "text/html")
- {
- $type="text";
- } else {
- $type="image";
- }
- $desc=$r["Description"];
- $name=$r["Name"];
- $addby=$r["AddedBy"];
- $rank=$r["Rank"];
- $locked=$r["Locked"];
- // $rank=$r["Rank"];grab the required rank
- if ($r["Rank"]==7):
- $rank="Tao Incarnate";
- elseif ($r["Rank"]==1):
- $rank="Hopeful";
- elseif ($r["Rank"]==2):
- $rank="Believer";
- elseif ($r["Rank"]==3):
- $rank="Follower";
- elseif ($r["Rank"]==4):
- $rank="Disciple";
- elseif ($r["Rank"]==5):
- $rank="Adept";
- elseif ($r["Rank"]==6):
- $rank="Guide";
- endif;
- if ($catee == $catid && $r["Rank"] <= $omgitsgod && $type == "text")
- {
- echo "<tr>";
- echo "<td style=\"padding-left: 5px; padding-right: 5px\" class=\"mainlevel\"><b>";
- echo "$name";
- echo "</td>";
- echo "<td class=\"downloads\"><a href='?page=downloadtest&cmd=show&id=$id&type=$type'class=\"mainlevel\">View</a></td>";
- echo "<td class=\"downloads\"><a href='download.php?cmd=download&id=$id&type=$type'class=\"mainlevel\">Download</a></td>";
- echo "<td class=\"downloads\">$desc</td>";
- echo "<td class=\"downloads\"><center>$rank</center></td>";
- echo "<td class=\"downloads\">Not Working</td>";
- echo "</tr>";
- } elseif ($catee==$catid && $r["Rank"]>$omgitsgod) {
- echo "<tr>";
- echo "<td style=\"padding-left: 5px; padding-right: 5px\" class=\"mainlevel\"><b>";
- echo "$name";
- echo "</td>";
- echo "<td class=\"downloads\">Can not view</td>";
- echo "<td class=\"downloads\">Can not download</td>";
- echo "<td class=\"downloads\">$desc</td>";
- echo "<td class=\"downloads\"><center>$rank</center></td>";
- echo "<td class=\"downloads\">Not Working</td>";
- echo "</tr>";
- } elseif ($catee==$catid && $type=="image") {
- echo "<tr>";
- echo "<td style=\"padding-left: 5px; padding-right: 5px\" class=\"mainlevel\"><b>";
- echo "$name";
- echo "</td>";
- echo "<td class=\"downloads\"><a href='' onclick=\"return popitup('download.php?cmd=show&id=$id&type=$type')\"class=\"mainlevel\">View</a></td>";
- echo "<td class=\"downloads\"><a href='download.php?cmd=download&id=$id&type=$type'class=\"mainlevel\">Download</a></td>";
- echo "<td class=\"downloads\">$desc</td>";
- echo "<td class=\"downloads\"><center>$rank</center></td>";
- echo "<td class=\"downloads\">Not Working</td>";
- echo "</tr>";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment