...

View Full Version : Limit Form Submission



Chris-2k
05-17-2011, 05:24 PM
hia,

can any1 help me wit this:



<?
session_start(); // start The session
if (!$_SESSION['count']) {
$_SESSION['count']=0;
}
if ($_POST['submit']) {
$session_count=$_SESSION['count'];
$session_count++;
if($session_count>5) {
echo"You have reached the limit!";
exit;
} elseif ($session_count<=3) {
echo("submitting data..");
}
echo("setting session to: ".$session_count);
$_SESSION['count']=$session_count;
} else {
?>
what i wanna do is limit the form to 5 submissons per 24 hrs but in my submit.php i have 10x text inputs, so 10 x 5 = 50 but what if a user only does 5 x inputs and 5 x submissions = 25 then the form disabled, only i need each session to have 50 x inpputs per 24 hrs... Any help?

djh101
05-17-2011, 05:52 PM
Sessions expire when the user closes their browser so you should use cookies for this. If you want to restrict users to 5 submissions per form, you will have to store a cookie for each form individually (at least this would be the easiest way).

if($_POST['submit'){
if(isset($_COOKIE['submit1']){
if($_COOKIE['submit1'] >= 5){
//maximum forms submitted
} else {
$_COOKIE['submit'] += 1;
} else {
setcookie('submit1', 1, 86400);
}
}

There's probably a more efficient way to pull this off, I'll double check this post after I get back from school.

Chris-2k
05-17-2011, 06:27 PM
Sessions expire when the user closes their browser so you should use cookies for this. If you want to restrict users to 5 submissions per form, you will have to store a cookie for each form individually (at least this would be the easiest way).

if($_POST['submit'){
if(isset($_COOKIE['submit1']){
if($_COOKIE['submit1'] >= 5){
//maximum forms submitted
} else {
$_COOKIE['submit'] += 1;
} else {
setcookie('submit1', 1, 86400);
}
}

There's probably a more efficient way to pull this off, I'll double check this post after I get back from school.

when i add ur code, i get white page, can u checkplz:



submit.php


<?php
include "funcs.php";
if(isset($_POST) && !empty($_POST))
$sub_success = $core->doSubmit();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>XtremeDDL - Free &amp; Full Direct Downloads - Rapidshare, Megaupload, Mediafire, Fileserve, Filesonic &amp; More...</title>

<meta name="keywords" content="download link, rapidshare, hotfile, movie, tv show, games, software, application, 0day, c, patch, activation, music, album, latest, full version, free porn, dvdrip downloads, templates, nulled, scripts " />

<meta name="description" content="The ultimate underground search engine for download links and latest full version softwares with free music albums, rapidshare and hotfile dvd movie downloads" />

<meta name="robots" content="index, follow" />

<link rel="stylesheet" href="style.css" type="text/css" media="screen" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>

<body>

<!-- Header Start -->
<div id="header">

<!-- Logo -->
<a href="index.php"><img id="logo" src="images/logo.gif" width="400" height="119" title="logo" border="0" /></a>

<!-- Top Nav -->
<div id="topnav">
<ul>
<li><a href="/">Homepage</a></li>
<li><a href="submit.php">Submit Downloads</a></li>
<li><a href="contact.php">Contact Us</a></li>
<li><a href="webmasters.php">Webmasters Panel</a></li>
</ul>
</div>

<!-- Banner Space -->
<a href="#"><img src="images/banner-space.gif" width="468" height="60" style="float:right; padding-top:28px;" alt="banner" border="0" /></a>
</div>
<!-- Header End -->

<!-- Navigation -->
<div id="navigation">
<ul>
<li><a href="/"><img src="images/home.png" width="24" height="24" alt="Home" border="0" /></a></li>
<li><a href="type-app.html">Softwares</a></li>
<li><a href="type-game.html">Games</a></li>
<li><a href="type-music.html">Music</a></li>
<li><a href="type-movie.html">Movies</a></li>
<li><a href="type-tv.html">TV Shows</a></li>
<li><a href="type-xxx.html">Adult</a> <span style="font-size:8px; color:#F0C;">(18+)</span></li>
<li><a href="type-other.html">Other Downloads</a></li>
</ul>

<a href="javascript:bookmarksite('XtremeDDL Free & Full Downloads','http://xtremeddl.net')"><img src="images/icons/favorite.png" width="18" height="18" style="opacity:0.4;filter:alpha(opacity=40);float:right; padding:12px; vertical-align:middle;"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" title="Bookmark Us!" border="0" /></a>
</div>
<!-- / Navigation -->

<!-- Content Area -->
<div class="content-top-btm"><img src="images/content-top.gif" width="1000" height="20" /></div>

<div id="content-bg">

<!-- Downloads Start -->
<div id="downloads"> <p>Here are some <b>General Rules</b> that this site will follow and any submitters should follow too...<br><br>

* No more than 50 downloads per site/per 24 hours.<br>
* You must have the exact <a href="linktous.php">linking code</a> to XtremeDDL on your pages.<br>
* Link directly to your download page, not your main page.<br>
* No popup adverts are allowed.<br>
* Do NOT submit direct links to file hosting websites.<br>
* Do NOT change the submitted page after submissions.<br>
* Do NOT submit the same page twice because it will be rejected.<br>
* No torrent, magnet, fake paysite or similiar links.<br>
* No link to Katz on your website (since they have turned into a paysite and linking to a paysite is NOT allowed)</p>


<form action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="info">
<tr>
<td width="250">Title</td>
<td width="250">URL</td>
<td width="250">Type</td>
</tr></table>

<div class="clear"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-top:12px;">
<?php
for($i=1;$i<=10;$i++) {
?>
<td width="250"><input type="text" class="inputbox" name="title[]" id="dt1" cols="80" /></td>
<td width="250"><input type="text" class="inputbox" name="url[]" id="du1" /></td>
<td width="250">&nbsp;
<select name="type[]" class="inputbox smallbox" id="se1">
<?php
foreach($core->allowed_types as $at) {
echo '<option value="'.$at.'">'.$at.'</option>';
}
?>
</select></td>
</tr>
<?php
}
?>
<tr>
<td style="padding:10px;text-align:center;"></td>
</tr>
<tr>
<td colspan="3" align="center">
Site Name: <input type="text" class="inputbox" name="sname" id="zname"/>
Site URL: <input type="text" class="inputbox" name="surl" id="zurl"/><br />

Email: <input type="text" class="inputbox" name="email" id="zemail"/>
&nbsp;
<input type="submit" value="Submit Downloads" /></td></tr>
<tr>
<td colspan="3" align="center" style="color:#FF0000;"><br />
<?=$core->error?></td>
</tr>
<tr>
<td colspan="3" align="center" style="color:green;"><br />
<?=$sub_success?></td>
</tr>
</table>
</form><div style="clear:both;"></div>

</form>

<br/>

</div>
<!-- Downloads End -->
</div>

<div class="content-top-btm"><img src="images/content-end.gif" width="1000" height="20" /></div>
<!-- / Content Area -->

<!-- Footer -->
<div id="footer">

<div class="foottitle">Navigation

<div class="clear"></div>

<div class="footnav">
&raquo; <a href="submit.php">Submit Downloads</a><br />
&raquo; <a href="whitelist.php">Whitelist Request</a><br />
&raquo; <a href="blacklist.php">Blacklist Checker</a>
</div></div>

<div class="v-sep">&nbsp;</div>

<div class="foottitle">Partners

<div class="clear"></div>

<div class="footnav">
<?=$core->templateVar("linkex")?>
</div></div>

<div class="v-sep">&nbsp;</div>

<div style="width:1000px; height:20px;">&nbsp;</div>

<div class="h-sep">&nbsp;</div>

<p class="footpara">We have <strong><?=array_sum($dls)?></strong> downloads in our database and <strong><?=$inqueue?></strong> in the queue.

<?=$core->templateVar("indexedinfo")?></p>

<!-- Facebook & Twitter -->
<div id="fb-tw-icon">
<a href="http://facebook.com/"><img src="images/icons/fb.png" width="18" height="18" border="0" title="Find us on Facebook!" /></a>
<a href="http://twitter.com/"><img src="images/icons/twitter.png" width="18" height="18" border="0" title="Follow us on Twitter!" /></a>
</div>
<!-- / Facebook & Twitter -->
</div>

<div id="footer-end"><img src="images/footer-end.gif" width="1000" height="60" /></div>

<div id="copyright"><a href="index.php">XtremeDDL.net</a> &copy; 2011. Some rights reserved. | Powered By WCDDL V2.</div>

</body>
</html>
<?php

?>

djh101
05-18-2011, 01:14 AM
<form ... >
...
<input type="hidden" name="formid" value="f1" />
</form>

<?
if($_POST['formid'){
$formid = $_POST['formid']; //standard variables are easier to work with
if(isset($_COOKIE[$formid]){
if($_COOKIE[$formid] >= 5){
//Insert code here for when the user has reached their submission limit
} else {
$_COOKIE[$formid] += 1;
//insert code here to complete submission of form data
} else {
setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds
}
}
?>

And yes, it's going to be blank if you don't insert any code. Insert some code inside the if cookie is greater than or equal to 5 statement to be executed if the user has reached their limit and inside the else statement to use the form data to do whatever it is you plan to do with it.

Chris-2k
05-18-2011, 11:49 PM
yo, i did wot u said and still get a white page, plz loook:



<?php
include "funcs.php";
if(isset($_POST) && !empty($_POST))
$sub_success = $core->doSubmit();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>XtremeDDL - Free &amp; Full Direct Downloads - Rapidshare, Megaupload, Mediafire, Fileserve, Filesonic &amp; More...</title>

<meta name="keywords" content="download link, rapidshare, hotfile, movie, tv show, games, software, application, 0day, c, patch, activation, music, album, latest, full version, free porn, dvdrip downloads, templates, nulled, scripts " />

<meta name="description" content="The ultimate underground search engine for download links and latest full version softwares with free music albums, rapidshare and hotfile dvd movie downloads" />

<meta name="robots" content="index, follow" />

<link rel="stylesheet" href="style.css" type="text/css" media="screen" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>

<body>

<!-- Header Start -->
<div id="header">

<!-- Logo -->
<a href="index.php"><img id="logo" src="images/logo.gif" width="400" height="119" title="logo" border="0" /></a>

<!-- Top Nav -->
<div id="topnav">
<ul>
<li><a href="/">Homepage</a></li>
<li><a href="submit.php">Submit Downloads</a></li>
<li><a href="contact.php">Contact Us</a></li>
<li><a href="webmasters.php">Webmasters Panel</a></li>
</ul>
</div>

<!-- Banner Space -->
<a href="#"><img src="images/banner-space.gif" width="468" height="60" style="float:right; padding-top:28px;" alt="banner" border="0" /></a>
</div>
<!-- Header End -->

<!-- Navigation -->
<div id="navigation">
<ul>
<li><a href="/"><img src="images/home.png" width="24" height="24" alt="Home" border="0" /></a></li>
<li><a href="type-app.html">Softwares</a></li>
<li><a href="type-game.html">Games</a></li>
<li><a href="type-music.html">Music</a></li>
<li><a href="type-movie.html">Movies</a></li>
<li><a href="type-tv.html">TV Shows</a></li>
<li><a href="type-xxx.html">Adult</a> <span style="font-size:8px; color:#F0C;">(18+)</span></li>
<li><a href="type-other.html">Other Downloads</a></li>
</ul>

<a href="javascript:bookmarksite('XtremeDDL Free & Full Downloads','http://xtremeddl.net')"><img src="images/icons/favorite.png" width="18" height="18" style="opacity:0.4;filter:alpha(opacity=40);float:right; padding:12px; vertical-align:middle;"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" title="Bookmark Us!" border="0" /></a>
</div>
<!-- / Navigation -->

<!-- Content Area -->
<div class="content-top-btm"><img src="images/content-top.gif" width="1000" height="20" /></div>

<div id="content-bg">

<!-- Downloads Start -->
<div id="downloads"> <p>Here are some <b>General Rules</b> that this site will follow and any submitters should follow too...<br><br>

* No more than 50 downloads per site/per 24 hours.<br>
* You must have the exact <a href="linktous.php">linking code</a> to XtremeDDL on your pages.<br>
* Link directly to your download page, not your main page.<br>
* No popup adverts are allowed.<br>
* Do NOT submit direct links to file hosting websites.<br>
* Do NOT change the submitted page after submissions.<br>
* Do NOT submit the same page twice because it will be rejected.<br>
* No torrent, magnet, fake paysite or similiar links.<br>
* No link to Katz on your website (since they have turned into a paysite and linking to a paysite is NOT allowed)</p>

. <form action="" id="submitdownloads" method="post">

<?php
for($i=1;$i<=10;$i++) {
?>

<input type="text" class="inputbox" name="title[]" id="dt1" cols="80" />
<input type="text" class="inputbox" name="url[]" id="du1" />
<select name="type[]" class="inputbox smallbox" id="se1">
<?php
foreach($core->allowed_types as $at) {
echo '<option value="'.$at.'">'.$at.'</option>';
}
?>
</select>
<?php
}
?>

<div>Site Name: <input type="text" class="inputbox" name="sname" id="zname"/>
Site URL: <input type="text" class="inputbox" name="surl" id="zurl"/><br />
Email: <input type="text" class="inputbox" name="email" id="zemail"/>
<input type="submit" value="Submit Downloads" /></div>

<div><?=$core->error?>
<br /><?=$sub_success?></div>
</form>

<?
if($_POST['submitdownloads'){
$formid = $_POST['submitdownloads']; //standard variables are easier to work with
if(isset($_COOKIE[$formid]){
if($_COOKIE[$formid] >= 2){
echo('Thanks for submitting your downloads, you have now reached the limit');
} else {
$_COOKIE[$formid] += 1;
echo('Submitting data...');
} else {
setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds
}
}
?>
<br/>

</div>
<!-- Downloads End -->
</div>

<div class="content-top-btm"><img src="images/content-end.gif" width="1000" height="20" /></div>
<!-- / Content Area -->

<!-- Footer -->
<div id="footer">

<div class="foottitle">Navigation

<div class="clear"></div>

<div class="footnav">
&raquo; <a href="submit.php">Submit Downloads</a><br />
&raquo; <a href="whitelist.php">Whitelist Request</a><br />
&raquo; <a href="blacklist.php">Blacklist Checker</a>
</div></div>

<div class="v-sep">&nbsp;</div>

<div class="foottitle">Partners

<div class="clear"></div>

<div class="footnav">
<?=$core->templateVar("linkex")?>
</div></div>

<div class="v-sep">&nbsp;</div>

<div style="width:1000px; height:20px;">&nbsp;</div>

<div class="h-sep">&nbsp;</div>

<p class="footpara">We have <strong><?=array_sum($dls)?></strong> downloads in our database and <strong><?=$inqueue?></strong> in the queue.

<?=$core->templateVar("indexedinfo")?></p>

<!-- Facebook & Twitter -->
<div id="fb-tw-icon">
<a href="http://facebook.com/"><img src="images/icons/fb.png" width="18" height="18" border="0" title="Find us on Facebook!" /></a>
<a href="http://twitter.com/"><img src="images/icons/twitter.png" width="18" height="18" border="0" title="Follow us on Twitter!" /></a>
</div>
<!-- / Facebook & Twitter -->
</div>

<div id="footer-end"><img src="images/footer-end.gif" width="1000" height="60" /></div>

<div id="copyright"><a href="index.php">XtremeDDL.net</a> &copy; 2011. Some rights reserved. | Powered By WCDDL V2.</div>

</body>
</html>
<?php

?>


thanks

Chris-2k
05-20-2011, 11:14 PM
.hia, im still getting blank page, can u try it:



<?php
include "funcs.php";
if(isset($_POST) && !empty($_POST))
$sub_success = $core->doSubmit();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>XtremeDDL - Free &amp; Full Direct Downloads - Rapidshare, Megaupload, Mediafire, Fileserve, Filesonic &amp; More...</title>

<meta name="keywords" content="download link, rapidshare, hotfile, movie, tv show, games, software, application, 0day, c, patch, activation, music, album, latest, full version, free porn, dvdrip downloads, templates, nulled, scripts " />

<meta name="description" content="The ultimate underground search engine for download links and latest full version softwares with free music albums, rapidshare and hotfile dvd movie downloads" />

<meta name="robots" content="index, follow" />

<link rel="stylesheet" href="style.css" type="text/css" media="screen" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>

<body>

<!-- Header Start -->
<div id="header">

<!-- Logo -->
<a href="index.php"><img id="logo" src="images/logo.gif" width="400" height="119" title="logo" border="0" /></a>

<!-- Top Nav -->
<div id="topnav">
<ul>
<li><a href="/">Homepage</a></li>
<li><a href="submit.php">Submit Downloads</a></li>
<li><a href="contact.php">Contact Us</a></li>
<li><a href="webmasters.php">Webmasters Panel</a></li>
</ul>
</div>

<!-- Banner Space -->
<a href="#"><img src="images/banner-space.gif" width="468" height="60" style="float:right; padding-top:28px;" alt="banner" border="0" /></a>
</div>
<!-- Header End -->

<!-- Navigation -->
<div id="navigation">
<ul>
<li><a href="/"><img src="images/home.png" width="24" height="24" alt="Home" border="0" /></a></li>
<li><a href="type-app.html">Softwares</a></li>
<li><a href="type-game.html">Games</a></li>
<li><a href="type-music.html">Music</a></li>
<li><a href="type-movie.html">Movies</a></li>
<li><a href="type-tv.html">TV Shows</a></li>
<li><a href="type-xxx.html">Adult</a> <span style="font-size:8px; color:#F0C;">(18+)</span></li>
<li><a href="type-other.html">Other Downloads</a></li>
</ul>

<a href="javascript:bookmarksite('XtremeDDL Free & Full Downloads','http://xtremeddl.net')"><img src="images/icons/favorite.png" width="18" height="18" style="opacity:0.4;filter:alpha(opacity=40);float:right; padding:12px; vertical-align:middle;"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" title="Bookmark Us!" border="0" /></a>
</div>
<!-- / Navigation -->

<!-- Content Area -->
<div class="content-top-btm"><img src="images/content-top.gif" width="1000" height="20" /></div>

<div id="content-bg">

<!-- Downloads Start -->
<div id="downloads"> <p>Here are some <b>General Rules</b> that this site will follow and any submitters should follow too...<br><br>

* No more than 50 downloads per site/per 24 hours.<br>
* You must have the exact <a href="linktous.php">linking code</a> to XtremeDDL on your pages.<br>
* Link directly to your download page, not your main page.<br>
* No popup adverts are allowed.<br>
* Do NOT submit direct links to file hosting websites.<br>
* Do NOT change the submitted page after submissions.<br>
* Do NOT submit the same page twice because it will be rejected.<br>
* No torrent, magnet, fake paysite or similiar links.<br>
* No link to Katz on your website (since they have turned into a paysite and linking to a paysite is NOT allowed)</p>

<?php
if($_POST['submit'){

$formid = $_POST['submitdownloads']; //standard variables are easier to work with
if(isset($_COOKIE[$formid]){
if($_COOKIE[$formid] >= 2){
echo("Thanks for submitting your downloads, you have now reached the limit");
} else {
$_COOKIE[$formid] += 1;
echo("Submitting data...");
} else {
setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds
}
}
?>
. <form action="" id="submitdownloads" method="post">

<?php
for($i=1;$i<=10;$i++) {
?>

<div>
<input type="text" class="inputbox" name="title[]" id="dt1" cols="80" />
<input type="text" class="inputbox" name="url[]" id="du1" />
<select name="type[]" class="inputbox smallbox" id="se1">
<?php
foreach($core->allowed_types as $at) {
echo '<option value="'.$at.'">'.$at.'</option>';
}
?>
</select></div>
<?php
}
?>

<div>Site Name: <input type="text" class="inputbox" name="sname" id="zname"/>
Site URL: <input type="text" class="inputbox" name="surl" id="zurl"/><br />
Email: <input type="text" class="inputbox" name="email" id="zemail"/>
<input type="submit" value="Submit Downloads" /></div>

<div><?=$core->error?>
<br /><?=$sub_success?></div>
</form>

</div>
<!-- Downloads End -->
</div>

<div class="content-top-btm"><img src="images/content-end.gif" width="1000" height="20" /></div>
<!-- / Content Area -->

<!-- Footer -->
<div id="footer">

<div class="foottitle">Navigation

<div class="clear"></div>

<div class="footnav">
&raquo; <a href="submit.php">Submit Downloads</a><br />
&raquo; <a href="whitelist.php">Whitelist Request</a><br />
&raquo; <a href="blacklist.php">Blacklist Checker</a>
</div></div>

<div class="v-sep">&nbsp;</div>

<div class="foottitle">Partners

<div class="clear"></div>

<div class="footnav">
<?=$core->templateVar("linkex")?>
</div></div>

<div class="v-sep">&nbsp;</div>

<div style="width:1000px; height:20px;">&nbsp;</div>

<div class="h-sep">&nbsp;</div>

<p class="footpara">We have <strong><?=array_sum($dls)?></strong> downloads in our database and <strong><?=$inqueue?></strong> in the queue.

<?=$core->templateVar("indexedinfo")?></p>

<!-- Facebook & Twitter -->
<div id="fb-tw-icon">
<a href="http://facebook.com/"><img src="images/icons/fb.png" width="18" height="18" border="0" title="Find us on Facebook!" /></a>
<a href="http://twitter.com/"><img src="images/icons/twitter.png" width="18" height="18" border="0" title="Follow us on Twitter!" /></a>
</div>
<!-- / Facebook & Twitter -->
</div>

<div id="footer-end"><img src="images/footer-end.gif" width="1000" height="60" /></div>

<div id="copyright"><a href="index.php">XtremeDDL.net</a> &copy; 2011. Some rights reserved. | Powered By WCDDL V2.</div>

</body>
</html>
<?php

?>


tyvm.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum