Code: Select all
<?php
include("db_connect.php");
$e_address=$_POST["email"];//<-- get's e-mail address from form
$date=date("d-m-Y");//<-- get's current date
list($userName, $mailDomain) = split("@", $e_address); //<-- [valide email] take a given email address and split it into the username and domain.
if (checkdnsrr($mailDomain, "MX"))
{
if ( $userName == "" )
{
print ("The e-mail address is not valid.<br />");
}
else
{
add_email();
}
}
else
{
print ("The e-mail address is not valid.<br />");
}
function add_email()
{
//=======================
//Add the e-mail address to the database
//=======================
global $e_address;
global $date;
$query=("INSERT INTO `subscribers` ( `id` , `email_address` , `date_added` )
VALUES ( '', '$e_address', '$date' )");
$result = mysql_query($query) or die("Could not add your e-mail address to the database");
header("Location: confirm.php?m=1");
}
?>(obviously the "x's" (xxxxxxxxxxxxxxx) is for censored information)
Code: Select all
<?
$link;
connectToDB();
function connectToDB()
{
global $link;
$link = mysql_connect( "xxx.xxx.xxx.xx", "xxxxxxxx", "xxxxx" );
if ( ! $link )
die( "Couldn't Connect to MySQL" );
mysql_select_db(" xxxxxxxxxxx", $link )
or die ( "Couldn't open organizer: ".mysql_error() );
}
?>For some reason my script will not redirect. Am i going crazy? the code looks fine to me, if someone finds and error let me know, otherwise i have to notify the hosting company.