Jump to content

ShoutBox Editing Help!!


FortMyersDrew

Recommended Posts

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I don't think I'll be here tomorrow lol

Ā 

upload this as doit.php

<?php
//including the database connection
include('config.php');
//getting everything that has been submitted
$name=mysql_real_escape_string(strip_tags($_POST['name']));
$mail=mysql_real_escape_string(strip_tags($_POST['mail']));
$message=mysql_real_escape_string(strip_tags($_POST['message']));
$submit=$_POST['submit'];
//get the current time with php date() function
//note that the server time will be recorded
//more info about all functions - http://php.net
$time=date("m/d/y - g:i a");
//get the ip. Note that this wont see through proxies
$ip=$_SERVER['REMOTE_ADDR'];


//just some basic error checking which
//checks if name,e-mail and message 
//hasnt been left blank or with default text
if (($name!=="") || ($name!=="Name") || ($mail!=="") || ($mail!=="E-mail") || ($message!=="") || ($message!=="Your text"))
{
//inserts data into the database
$sql = "INSERT INTO shoutbox (id, name, mail, message, time, ip) VALUES ('NULL', '$name', '$mail', '$message', '$time', '$ip')";
mysql_query($sql) or die(mysql_error());

$query = "SELECT * FROM `shout_user_log` WHERE `ip` = '$ip'";
$result = mysql_query ($query);
$num_rows = mysql_num_rows ($result);

if ($num_rows > 0) {

$query = "DELETE * FROM `shout_user_log` WHERE `ip` = '$ip'";
mysql_query ($query);

}

$query = "INSERT INTO `shout_user_log` (`id`, `username`, `email`, `ip`) VALUES ('', '$name', '$mail', '$ip')";
mysql_query ($query);

//sends the user back to the form
header("Location:".$_SERVER['HTTP_REFERER']);
}
else{
header("Location:".$_SERVER['HTTP_REFERER']);
}
?>

Ā 

Now the name and E-mail should be remembered

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.