Jump to content

mnewton91

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mnewton91's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Any ideas on how i would do this?
  2. Okay, so i added a field called "IP_Address" to the SQL and it's submitting the IP Address properly, BUT. It's not checking and returning an error, cause i can post more than one quote using this code.. <?php $con = mysql_connect("localhost","quotes","xxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } $date = date("Y/m/d - H:i:s"); mysql_select_db("quotes", $con); $ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); $qd = mysql_real_escape_string($_POST['Quote_Data']); $qb = mysql_real_escape_string($_POST['Quoted_By']); $sql1 = "select * from Quotes where IP_Address = '$ip' and Date_Time = '$date'"; $rs = mysql_query( $sql1, $con ) or die( "Err: Query 1"); if(mysql_num_rows($rs)!=1) { $sql2="INSERT INTO Quotes (Quote_Data, Quoted_By , Date_Time, IP_Address) VALUES ('$qd','$qb','$date','$ip')"; $rs = mysql_query( $sql2, $con ) or die( "Err: Query 2"); header("Location: select.php"); echo "Quote Added to Database."; } else { echo ("Sorry you have already made 1 quote today"); } mysql_close($con) ?>
  3. just tested your code, and i get this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ffgaming/public_html/quotes/insert2.php on line 15
  4. I would like the user to be logged into IPB, before they can submit a quote..
  5. Hi Everyone. I've got a bit of a query, if anyone can help. I run a gaming community site, which uses Invision Power Board 3.1.2. I've been working on a "Quotes" Database, which has a PHP Front end, which adds data to a SQL Database. I have an Insert.php, which submits the data to the SQL, which works fine, however I have no idea how to secure the "inserting of quotes" so that it doesn't get spammed constantly. So I was wondering whether it would be easier to add a delay in between sumbissions based on the IP Address, or whether to lock it down with IPB (i have no idea how).. So if anyone could give me a hand with this, it would be greatly appreciated. Below is the code to my insert.php page. A HTML page $_POST's to this. <?php $con = mysql_connect("localhost","quotesuser","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } $date = date("Y/m/d - H:i:s"); mysql_select_db("quotes", $con); $qd = mysql_real_escape_string($_POST['Quote_Data']); $qb = mysql_real_escape_string($_POST['Quoted_By']); $sql="INSERT INTO Quotes (Quote_Data, Quoted_By , Date_Time) VALUES ('$qd','$qb','$date')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } header("Location: select.php"); echo "Quote Added to Database."; mysql_close($con) ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.