I am writing this code as a email verification system, it has a long way to go, so please bare with how it's written. I am looking to set up something in where after submitted the email field disappears. I thought this was the way to do it, I guess not... Can anyone point me in the right direction? <?php //This script was created so for two purposes. // 1. The pratice of writing code. // 2. To stop 90% of all false postings in a blog script I am writing. $output_form = 'yes'; if (isset($_POST['submit'])) { $email = $_POST['email']; $suffix = end(explode('@',$email)); $ip = gethostbyname($suffix); $ipv = '/^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$/'; if (preg_match($ipv, $ip)) { $output_form = 'no'; echo "The " .$ip. " is valid"; } } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label for="email">E-Mail:</label> <input type="text" id="email" name="email" /><br /> <input type="submit" value="Submit Email" name="submit" /> </form> Code (markup):
Hey, try this: <?php //This script was created so for two purposes. // 1. The pratice of writing code. // 2. To stop 90% of all false postings in a blog script I am writing. $output_form = 'yes'; if (isset($_POST['submit'])) { $email = $_POST['email']; $suffix = end(explode('@',$email)); $ip = gethostbyname($suffix); $ipv = '/^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$/'; if (preg_match($ipv, $ip)) { $output_form = 'no'; echo "The " .$ip. " is valid"; } } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label for="email">E-Mail:</label> <input type="text" id="email" name="email" /><br /> <input type="submit" value="Submit Email" name="submit" /> </form> <?php } ?> Code (markup):
I'm not really understanding what you're asking for, but based on my limited understanding, I'll do something like this: <?php /* This script was created so for two purposes. * 1. The pratice of writing code. * 2. To stop 90% of all false postings in a blog script I am writing. */ $output = 1; if (isset($_POST['submit'])) { $email = $_POST['email']; $suffix = end(explode('@',$email)); $ip = gethostbyname($suffix); $ipv = '/^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$/'; if (preg_match($ipv, $ip)) { $output = 2; }else{ $output = 3; } } switch ($output){ case 1: $output = '<form action="'.$_SERVER['PHP_SELF'].'" method="post"> <label for="email">E-Mail:</label> <input type="text" id="email" name="email" /><br /> <input type="submit" value="Submit Email" name="submit" /> </form>'; break; case 2: $output = 'The IP: "'.$ip.'" is valid'; break; case 3: $output = 'The IP: "'.$ip.'" is NOT valid<br/><br/> <form action="'.$_SERVER['PHP_SELF'].'" method="post"> <label for="email">E-Mail:</label> <input type="text" id="email" name="email" /><br /> <input type="submit" value="Submit Email" name="submit" /> </form>'; break; } echo $output; ?> PHP:
What I'm looking for is this: http://www.kaboomlabs.com/testbed/spamblocker.php When you enter the email address, you press Submit email, after you press the button the field to enter the email address disappears, and a response is outputted. Does this make sense now?
I already told you, what's your problem?!?!? <?php //This script was created so for two purposes. // 1. The pratice of writing code. // 2. To stop 90% of all false postings in a blog script I am writing. $output_form = 'yes'; if (isset($_POST['submit'])) { $email = $_POST['email']; $suffix = end(explode('@',$email)); $ip = gethostbyname($suffix); $ipv = '/^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$/'; if (preg_match($ipv, $ip)) { $output_form = 'no'; echo "The " .$ip. " is valid"; } } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label for="email">E-Mail:</label> <input type="text" id="email" name="email" /><br /> <input type="submit" value="Submit Email" name="submit" /> </form> <?php } ?> PHP:
Because a quick glance your code looked exactly like mine, so I didn't see any variance. Also, you just posted the code without saying what you did differently to it, so I didn't think it needed a response... sorry. I would suggest that if you post code say what you did that is different for the future, because honestly, what I did was a simple mistake. Thanks though.
Dude, my code does exactly what the site you mentioned does. http://www.kaboomlabs.com/testbed/spamblocker.php
I never said it didn't, I asked a question you never responded. So I took another person's idea which looked cleaner and simpler to upkeep... sorry.