Private Label and Cobranded VoIP Solutions
BrainCast internet & phone based message/memo recording & reminder organization system
Internet Phone Service and Broadband Phone Service by ViaTalk

Go Back   VoIP Forums, Internet Phone Service Forums, & Web Hosting Forums > CoderForums - Programming Discussion > General Programming Issues > Programming Languages & Technologies > PHP

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-19-2002, 12:41 PM
SomeOne SomeOne is offline
Registered User
 
Join Date: Feb 2002
Posts: 10
msg for php coders!!!

hello all!
i need a good coder 2 create 4 me a script which track and limit the use of the buttom "submit" in a form. that's mean i specify the number of limited clicks per day on "submit" per user. this is an example:

let's suppose the user "sisa" is using my form and i restricted the use of the submit buttom for this user for 3 times per day so now when he try to use it for the 4th time he should get: " sorry. u exceeded ur limit for this day..."

thnx!
Reply With Quote
  #2  
Old 02-19-2002, 07:30 PM
slade slade is offline
Registered User
 
Join Date: Feb 2002
Posts: 7
Have two files like so:

PHP Code:
<?php

// add.php - adds data and checks user
// connect to database and such

// where ppd is a field in the database 'acronymed' to posts per day
$query "SELECT ppd FROM user_table WHERE username='$username'";
$result mysql_db_query("database",$query) or die("Failed query on line ".__LINE__);
$cl mysql_fetch_object($result);
if (
$cl->ppd >= 3) {
   print 
"Sorry, you have exceded the limit for today.";
} else {
   
$query "INSERT INTO table_name VALUES ('','','','')"// add your values and all that stuff here
    
mysql_db_query("database",$query) or die("failed query on line ".__LINE__);
}

mysql_close();
?>
Now have a file that lets the user add the info into the database:
Code:
<form action="add.php" method="POST">
username <input type="text" name="username">

text <textarea cols=30 rows=10 name="post"></textarea>
<input type="submit">
</form>
Hope this helps.

-Vic
Reply With Quote
  #3  
Old 02-20-2002, 10:43 AM
SomeOne SomeOne is offline
Registered User
 
Join Date: Feb 2002
Posts: 10
10x a lot!
i created a database but i'm receiving this error: Failed query on line 8...
???
2nd question let's suppose the user rejoined another day and tried to "submit" how can the script reset the old datas and start counting from the beginning?

10x
Reply With Quote
  #4  
Old 05-20-2002, 04:54 PM
manual_overide manual_overide is offline
Registered User
 
Join Date: May 2002
Posts: 21
Send a message via AIM to manual_overide
why not just create a cookie based on the date?

well, i guess that would work if you only wanted 1 per day or something...
Reply With Quote
  #5  
Old 05-28-2002, 06:58 PM
sweede sweede is offline
Registered User
 
Join Date: May 2002
Posts: 12
replace the sections,
PHP Code:
 die("failed query on line ".__LINE__); 
with
PHP Code:
die("failed query: [i]"$query "[/i]
"
); 
and that will show you your SQL query if there is an error there.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump