However it has some problems when adding download links..
Users can submit downloads with no title, and also entries with duplicate titles.
Can anyone show me how to fix this?? Here is the submit page:
CODE
<?php include("dbconnect.php"); ?>
<html>
<head>
<title><? echo $sitename ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="Keywords" CONTENT="<? echo $keywords; ?>">
<META NAME="Description" CONTENT="<? echo $description; ?>">
<META NAME="Author" CONTENT="<? echo $yourmail; ?>">
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
<META NAME="REVISIT-AFTER" CONTENT="1 DAYS">
<META NAME="RATING" CONTENT="GENERAL">
<link rel="stylesheet" type="text/css" href="images/evilddl.css" />
</head>
<div align="center">
<body bgcolor="#FFFFFF" text="#000000" link="#333333" vlink="#333333" alink="#333333">
<table width="928" border="0" cellspacing="1" cellpadding="0" class="main">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td background="images/sitetitleback.gif"><img src="images/banner.gif" width="339" height="70"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Menu</td>
</tr>
<tr>
<td class="bottom">
<?php include("menu.txt"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Affiliates</td>
</tr>
<tr>
<td class="bottom">
<?php include("aff.txt"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Top Sites</td>
</tr>
<tr>
<td class="bottom">
<?php $result=mysql_query("select titel, url, points, banner, id from toplist WHERE points > 0 ORDER BY points DESC LIMIT 0,$topsites;");
//fetch all fields from table which's points are > 0 order them by most points, and limit number of records by global defined amount of topsites to be displayed
$rank=1;
while ($row = mysql_fetch_row($result)) //read fields from record set
{
$title=$row[0];
$url=$row[1];
$points=$row[2];
$id=$row[4];
if($rank <= $toptop) //only display first X number of banners
{
$banner=$row[3];
}
if ($banner!="")
{
echo "<a href='$url' target='_blank'><img border=0 src=$banner></A> - $points<BR>";
}
else { ?>:: <a href="site.php?id=<? echo $id ?>"><? echo $title ?></a><br>
<?
}
$banner="";
$rank += 1;
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Search</td>
</tr>
<tr>
<td class="bottom">
<?php include("search.htm"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Stats</td>
</tr>
<tr>
<td class="bottom">
<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo ":: IP: $ip";
?>
<br>
:: Date:
<?PHP
echo date("D M d, Y");
?>
<br>
:: Time:
<?PHP
echo date("H:i:s");
include_once ("online.php");
$visitors_online = new usersOnline();
if (count($visitors_online->error) == 0) {
$online = $visitors_online->count_users();
echo "<br>:: Online: $online";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="735" valign="top">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Advert</td>
</tr>
<tr>
<td class="bottom">
<?php include("ad.htm"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr background="images/tabletop.gif">
<td height="21" colspan="2" class="top">
<p>Add Downloads</p> </td>
</tr>
<tr>
<td class="bottom" valign="top"><?
if(isset($_POST['submit']))
{
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d/m/Y");
$title = addslashes($_POST['title']);
$description = addslashes($_POST['description']);
$link = addslashes($_POST['link']);
$crack = addslashes($_POST['crack']);
$query = "INSERT INTO `downloads` (title, date, description, link, crack, ip) VALUES ('$title','$date','$description', '$link', '$crack', '$ip')";
$result = mysql_query($query);
if ($result) {
echo "<b>Download Added</b><br/>You can add another in 2 seconds.";
echo "<meta http-equiv=Refresh content=2;url=submit.php>";
} else {
echo "Download could not be added.<br/>";
}
}
else
{
?>
<br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Title: <br><input name="title" size="55" maxlength="255">
<br>
<br>
Description:<br><textarea name="description" rows="9" cols="50"></textarea>
<br>
<br>
Link(s):<br> <textarea name="link" rows="6" cols="50">http://test.com/file0.rar<br>
http://test.com/file1.rar<br>
http://test.com/file2.rar<br>
http://test.com/file3.rar</textarea>
<br>
<br>
Crack/Password: <br>
<input name="crack" size="55" maxlength="255">
<br>
<br>
<input type="submit" name="submit" value="Add Download">
</form>
<?php
}
?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center"><?php include("foot.txt"); ?>
</div>
</div>
</td>
</tr>
</table></div>
</body>
</html>
<html>
<head>
<title><? echo $sitename ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="Keywords" CONTENT="<? echo $keywords; ?>">
<META NAME="Description" CONTENT="<? echo $description; ?>">
<META NAME="Author" CONTENT="<? echo $yourmail; ?>">
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
<META NAME="REVISIT-AFTER" CONTENT="1 DAYS">
<META NAME="RATING" CONTENT="GENERAL">
<link rel="stylesheet" type="text/css" href="images/evilddl.css" />
</head>
<div align="center">
<body bgcolor="#FFFFFF" text="#000000" link="#333333" vlink="#333333" alink="#333333">
<table width="928" border="0" cellspacing="1" cellpadding="0" class="main">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td background="images/sitetitleback.gif"><img src="images/banner.gif" width="339" height="70"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Menu</td>
</tr>
<tr>
<td class="bottom">
<?php include("menu.txt"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Affiliates</td>
</tr>
<tr>
<td class="bottom">
<?php include("aff.txt"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Top Sites</td>
</tr>
<tr>
<td class="bottom">
<?php $result=mysql_query("select titel, url, points, banner, id from toplist WHERE points > 0 ORDER BY points DESC LIMIT 0,$topsites;");
//fetch all fields from table which's points are > 0 order them by most points, and limit number of records by global defined amount of topsites to be displayed
$rank=1;
while ($row = mysql_fetch_row($result)) //read fields from record set
{
$title=$row[0];
$url=$row[1];
$points=$row[2];
$id=$row[4];
if($rank <= $toptop) //only display first X number of banners
{
$banner=$row[3];
}
if ($banner!="")
{
echo "<a href='$url' target='_blank'><img border=0 src=$banner></A> - $points<BR>";
}
else { ?>:: <a href="site.php?id=<? echo $id ?>"><? echo $title ?></a><br>
<?
}
$banner="";
$rank += 1;
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Search</td>
</tr>
<tr>
<td class="bottom">
<?php include("search.htm"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Stats</td>
</tr>
<tr>
<td class="bottom">
<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo ":: IP: $ip";
?>
<br>
:: Date:
<?PHP
echo date("D M d, Y");
?>
<br>
:: Time:
<?PHP
echo date("H:i:s");
include_once ("online.php");
$visitors_online = new usersOnline();
if (count($visitors_online->error) == 0) {
$online = $visitors_online->count_users();
echo "<br>:: Online: $online";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="735" valign="top">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr>
<td background="images/tabletop.gif" height="21" class="top">Advert</td>
</tr>
<tr>
<td class="bottom">
<?php include("ad.htm"); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="box">
<tr background="images/tabletop.gif">
<td height="21" colspan="2" class="top">
<p>Add Downloads</p> </td>
</tr>
<tr>
<td class="bottom" valign="top"><?
if(isset($_POST['submit']))
{
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d/m/Y");
$title = addslashes($_POST['title']);
$description = addslashes($_POST['description']);
$link = addslashes($_POST['link']);
$crack = addslashes($_POST['crack']);
$query = "INSERT INTO `downloads` (title, date, description, link, crack, ip) VALUES ('$title','$date','$description', '$link', '$crack', '$ip')";
$result = mysql_query($query);
if ($result) {
echo "<b>Download Added</b><br/>You can add another in 2 seconds.";
echo "<meta http-equiv=Refresh content=2;url=submit.php>";
} else {
echo "Download could not be added.<br/>";
}
}
else
{
?>
<br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Title: <br><input name="title" size="55" maxlength="255">
<br>
<br>
Description:<br><textarea name="description" rows="9" cols="50"></textarea>
<br>
<br>
Link(s):<br> <textarea name="link" rows="6" cols="50">http://test.com/file0.rar<br>
http://test.com/file1.rar<br>
http://test.com/file2.rar<br>
http://test.com/file3.rar</textarea>
<br>
<br>
Crack/Password: <br>
<input name="crack" size="55" maxlength="255">
<br>
<br>
<input type="submit" name="submit" value="Add Download">
</form>
<?php
}
?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center"><?php include("foot.txt"); ?>
</div>
</div>
</td>
</tr>
</table></div>
</body>
</html>
Here is the bit that needs the work:
CODE
<?
if(isset($_POST['submit']))
{
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d/m/Y");
$title = addslashes($_POST['title']);
$description = addslashes($_POST['description']);
$link = addslashes($_POST['link']);
$crack = addslashes($_POST['crack']);
$query = "INSERT INTO `downloads` (title, date, description, link, crack, ip) VALUES ('$title','$date','$description', '$link', '$crack', '$ip')";
$result = mysql_query($query);
if ($result) {
echo "<b>Download Added</b><br/>You can add another in 2 seconds.";
echo "<meta http-equiv=Refresh content=2;url=submit.php>";
} else {
echo "Download could not be added.<br/>";
}
}
else
{
?>
<br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Title: <br><input name="title" size="55" maxlength="255">
<br>
<br>
Description:<br><textarea name="description" rows="9" cols="50"></textarea>
<br>
<br>
Link(s):<br> <textarea name="link" rows="6" cols="50">http://test.com/file0.rar<br>
http://test.com/file1.rar<br>
http://test.com/file2.rar<br>
http://test.com/file3.rar</textarea>
<br>
<br>
Crack/Password: <br>
<input name="crack" size="55" maxlength="255">
<br>
<br>
<input type="submit" name="submit" value="Add Download">
</form>
<?php
}
?>
if(isset($_POST['submit']))
{
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d/m/Y");
$title = addslashes($_POST['title']);
$description = addslashes($_POST['description']);
$link = addslashes($_POST['link']);
$crack = addslashes($_POST['crack']);
$query = "INSERT INTO `downloads` (title, date, description, link, crack, ip) VALUES ('$title','$date','$description', '$link', '$crack', '$ip')";
$result = mysql_query($query);
if ($result) {
echo "<b>Download Added</b><br/>You can add another in 2 seconds.";
echo "<meta http-equiv=Refresh content=2;url=submit.php>";
} else {
echo "Download could not be added.<br/>";
}
}
else
{
?>
<br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Title: <br><input name="title" size="55" maxlength="255">
<br>
<br>
Description:<br><textarea name="description" rows="9" cols="50"></textarea>
<br>
<br>
Link(s):<br> <textarea name="link" rows="6" cols="50">http://test.com/file0.rar<br>
http://test.com/file1.rar<br>
http://test.com/file2.rar<br>
http://test.com/file3.rar</textarea>
<br>
<br>
Crack/Password: <br>
<input name="crack" size="55" maxlength="255">
<br>
<br>
<input type="submit" name="submit" value="Add Download">
</form>
<?php
}
?>
Thanks in advance for any help, im not very good at coding.


