Alternate background after post

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Alternate background after post

    i want my site to post alternate background and order by id this is the script help guys!!!


    PHP Code:
    <html>
    <head>
    <title>WAP BOX</title>
    <style type="text/css">
    body{
    background-color: gray;
    color: white;
    max-width: 468px;
    margin: 5px auto 2px auto;
    font-family: tahoma,papyrus;
    }.q6{
    background-color:black;
    color: white;
    font-weight: bold;
    padding: 5px 5px 5px 5px;
    }.q6{
    background-color:black;
    color: white;
    font-weight: bold;
    padding: 5px 5px 5px 5px;
    text-align: center;
    }.q5{
    background-color: silver;
    color: red;
    }
    input[type="submit"]
    {
    background-color: green;
    color:black;
    border: 1px outset yellow;

    </style>
    <link rel="icon" href="favicon.ico">
    <meta name="description" content="Pinoy wap community" />
    <meta name="keywords" content="pixel, pinoy, grayhat, lavalair, chat, forums, lucky9, mobile, downloads, fun, spam, spammers box, shoutbox"/>
    </head>

    <body>


    <marquee direction="left">
    <img src="dog.gif" alt="+"></marquee>
    <div class="q6">
    SPAM BOX
    </div>
    <div class="q5">
    <marquee direction="left">we are not responsible in other site contents post here! it may use for hacking so users beware!!
    </marquee></div>
    <div class="q1">
    <form id="shoutbox_form" action="index.php" method="post"><br/>codename:<br/><input type="text" name="shoutbox_name"  size="12" maxlength="20"/><br/>message:<br/><input type="text" cols="17"  size="12" rows="1" name="shoutbox_message" ><input type="submit" name="shoutbox_submit" value="SPAM" />
    <input type="hidden" name="shoutbox_ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" />
    </form>
    </div>
    <div class="q21">


    <?php
    include("config.php");
    $db mysql_connect($db_host,$db_user,$db_pass);
    mysql_select_db($db_name) or die("cannot connect to database");
    $max_length 50;
    if (
    $_POST['shoutbox_submit'])  {
    $name $_POST['shoutbox_name'];
    $ip $_POST['shoutbox_ip'];
    $message $_POST['shoutbox_message'];
    $mlen strlen($message);
    $date date("f js y");

    if (
    $name == "") {
    echo 
    "<strong>Error: please enter your nickname.</strong>";
    echo 
    "<br />";

    }
    else if (
    $message == "") {
    echo 
    "<strong>Error: message to be sent.</strong>";
    echo 
    "<br />";

    }
    else if (
    $mlen $max_length) {
    echo 
    "<strong>Error: message too long.</strong>";
    echo 
    "<br />";

    }
    else {

    mysql_query("INSERT INTO shoutbox(name,ip,message,date) VALUES('$name','$ip','$message','$date')");

    }
    }
    $db mysql_connect($db_host,$db_user,$db_pass);
    mysql_select_db($db_name) or die("cannot connect to database");
    $query "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 3";
    $result mysql_query($query);
    while(
    $r=mysql_fetch_array($result)) {


    $name $r['name'];
    $name strip_tags($name);
    $message $r['message'];
    $message strip_tags($message);
    $message str_replace("=(","<img src=\"sad.gif\" alt=\"=(\"/>"$message);
    $message str_replace("","<img src=\"sad.gif\" alt=\"\"/>"$message);
    $message str_replace("","<img src=\"cry.gif\" alt=\"\"/>"$message);
    $message str_replace(":@","<img src=\"mad.gif\" alt=\":@\"/>"$message);
    $message ereg_replace("","<img src=\"smile.gif\" alt=\"\"/>"$message);
    $message ereg_replace("=)","<img src=\"smile.gif\" alt=\"=)\"/>"$message);
    $message ereg_replace(":D","<img src=\"laugh.gif\" alt=\":D\"/>"$message);
    $message ereg_replace(":d","<img src=\"laugh.gif\" alt=\":d\"/>"$message);
    $message ereg_replace(":p","<img src=\"tongue.gif\" alt=\":p\"/>"$message);
    $message ereg_replace(":P","<img src=\"tongue.gif\" alt=\":P\"/>"$message);
    $message ereg_replace(":O","<img src=\"shocked.gif\" alt=\":O\"/>"$message);
    $message ereg_replace(":o","<img src=\"shocked.gif\" alt=\":o\"/>"$message);
    $message ereg_replace(";)","<img src=\"wink.gif\" alt=\";)\"/>"$message);
    $message ereg_replace(":S","<img src=\"sick.gif\" alt=\":S\"/>"$message);
    $message ereg_replace(":s","<img src=\"sick.gif\" alt=\":s\"/>"$message);
    $message ereg_replace(":roll:","<img src=\"roll.gif\" alt=\":roll:\"/>"$message);

    echo 
    "$name $message<br/>";
    }
    mysql_close();





    ?>

    <?php 
    $db 
    mysql_connect($db_host,$db_user,$db_pass);
    mysql_select_db($db_name) or die("cannot connect to database");
    $query "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 3";
    $result mysql_query($query);
    $r=mysql_fetch_array($result);
    while(
    $r=mysql_fetch_array($result)) {


    $name $r['name'];
    $name = echo ($name);
    $message $r['message'];
    $message = echo($message);
    for(
    $r=0;$r<5;$r++) { 
    $_POST_shoutbox_submit = ($bg++%== 0) ? "black" "gray"


    echo 
    "<div style='background-color: $_POST_shoutbox_submit'> $name $message<hr/></div>"
    }
    ?>
    </div>
    <div class="q6">
    &copy copyrights reserved<br/>
    </div>

    </body>
    </html>
    Last edited by metulj; 16.08.11, 08:44. Reason: post code in [ php ] tag [ / php ]
Working...
X