Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation Need Help Re-Directing

    Hey all, I am making a fansite for last chaos and it has a radio on it. I have a request line code sorted out. But if the user presses confirm it does not auto refresh and go back to the form.

    Here is the code:
    PHP Code:
            <?php
    include ("config.php");
    if(!
    $_POST[request])
    {
    echo 
    "
    <form method='post'>
      <p><strong>Name:</strong>
        <input name='name' type='text' id='content'><br>
      </p>
      <p><strong>Reason:</strong>
        <select name='type' id='content'>
          <option><font color=#Shoutout</option>
          <option>Request</option>
          <option>Complaint</option>
              </select>
                  <br><br>
      <strong>Message:</strong><br>
        <textarea name='message' cols='30' id='content' style='height: 100px;'></textarea>
        <br>
        <br>
        <input type='submit' name='request' value='Send' id='content'>
            </p>
    </form>
    "
    ;
    }

    if(
    $_POST[request])
    {

    $type $_POST['type'];
    $name $_POST['name'];
    $message $_POST['message'];
    if(
    $type == NULL || $name == NULL || $message == NULL)
    {
    die(
    "All the fields are required. Please make sure you fill them out!");
    }
       
    $ip $_SERVER['REMOTE_ADDR'];
       
    $check mysql_query("SELECT bannedip FROM `ipbans` WHERE `bannedip` = '$ip'");
       
    $check mysql_fetch_array($check);
       
    if (
    $check[bannedip] !== $ip)
    {
    $ip $_SERVER['REMOTE_ADDR'];
    $message $_POST['message'];
    $type $_POST['type'];
    $name $_POST['name'];
    mysql_query("INSERT INTO `requests` (`id`, `user`, `message`, `type`, `ip`) VALUES (NULL, '$name', '$message', '$type', '$ip');");
    echo (
    "<center>Thankyou for submitting your shoutout/request/complaint,<br> a DJ or admin will view it soon.</center>"); //Thankyou message.
    }
    else
    {
    echo (
    "Your IP matches one of a banned IP. If you are using a proxy, please disable it and try again."); //Banned IP message.
    }
    }
    ?>
    Any Insight?

  • #2
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    6
    Thanks
    0
    Thanked 2 Times in 2 Posts
    From what i understand, you're wanting it to go back to the form after they submit? Why not just switch the order of your code then, and take out the conditional for the form?


    PHP Code:
    <?php
    include ("config.php");
    if(isset(
    $_POST[request]))
    {

    $type $_POST['type'];
    $name $_POST['name'];
    $message $_POST['message'];
    if(
    $type == NULL || $name == NULL || $message == NULL)
    {
    die(
    "All the fields are required. Please make sure you fill them out!");
    }
       
    $ip $_SERVER['REMOTE_ADDR'];
       
    $check mysql_query("SELECT bannedip FROM `ipbans` WHERE `bannedip` = '$ip'");
       
    $check mysql_fetch_array($check);
       
    if (
    $check[bannedip] !== $ip)
    {
    $ip $_SERVER['REMOTE_ADDR'];
    $message $_POST['message'];
    $type $_POST['type'];
    $name $_POST['name'];
    mysql_query("INSERT INTO `requests` (`id`, `user`, `message`, `type`, `ip`) VALUES (NULL, '$name', '$message', '$type', '$ip');");
    echo (
    "<center>Thankyou for submitting your shoutout/request/complaint,<br> a DJ or admin will view it soon.</center>"); //Thankyou message.
    }
    else
    {
    echo (
    "Your IP matches one of a banned IP. If you are using a proxy, please disable it and try again."); //Banned IP message.
    }
    }
    ?>

    <form method='post'>
      <p><strong>Name:</strong>
        <input name='name' type='text' id='content'><br>
      </p>
      <p><strong>Reason:</strong>
        <select name='type' id='content'>
          <option><font color=#Shoutout</option>
          <option>Request</option>
          <option>Complaint</option>
              </select>
                  <br><br>
      <strong>Message:</strong><br>
        <textarea name='message' cols='30' id='content' style='height: 100px;'></textarea>
        <br>
        <br>
        <input type='submit' name='request' value='Send' id='content'>
            </p>
    </form>
    Last edited by johnduarte; 06-22-2010 at 08:15 PM.

  • Users who have thanked johnduarte for this post:

    JasonReynolds (06-22-2010)

  • #3
    New Coder
    Join Date
    Jun 2009
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Any idea how to make the message above it fade? When you post it says:
    Thankyou for submitting your shoutout/request/complaint,
    a DJ or admin will view it soon.

    But i need that to fade away

  • #4
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    6
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by JasonReynolds View Post
    Any idea how to make the message above it fade? When you post it says:
    Thankyou for submitting your shoutout/request/complaint,
    a DJ or admin will view it soon.

    But i need that to fade away
    Just a quick and dirty solution, you can use javascript to hide the message.
    PHP Code:
    <?php 
    include ("config.php"); 
    if(isset(
    $_POST[request])) 


    $type $_POST['type']; 
    $name $_POST['name']; 
    $message $_POST['message']; 
    if(
    $type == NULL || $name == NULL || $message == NULL

    die(
    "All the fields are required. Please make sure you fill them out!"); 

       
    $ip $_SERVER['REMOTE_ADDR']; 
       
    $check mysql_query("SELECT bannedip FROM `ipbans` WHERE `bannedip` = '$ip'"); 
       
    $check mysql_fetch_array($check); 
        
    if (
    $check[bannedip] !== $ip

    $ip $_SERVER['REMOTE_ADDR']; 
    $message $_POST['message']; 
    $type $_POST['type']; 
    $name $_POST['name']; 
    mysql_query("INSERT INTO `requests` (`id`, `user`, `message`, `type`, `ip`) VALUES (NULL, '$name', '$message', '$type', '$ip');"); 
    echo (
    "<div id=\"hid\" style=\"visibility:visible\"><center>Thankyou for submitting your shoutout/request/complaint,<br> a DJ or admin will view it soon.</center></div>"); //Thankyou message. 
    $hideDiv TRUE;

    else 

    echo (
    "Your IP matches one of a banned IP. If you are using a proxy, please disable it and try again."); //Banned IP message. 


    ?> 


    <form method='post'> 
      <p><strong>Name:</strong> 
        <input name='name' type='text' id='content'><br> 
      </p> 
      <p><strong>Reason:</strong> 
        <select name='type' id='content'> 
          <option><font color=#Shoutout</option> 
          <option>Request</option> 
          <option>Complaint</option> 
              </select> 
                  <br><br> 
      <strong>Message:</strong><br> 
        <textarea name='message' cols='30' id='content' style='height: 100px;'></textarea> 
        <br> 
        <br> 
        <input type='submit' name='request' value='Send' id='content'> 
            </p> 
    </form>
    <?php if($hideDiv){ ?>
    <script type="text/javascript">
    function hideIt() {
      document.getElementById("hid").style.visibility = "hidden";
    }
    setTimeout("hideIt()", 10000); // after 10 sec
    </script>
    <?php ?>
    Setting the variable $hideDiv after the message which is now in a div in your php code, then checking later to see if $hideDiv is set, if so javascript will run.
    Last edited by johnduarte; 06-22-2010 at 08:51 PM.

  • Users who have thanked johnduarte for this post:

    JasonReynolds (06-22-2010)

  • #5
    New Coder
    Join Date
    Jun 2009
    Posts
    19
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks John, Really helped


  •  

    Posting Permissions

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