Bounty Hunter Script Fixed!

Discussion in 'Web-development' started by Fablow, Nov 4, 2009.

  1. Fablow

    Fablow Woot, woot! Premium User

    Joined:
    May 7, 2008
    Messages:
    1,398
    Likes Received:
    29
    Best Answers:
    0
    PHP:
    1. <?php
    2. mysql_connect("localhost","root","password");
    3. mysql_select_db("database");
    4.  
    5. $main_content .= '<P ALIGN=CENTER>
    6.    <br>
    7.    <FONT SIZE=5 COLOR=#CFF00C>
    8.        How to use...
    9.    </FONT>
    10.    <br>
    11.    <br>
    12.    <FONT SIZE=2 COLOR=#CFF00C>
    13.    * !hunt [prize],[nick] :
    14.        <FONT SIZE=1 COLOR=#FCC33F>
    15.            Sends an announcement about huncie to form. Price in thousands.<br>
    16.            Example: !hunt 100,Infinity
    17.        </FONT><br>
    18.    </FONT>
    19. </P>
    20. <br>
    21. <br>
    22.    <center>
    23.        <h1>
    24.            Bounty Hunters
    25.        </h1>
    26.    </center>
    27.        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
    28.            <TR BGCOLOR="#505050">
    29.                <TD CLASS=white width=30%>
    30.                    <center><B>Commissioned</B></center>
    31.                </TD>
    32.                <TD CLASS=white width=30%>
    33.                    <center><B>Award</B></center>
    34.                </TD>
    35.                <TD CLASS=white width=30%>
    36.                    <center><B>Offer</B></center>
    37.                </TD>
    38.                <TD CLASS=white width=10%>
    39.                    <center><B>Killed By</B></center>
    40.                </TD>
    41.            </TR>';
    42.  $inv = mysql_query("SELECT * FROM `bounty_hunters` ORDER BY `added` DESC");
    43. $num = 0;
    44. $color=$config['site']['darkborder'];
    45. while($tab = mysql_fetch_array($inv)){
    46. if($num%2 == 0){$color=$config['site']['darkborder'];}else{$color=$config['site']['lightborder'];}
    47. $pid = $tab['fp_id'];
    48. $sid = $tab['sp_id'];
    49. $kid = $tab['k_id'];
    50. $killed = $tab['killed'];
    51. $prize = $tab['prize']*1000;
    52. if($killed == 0){
    53. $kill = '<font color="red">Nobody!</font>';
    54. }else{
    55. $k = mysql_query("SELECT * FROM `players` WHERE `id` = ".$kid."");
    56. $kill_name = $k1['name'];
    57. $kill = '<a href="index.php?subtopic=characters&name='.$kill_name.'">'.$kill_name.'</a>';
    58. }
    59. $f = mysql_query("SELECT * FROM `players` WHERE `id` = ".$pid."");
    60. $s = mysql_query("SELECT * FROM `players` WHERE `id` = ".$sid."");
    61. $fn = $f1['name'];
    62. $sn = $s1['name'];
    63.  
    64. $main_content .= '
    65.        <TR BGCOLOR="'.$color.'">
    66.            <TD>
    67.                <center>
    68.                    <b>
    69.                        <a href="index.php?subtopic=characters&name='.$fn.'">'.$fn.'</a>
    70.                    </b>
    71.                </center>
    72.            </TD>
    73.            <TD>
    74.                <center>
    75.                    <b>
    76.                        '.$prize.' gp
    77.                    </b>
    78.                </center>
    79.            </TD>
    80.            <TD>
    81.                <center>
    82.                    <b>
    83.                        <a href="index.php?subtopic=characters&name='.$sn.'">'.$sn.'</a>
    84.                    </b>
    85.                </center>
    86.            </TD>
    87.            <TD>
    88.                <center>
    89.                    <b>
    90.                        '.$kill.'
    91.                    </b>
    92.                </center>
    93.            </TD>
    94.        </TR>';
    95. $num++;
    96. }
    97. if($num == 0){
    98.         $main_content.='<TR BGCOLOR="'.$color.'">
    99.            <TD colspan=4>
    100.                <center>
    101.                    Currently there are not any bounty hunter offer.
    102.                </center>
    103.            </TD>
    104.        </TR>';
    105. }
    106.         $main_content .='</TABLE><div align="right">Copyright &copy; <a href="http://otibia.net">oTibia.net</a>.</div>';
    107. ?>
    When i tried to use the one that mateusz (spelling?) I had problems with the script, so heres the fixed version.
     
    Last edited: Nov 4, 2009
  2. Henkos

    Henkos Active Member

    Joined:
    Jun 29, 2008
    Messages:
    2,989
    Likes Received:
    3
    Best Answers:
    0
    Nice.

    Repp for you:peace:

    Edit:You must spread some Reputation around before giving it to Assassin Legend again.
     
  3. Fablow

    Fablow Woot, woot! Premium User

    Joined:
    May 7, 2008
    Messages:
    1,398
    Likes Received:
    29
    Best Answers:
    0
    Haha

    I know i do to much good stuff for otland! ;)
     
  4. Orkhz

    Orkhz New Member

    Joined:
    Sep 11, 2009
    Messages:
    301
    Likes Received:
    0
    Best Answers:
    0
    PHP:
    1. Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\bounty.php on line 45
     
  5. Rewexx

    Rewexx New Member

    Joined:
    Oct 22, 2008
    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Much easier to make a config in the beginning instead of doing it in that way, that'll be much more comfortable for beginners.

    I'm talking about
    PHP:
    1.  
    2. $dbhost = "localhost";
    3. $dbuser = "root";
    4. $dbpass = "password";
    5. $db = "database";
    6.  
    7. // Then when we come to this part, it'll connect to the database using your config and you won't need to edit this part.
    8. connect_mysql($dbhost, $dbuser, $dbpass)or die(mysql_error());
    9.  
    /Nikkster
     
  6. Fablow

    Fablow Woot, woot! Premium User

    Joined:
    May 7, 2008
    Messages:
    1,398
    Likes Received:
    29
    Best Answers:
    0
    @UP
    Mmhk. You gotta be pure noob not to get it.

    @Orkhz
    Did you fill in your database information?
     
  7. Orkhz

    Orkhz New Member

    Joined:
    Sep 11, 2009
    Messages:
    301
    Likes Received:
    0
    Best Answers:
    0
    Yes I did. How can I fix it?
     
    Last edited: Nov 5, 2009
  8. Master-m

    Master-m Need help? Just ask!

    Joined:
    May 28, 2007
    Messages:
    4,338
    Likes Received:
    15
    Best Answers:
    0
    It is good that you fixed a (small) bug. But still it is badly written, not only this. But also the luascripts need a complete revamp.

    I have a part revamped, but it is not yet ready to be released. It needs to be tested first.:p

    Please note that this wasn't meant to insult or make you feel bad in any way. You didn't write the script, just solved the bug so it works now. Thats a good job and I hope you continue doing that:).
     
  9. Zonet

    Zonet Web Developer

    Joined:
    Sep 1, 2008
    Messages:
    4,375
    Likes Received:
    44
    Best Answers:
    0
    Fail.. are you Nikkster, lol.
    connect_mysql?
    It's called mysql_connect :) Dont acll yourself C++, PHP Programmer.
     
  10. Fablow

    Fablow Woot, woot! Premium User

    Joined:
    May 7, 2008
    Messages:
    1,398
    Likes Received:
    29
    Best Answers:
    0
    @Master-m

    Ye i know, but alot of noobies always bug everyone and shit, so i just posted my "fixed" version.

    Im learning.. :p
     
  11. Master-m

    Master-m Need help? Just ask!

    Joined:
    May 28, 2007
    Messages:
    4,338
    Likes Received:
    15
    Best Answers:
    0
    Yeah thats very good:)
     
  12. Orkhz

    Orkhz New Member

    Joined:
    Sep 11, 2009
    Messages:
    301
    Likes Received:
    0
    Best Answers:
    0

    Thanks for helping me! Lol :huh:
     
  13. Fablow

    Fablow Woot, woot! Premium User

    Joined:
    May 7, 2008
    Messages:
    1,398
    Likes Received:
    29
    Best Answers:
    0
    Lol scarcasm much?
     
  14. Fablow

    Fablow Woot, woot! Premium User

    Joined:
    May 7, 2008
    Messages:
    1,398
    Likes Received:
    29
    Best Answers:
    0
    Bump!
     
  15. Fablow

    Fablow Woot, woot! Premium User

    Joined:
    May 7, 2008
    Messages:
    1,398
    Likes Received:
    29
    Best Answers:
    0
    I think this is useful so!

    B
    U
    M
    P
     
  16. Archez

    Archez '

    Joined:
    Jun 26, 2008
    Messages:
    6,589
    Likes Received:
    65
    Best Answers:
    0
    Would you mind telling me/us what did you fix?
     
  17. Dragonas1

    Dragonas1 Member

    Joined:
    Jul 1, 2009
    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Why you can't use "foreach" ?

    PL version:
    Popierdoliło Cię? Od tego jest foreach a nie while... Wyszło by w chuj krócej.
     
  18. chojrak

    chojrak Banned User

    Joined:
    Oct 25, 2008
    Messages:
    5,832
    Likes Received:
    165
    Best Answers:
    1
    Why won't u just post shortened version instead of blaming some1 ?
     
  19. simson361

    simson361 The Grim Reaper

    Joined:
    Aug 4, 2010
    Messages:
    627
    Likes Received:
    27
    Best Answers:
    0
    dose this work for znote?
     

Share This Page

Loading...