$db_name = "spikevb"; $table_name_2 = "SVB_subscribers"; $text_block = "
"; //Determine if they need to see the form or not. if ($_POST[op] != "ds") { } else if (($_POST[op] == "ds") && ($_POST[action] == "sub")) { //trying to unsubscribe; validate email address if ($_POST[email_add] == "") { header("Location: http:www.spikevolleyballchicago.com"); exit; } //Connect to server $connection = @mysql_connect("localhost", "spikevb", "volleyball") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); //Cehck that emai is not already in list $check = "select email_add from $table_name_2 WHERE email_add = '$_POST[email_add]'"; $check_result = mysql_query($check, $connection) or die(mysql_error()); $check_num = mysql_num_rows($check_result); //get number of results and do action if ($check_num < 1) { //add record $sql = "INSERT INTO $table_name_2 VALUES('', '$_POST[name]', '$_POST[email_add]', 'Subsciber', '', '', now())"; $result = @mysql_query($sql, $connection) or die(mysql_error()); $msg = "Thanks for signing up!
"; } else { //print failure message $msg = "You're already subscribed!
"; } } else if (($_POST[op] == "ds") && ($_POST[action] == "unsub")) { //trying to unsubscribe; validate email address if ($_POST[email_add] == "") { header("Location: http://www.spikevolleyballchicago.com"); exit; } //connect to server and select database $connection = @mysql_connect("localhost", "spikevb", "volleyball") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); //Check that email is in list $check = "select sub_id from $table_name_2 WHERE email_add = '$_POST[email_add]'"; $check_result = mysql_query($check, $connection) or die(mysql_error()); $check_num = mysql_num_rows($check_result); //Get number of results and do action if ($check_num < 1) { //print failure message $msg = "Sorry, Couldn't find your email in the list!
"; } else { //unsubscribe the email $sub_id = @mysql_result($check_result, 0, "sub_id"); $sql = "DELETE FROM $table_name_2 WHERE sub_id = '$sub_id'"; $result = @mysql_query($sql, $connection) or die(mysql_error()); $msg = "You're unsubscribed!
"; } } ?>
![]() SPIKE VOLLEYBALL
773.467.9963
5520 N Austin Ave Chicago, IL 60630 contact us at: spikevolley@aol.com echo "$msg"; ?> SPONSORED BY: |
![]() |
|||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||