Coding Help Please

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

    Coding Help Please

    Would anyone be able to add the moods to this file please (whosonline.php from the scotspaul script)

    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?php
    header("Cache-Control: no-cache, must-revalidate");
    include("config.inc.php");
    header("Pragma: no-cache");
    header("Content-type: text/vnd.wap.wml");
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    echo "<wml>";
    $Connect = mysql_connect("$server","$user","$pass");
    mysql_select_db("$dbname");
    $result=mysql_query("select * from members where username=&#39;$username&#39; and password=&#39;$password&#39;");
    $number_of_rows = mysql_num_rows($result);
    if ($number_of_rows>0)
    {
    include("check.inc.php");
    }
    if ($ok>0)
    {
    include("online.inc.php");

    $exp = time() + 300; //300 seconds for 5 minutes
    $time = time();

    $query = "select * from latest where ip=&#39;$username&#39;";
    $result = mysql_query($query); //send the query!

    if(mysql_num_rows($result) == 1) {
    $query = "update latest set time=&#39;$exp&#39; where ip=&#39;$username&#39;";
    mysql_query($query); //send the query!

    }else{
    $query = "insert into latest VALUES(&#39;$username&#39;,&#39;$exp&#39;)";
    mysql_query($query);
    }

    //delete IP&#39;s that have expired...
    $query = "delete from latest where $time > time";
    // ^^ This query will look in the database for entries where the current time is greater than the expiration time that was entered into the database and delete those entries because those users are expired/not active. For example, if a a visitor visted the site at 8:00 their expiration time would be marked as 8:05. If this script is accessed at 8:10, that query will see that the current time (8:10) is greater than the expiration time of that entry (8:05) and delete it because that user has not been active (online) in the last 5 minutes.

    mysql_query($query); //send the query!

    $uonline = mysql_num_rows(mysql_query("select * from latest"));
    //this variable might seem complicated, but it&#39;s really simple. The first thing it does is sends the query "select * from latest" to the database. This finds all the entries in the database. After that, it counts the number of entries with mysql_num_rows to find out exactly how many users are online.

    //print the variable on our page!
    echo "<card id=\"card1\" title=\"$uonline Users Online\">";
    echo "<p align=\"center\">";
    $id=1;
    $sqlthing = mysql_query("SELECT * FROM highest WHERE id=&#39;$id&#39;");
    $highest=(mysql_result($sqlthing,0,"highest"));
    if ($highest < $uonline)
    {
    $highest=$uonline;
    $query = "update highest set highest=&#39;$highest&#39; where id=&#39;$id&#39;";
    mysql_query($query); //send the query!
    }
    echo "Highest Online: $highest
    ";
    $count=0;
    $result=mysql_query("select * from latest order by ip asc");
    while ($count < $uonline)
    {
    $name=(mysql_result($result,$count,"ip"));
    $sqlthing = mysql_query("SELECT * FROM members WHERE username=&#39;$name&#39;");
    $stars=(mysql_result($sqlthing,0,"stars"));
    $name2=$name;
    if($stars>0){
    $symbol="*";
    $name= $symbol. $name. $symbol;
    }

    $result5=mysql_query("select * from buddylist where username1=&#39;$username&#39; and username2=&#39;$name2&#39;");

    $number_of_rows2 = mysql_num_rows($result5);
    if($number_of_rows2>0){
    $bud="[~]";
    $name= $name. $bud;
    }



    echo "<a title=\"Enter\" href=\"profile.php?username=$username&amp;password =$password&amp;name=$name2\">$name</a>
    ";
    $count=$count+1;
    }
    ?>
    [img]line.gif[/img]

    [~] = buddy


    <?php
    $sqlthing = mysql_query("SELECT * FROM members WHERE username=&#39;$username&#39;");
    $pmname=(mysql_result($sqlthing,0,"pmname"));
    $buddyname=(mysql_result($sqlthing,0,"buddyname")) ;

    echo "<a title=\"Enter\" href=\"pm.php?username=$username&amp;password=$pas sword\">[$pmname Menu]</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"forumindex.php?username=$username&amp;passw ord=$password\">[Forums]</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"chatindex.php?username=$username&amp;passwo rd=$password\">[Chat]</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"welcome.php?username=$username&amp;password =$password\">[Main Menu]</a>";
    echo "
    ";
    }
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    ?>

    </div>

    Many Thanks to anyone who can help
    :p:p:p

    #2
    Would anyone be able to add the moods to this file please (whosonline.php from the scotspaul script)

    <div class='codetop'>CODE
    <div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?php
    header("Cache-Control: no-cache, must-revalidate");
    include("config.inc.php");
    header("Pragma: no-cache");
    header("Content-type: text/vnd.wap.wml");
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    echo "<wml>";
    $Connect = mysql_connect("$server","$user","$pass");
    mysql_select_db("$dbname");
    $result=mysql_query("select * from members where username=&#39;$username&#39; and password=&#39;$password&#39;");
    $number_of_rows = mysql_num_rows($result);
    if ($number_of_rows>0)
    {
    include("check.inc.php");
    }
    if ($ok>0)
    {
    include("online.inc.php");

    $exp = time() + 300; //300 seconds for 5 minutes
    $time = time();

    $query = "select * from latest where ip=&#39;$username&#39;";
    $result = mysql_query($query); //send the query!

    if(mysql_num_rows($result) == 1) {
    $query = "update latest set time=&#39;$exp&#39; where ip=&#39;$username&#39;";
    mysql_query($query); //send the query!

    }else{
    $query = "insert into latest VALUES(&#39;$username&#39;,&#39;$exp&#39;)";
    mysql_query($query);
    }

    //delete IP&#39;s that have expired...
    $query = "delete from latest where $time > time";
    // ^^ This query will look in the database for entries where the current time is greater than the expiration time that was entered into the database and delete those entries because those users are expired/not active. For example, if a a visitor visted the site at 8:00 their expiration time would be marked as 8:05. If this script is accessed at 8:10, that query will see that the current time (8:10) is greater than the expiration time of that entry (8:05) and delete it because that user has not been active (online) in the last 5 minutes.

    mysql_query($query); //send the query!

    $uonline = mysql_num_rows(mysql_query("select * from latest"));
    //this variable might seem complicated, but it&#39;s really simple. The first thing it does is sends the query "select * from latest" to the database. This finds all the entries in the database. After that, it counts the number of entries with mysql_num_rows to find out exactly how many users are online.

    //print the variable on our page!
    echo "<card id=\"card1\" title=\"$uonline Users Online\">";
    echo "<p align=\"center\">";
    $id=1;
    $sqlthing = mysql_query("SELECT * FROM highest WHERE id=&#39;$id&#39;");
    $highest=(mysql_result($sqlthing,0,"highest"));
    if ($highest < $uonline)
    {
    $highest=$uonline;
    $query = "update highest set highest=&#39;$highest&#39; where id=&#39;$id&#39;";
    mysql_query($query); //send the query!
    }
    echo "Highest Online: $highest
    ";
    $count=0;
    $result=mysql_query("select * from latest order by ip asc");
    while ($count < $uonline)
    {
    $name=(mysql_result($result,$count,"ip"));
    $sqlthing = mysql_query("SELECT * FROM members WHERE username=&#39;$name&#39;");
    $stars=(mysql_result($sqlthing,0,"stars"));
    $name2=$name;
    if($stars>0){
    $symbol="*";
    $name= $symbol. $name. $symbol;
    }

    $result5=mysql_query("select * from buddylist where username1=&#39;$username&#39; and username2=&#39;$name2&#39;");

    $number_of_rows2 = mysql_num_rows($result5);
    if($number_of_rows2>0){
    $bud="[~]";
    $name= $name. $bud;
    }
    echo "<a title=\"Enter\" href=\"profile.php?username=$username&amp;password =$password&amp;name=$name2\">$name</a>
    ";
    $count=$count+1;
    }
    ?>
    [img]line.gif[/img]

    [~] = buddy


    <?php
    $sqlthing = mysql_query("SELECT * FROM members WHERE username=&#39;$username&#39;");
    $pmname=(mysql_result($sqlthing,0,"pmname"));
    $buddyname=(mysql_result($sqlthing,0,"buddyname")) ;

    echo "<a title=\"Enter\" href=\"pm.php?username=$username&amp;password=$pas sword\">[$pmname Menu]</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"forumindex.php?username=$username&amp;passw ord=$password\">[Forums]</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"chatindex.php?username=$username&amp;passwo rd=$password\">[Chat]</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"welcome.php?username=$username&amp;password =$password\">[Main Menu]</a>";
    echo "
    ";
    }
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    ?>

    </div>

    Many Thanks to anyone who can help [/b][/quote]






    ONE IDEA.

    1. you need to create one new row in database members.

    ALTER TABLE `members` ADD `mood` VARCHAR( 30 ) NOT NULL AFTER `username` ;

    2. create one input form for each user and place in your script and this sql for insert

    $mood = $_POST[&#39;mood&#39;];
    $presence= "UPDATE `members` SET
    `mood` = &#39;$mood&#39;
    WHERE username=&#39;$username&#39;
    ";
    mysql_query($presence);

    3.insert in your whosonline.php after select members and include $mood.

    4. avoid stars (*) SELECT * - delete all stars from requests.
    http://ngeo.ro

    Comment


      #3


      i&#39;m sure that means something to most of you here lol... i&#39;m no php expert
      Can anyone put that into plain English please ??
      :p:p:p

      Comment


        #4


        i&#39;m sure that means something to most of you here lol... i&#39;m no php expert
        Can anyone put that into plain English please ??[/b]
        ok, what script you have? i need the zip package.
        http://ngeo.ro

        Comment


          #5
          Site coding attached, minus the smilies lol


          [attachment=918:site.zip]
          :p:p:p

          Comment

          Working...
          X