Uh.. Is this the right way to use it? Its not working thats why i ask 🙂
<?
$conn = mysql_connect("localhost","*****","****") or die
("Could not create a connection");
$db = mysql_select_db("lorens_sfs") or die("Could not select database");
if (isset($submit)) {
$allow_posting = 5000;
$check_time = 0;
$time_now = time();
if ( $HTTP_COOKIE_VARS['time_last_post'] )
{
$check_time = $HTTP_COOKIE_VARS['time_last_post'];
}
$last_post = $time_now-$check_time;
if ($last_post >= $allow_posting)
{
if ((!$name || !$abbrev || !$email || !ereg(".+\@.+\..+", $email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $email))) {
$error = "<font color='#CC0000'><b>Either is one of the required fields blank, or your email is invalid. </b></font>";
}
else {
$sql = "INSERT INTO guilds (name,shard,abbrev,charter,location,website,uosite,email,password,rp,pk,pvp,faction,align,waring)";
$sql .= "VALUES ('$name','$shard','$abbrev','$charter','$location', '$site','$uosite','$email','$pass','$rp','$pk','$pvp','$faction','$alignment','$waring')";
$insert = mysql_query($sql) or die(mysql_error());
$id = mysql_insert_id();
if ($id == "") {
header("Location: savedornot.php?page=nosave");
}
$subject = "The guild listings";
$body = "Thank you for registrating at the guild listings!\n";
$body .= "If you need to edit your guild info, do so by going to this adress:\n";
$body .= "http://lorenscorn.net/guilds/editguild.php?id=$id\n\n";
$body .= "Your password is:\n";
$body .= "$pass\n\n";
$body .= "Guild name: $name\n";
$body .= "Shard: $shard\n";
$body .= "Abbreviation: $abbrev\n";
$body .= "Charter: $charter\n";
$body .= "Location: $location\n";
$body .= "Website: $site\n Alignment: $alignment\n Waring: $waring\n\n";
$body .= "Regards\n";
$body .= "Scenes from Sosaria - [url]http://www.scenesfromsos.net\n[/url]";
$body .= "toome@scenesfromsos.net";
$headlines = "From: Scenes from Sosaria guild listings";
mail($email,$subject,$body,$headlines);
header("Location: savedornot.php?page=compleat&name=$name");
$name = null;
$abbrev = null;
$charter = null;
$location = null;
$site = null;
$uosite = null;
$email = null;
$pass = null;
$time_now = time();
setcookie('time_last_post', $time);
}
} else {
header("Location: savedornot.php?page=spam");
}
}
?>