Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007
    Posts
    220
    Tokens
    175

    Exclamation [PHP] ip ban and exit(); help.

    Hey people, I have a contact form that I put ip ban into. I am using this:
    PHP Code:
    $deny = array("111.111.111.111""222.222.222.222");

        if (
    in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
            echo 
    'You have being banned from the form..';
            exit();
        } 
    It works, it's just I am putting the form into my page using <?php include("contact.php"); ?> and when it reaches exit(); the rest of the site fails to load. Is there anyway to have it so when kills the code using exit(); that it will continue to lead the rest of the site without putting the contact form in an iframe. Like, having it just end the php code when it reaches exit(); something like this:
    PHP Code:
        if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
            echo 
    'You have being banned from the form..';
            exit(echo 
    '?>');
        } 
    I know that won't work, but it's just an idea. Like I want the script to think it's done if they are banned, instead of it completely killing it, and the website. I don't know php very well, so bare with me.

    Here is the entire code, it was coded by my friend, and not by me. He is offline, or I would be asking him for the answer:
    PHP Code:
    <?php
        
        $contact_email 
    'MY EMAIL';
        
    $ip $_SERVER['REMOTE_ADDR'];
        
    $reasons = array(=> 'Please select a reason..'=> 'General'=> 'Job'=> 'Report a Bug');
        
    $thanks_message 'Thanks for contacting us. :) We\'ll get back to you ASAP!<br><br><a href="javascript:history.back(1)" title="Go back!">Go back.</a>';
        
    $deny = array("111.111.111.111""222.222.222.222");
        
    $error false;
        
            if (
    in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
                echo 
    'You have being banned from the form..';
                exit();
            }

        if (isset(
    $_POST['submit'])) {
            if (
    $_POST['contact-habbo-name'] == '') {
                echo 
    'Please enter a Habbo name..<br /><br />';
                
    $error true;
            } 
            
            if (
    $_POST['contact-reason'] == 0) {
                echo 
    'Please select a reason..<br /><br />';
                
    $error true;
            }
            
            if (
    $_POST['contact-email'] == '') {
                echo 
    'Please enter an e-mail; this is how we contact you!<br /><br />';
                
    $error true;
            }
            
            if (
    $_POST['contact-message'] == '') {
                echo 
    'Please enter some contact message of some sort.<br /><br />';
                
    $error true;
            }

            if (
    $error === true) {
                echo 
    '<a href="javascript:history.back(1)" title="Go back!">Go back.</a>';
            } else {
                
    $headers 'From: [email protected]"\r\n" .
                            
    'Reply-To: ' stripslashes($_POST['contact-email']) . "\r\n" .
                            
    'X-Mailer: PHP/' phpversion();
                
    $message 'Habbo: ' stripslashes($_POST['contact-habbo-name']) . "\r\n" .
                
    'Reason: ' $reasons[addslashes($_POST['contact-reason'])] . "\r\n" .
                
    'E-mail: ' stripslashes($_POST['contact-email']) . "\r\n" .
                
    'IP: ' $ip "\r\n \r\n" .
                
    'Message: ' stripslashes($_POST['contact-message']);
                
    mail($contact_email'uHabbo Contact Form: ' $reasons[addslashes($_POST['contact-reason'])], $message$headers);
                echo 
    $thanks_message;
            }
        } else {
            echo 
    '<form action="./?module=contact" method="post">
                    Habbo name:<br />
                    <input name="contact-habbo-name" id="contact-habbo-name" type="text" class="contact_form" />
                    <br><br>
                    Contact E-Mail: (You must enter a valid email, as this is how we will be replying to you)<br />
                    <input name="contact-email" id="contact-email" type="text" class="contact_form" />
                    <br><br>
                    Contact reason:<br />
                    <select name="contact-reason" id="contact-reason" class="contact_form">'
    ;
                        foreach (
    $reasons as $key => $reason) {
                            echo 
    '<option value="' $key '"'; if ($key==0){ echo ' selected="selected"'; } echo'>' $reason '</option>';
                        }
                    echo 
    '</select>
                    <br><br>
                    Message:
                    <textarea name="contact-message" id="contact-message" class="contact_form">Please enter a message. &lt;3</textarea>
                    <br><br>
                    <input name="submit" type="submit" id="submit" value="Send!" />
            </form>'
    ;
        }
    ?>
    Thanks for the help, +rep to any good attempts to help
    Last edited by Tylenol; 13-09-2009 at 03:47 PM.
    Kindest Regards,
    -- Brad







    [People Will Bow To Me]

  2. #2
    Join Date
    Sep 2007
    Posts
    220
    Tokens
    175

    Default

    Solved, close thread.
    Kindest Regards,
    -- Brad







    [People Will Bow To Me]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •