Jump to content
MakeWebGames

Dragon Blade

Members
  • Posts

    209
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Dragon Blade

  1. Also a fedjail report system. User can only use it if there in fedjail. Easier way to communicate. Staff can reply to the jailer. Staff can ban the jailer/ un ban the jailer Only 2 times a hour a jailer can post (Unless staff decide not to)
  2. Great! I like it, colors go in well!
  3. Thanks, I am trying a lot to get better at making templates. All I want is the community to be happy.
  4. I made it, but not good as your one :(
  5. Wow! I am liking it already! How much are you charging for this mod? Or you releasing this mod for free?
  6. I am looking for something like, you buy a company (There's Company Classes) And when you buy it. You gotta work every hour to gain x amount. And you gotta pay weekly for the company to go up. If not the company shut downs. Members will be paid with the Business money the gained. Company can be charged with fine . There is much more but I am really busy.
  7. Goodluck Ian, If your selling something like this for a V1 I will definetly buy!
  8. My first template I have ever made its simple but alright.   [ATTACH=CONFIG]1024[/ATTACH]
  9. If I have time, I will make something like this for free. But I wouldn't say I made 100% of it as Zettie showed me the template. As he is inactive I will try make this. Hope you don't mind Zettie
  10. I am making banners for £2/£1 one example of y work. More to come. [ATTACH=CONFIG]1015[/ATTACH] [ATTACH=CONFIG]1016[/ATTACH] [ATTACH=CONFIG]1017[/ATTACH]
  11. Everyone has this engine, it is totally not unique. I would say start from a MCCodes V1 best way (My opinion) . And have you purchased the RC script?
  12. I was wondering guys, if any of you guys can make a Company modfication - If you guys can it would be appericated. Abit like business modfication people have.
  13. Thanks, Its finshed just need's abit of coding. My family matter just got in the way. If someone can finish it off for me, it would be a pleasure.   @Sniko Oh :o   Finnally, I have time to finish this off. I will post the code within 3 days.
  14. Hmm, I don't know to be honest.
  15. Sorry Djkanna, what is WIP? And your welcome.
  16. Hello all! I have created a new modfication, but not everything is coded, some parts I couldnt do as I am really busy. There are some error's, if not then well done on me lool. ALTER TABLE users ADD bodyguard INT(11) DEFAULT 0 ; CREATE TABLE IF NOT EXISTS `bodyguards` ( `userID` int(11) NOT NULL AUTO_INCREMENT, `userBG` int(11) NOT NULL DEFAULT '0', `userDAYS` int(11) NOT NULL DEFAULT '0', `userPAY` int(11) NOT NULL DEFAULT '0', `userCHECK` int(11) DEFAULT '0', PRIMARY KEY (`userID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Make a new file called userbodyguard.php and add - <?php /* Mod created by Dragon Blade. Free Modfication to all MCCodes Users Realese Date - 25/06/2013 UK Date. */ if (file_exists("globals.php")) { // V2 require("globals.php"); } else { // V1 session_start(); require "global_func.php"; if ($_SESSION['loggedin'] == 0) { header("Location: login.php"); exit; } $userid = $_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is = mysql_query( "SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN fedjail f ON f.fed_userid=u.userid WHERE u.userid=$userid ", $c) or die(mysql_error()); $ir = mysql_fetch_array($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); } switch($_GET['action']) { case "accept": accept(); break; case "decline": decline(); break; case "bodyguard": bodyguard(); break; case "request": request(); break; case "abort": abort(); break; default: index(); break; } function index() { global $ir,$h; echo" <h3>User BodyGuard</h3><hr width=75%>"; echo"Like to hire a user as a bodyguard? Well you came to the right place!<br /> You are only allowed to hire one bodyguard. Your bodyguard will protect you from being attacked ingame.<br /> Only time you will be attacked is when your bodyguard is in jail or hospital.<br /> Click <a href='userbodyguard.php?action=request'>here</a> to view your request.<hr width=75%>"; echo" <form action='userbodyguard.php' action='userbodyguard.php?post'> <input type='hidden' name='action' value='bodyguard'> Players ID: <input type='text' size=5 name='victim' value='{$ir['userid']}'><br /> Days: <input type='text' size=5 name='days' value='1'><br /> Pay Job: <input type='text' size=5 name='money' value='100'><br /><br /> <input type='submit' value='propose'> </form> <hr width='75%'><a href='index.php'>> Go Home</a><hr width='75%'>"; } function bodyguard() { global $ir,$h; echo" <h3>User BodyGuard</h3>"; $_GET['victim'] = abs((int) $_GET['victim']); if($ir['bodyguard'] > 0) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You already have a bodyguard, what are you trying to do?<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } if($ir['bodyguard'] < 0) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You have already sent out a request. You must wait for an answer.<br/><br/> <hr width='50%'><table width=50%><tr><td width=50%><a href='userbodyguard.php?action=abort'>> Cancel your request?</a></td><td><a href='userbodyguard.php'>> Go Back</a></td></tr></table><hr width='50%'>"; $h->endpage(); exit; } if($_GET['victim'] == $ir['userid']) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You cannot be your own bodyguard.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } if($_GET['victim'] < 1) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>Nice Try. Next time will be FED.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $qy=mysql_query("SELECT bodyguard FROM users WHERE userid = {$_GET['victim']} and bodyguard > 0"); if (mysql_num_rows($qy) == 1) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>Sorry, but they are already a bodyguard.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } event_add($_GET['victim'], "<a href='viewuser.php?u=$userid'>{$ir['username']}</a> request you to be his bodyguard. Click <a href='userbodyguard.php?action=request'><b>here</b></a> to find out more information."); mysql_query("UPDATE users SET bodyguard = -{$_GET['victim']} WHERE userid={$ir['userid']}"); mysql_query("INSERT INTO bodyguards (userID, userBG, userDAYS, userPAY) VALUES( '{$ir['userid']}', '{$_GET['victim']}', '{$_GET['days']}', '{$_GET['money']}')"); print "<hr width='50%'>Please read the confirmation message.<hr width='50%'><h3>! CONFIRMATION</h3>Your request has been sent.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; } function request() { global $ir,$h; print "<h3>Bodyguard Request(s)</h3><hr width=100%> <table width=100% cellspacing='1' class='table'> <tr style='background:gray'> <th>User</th><th>Pay Job</th><th>Days</th><th>Links</th></tr>"; $q=mysql_query("SELECT * FROM bodyguards WHERE userBG={$ir['userid']}"); while($r=mysql_fetch_array($q)) { $f=mysql_query("SELECT * FROM users WHERE userid={$r['userID']}"); $user=mysql_fetch_array($f); print "<tr><td><a href='viewuser.php?u={$user['userid']}'>{$user['username']}</a></td><td>\${$r['userPAY']}</td> <td>{$r['userDAYS']}</td><td><a href='userbodyguard.php?action=accept&id={$r['userID']}'><b>Accept</b></a> | <a href='userbodyguard.php?action=decline&id={$r['userID']}'><b>Decline</b></a> </td></tr>"; } print "</table> <hr width=100%><a href='userbodyguard.php'>Go Back</a><hr width=100%><br />"; } function abort() { global $db, $ir, $userid; $namelen = strlen($ir['username']) + 9; $request = abs($ir['bodyguard']); mysql_query("UPDATE users SET bodyguard = 0 where userid = {$ir['userid']}"); mysql_query("DELETE FROM bodyguards WHERE userID={$ir['userid']}"); print "<hr width='50%'>Please read the confirmation message.<hr width='50%'><h3>! CONFIRMATION</h3>Your request has been withdrawn.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; } function accept() { global $db, $ir, $userid, $h; if($ir['bodyguard'] < 0) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You have already sent out a request. You must wait for an answer.<br/><br/> <hr width='50%'><table width=50%><tr><td width=50%><a href='userbodyguard.php?action=abort'>> Cancel your proposal?</a></td><td><a href='userbodyguard.php'>> Go Back</a></td></tr></table><hr width='50%'>"; $h->endpage(); exit; } if($ir['bodyguard'] > 0) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You're already a bodyguard, what are you trying to do?<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $qy1=mysql_query("SELECT bodyguard FROM users WHERE userid = {$_GET['id']} and bodyguard > 0"); if (mysql_num_rows($qy1) == 1) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>Sorry, but they are already a bodyguard<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $qy2=mysql_query("SELECT bodyguard FROM users WHERE userid = {$_GET['id']} and bodyguard = -{$ir['userid']} "); if (mysql_num_rows($qy2) == 0) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>A request for marriage hasn't even been made.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $getname=mysql_query("SELECT username FROM users WHERE userid = {$_GET['id']}"); $name=mysql_fetch_assoc($getname); print "<hr width='50%'>Please read the confirmation message.<hr width='50%'><h3>! CONFIRMATION</h3>You accepted {$name['username']}'s bodyguard request.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; event_add($_POST['id'], "<a href='viewuser.php?u=$userid'>{$ir['username']}</a> has accepted your request"); mysql_query("UPDATE users SET bodyguard= {$ir['userid']} where userid = {$_GET['id']}"); mysql_query("UPDATE bodyguards SET userCHECK = 1 where userBG= {$ir['userid']}"); } function decline() { global $db, $ir, $userid, $h; $_GET['id'] = abs((int) $_GET['id']); if($_GET['id'] == $ir['userid']) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You cannot request to yourself nevermind declining one.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } if($_GET['id'] < 1) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>Nice Try. Next time will be FED.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $getname=mysql_query("SELECT username FROM users WHERE userid = {$_GET['id']}"); $name=mysql_fetch_array($getname); mysql_query("DELETE FROM bodyguards WHERE userBG={$ir['userid']}"); if($name['bodyguard'] == !-$ir['userid']) { print "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>This request is no longer active.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } mysql_query("UPDATE users SET bodyguard = 0 WHERE userid={$_GET['id']}"); mysql_query("DELETE FROM bodyguards WHERE userBG={$ir['userid']}"); print "<hr width='50%'>Please read the confirmation message.<hr width='50%'><h3>! CONFIRMATION</h3>You declined {$name['username']}'s bodyguard request.<br/><br/> <hr width='50%'><a href='userbodyguard.php'>> Go Back</a><hr width='50%'>"; event_add($_GET['id'], "<a href='viewuser.php?u=$userid'>{$ir['username']}</a> has declined your bodyguard request."); } $h->endpage(); ?> Open up viewuser.php and add this somewhere you like - print "Bodyguard: "; if ($r['bodyguard'] > 0) { $part=mysql_query("SELECT * FROM users WHERE userid={$r['bodyguard']}"); $pr=mysql_fetch_array($part); $part1=mysql_query("SELECT * FROM bodyguards"); $pr1=mysql_fetch_array($part1); print "<a href='viewuser.php?u={$pr['userid']}'>{$pr['username']}</a> for {$pr1['userDAYS']} days<br />"; } else { print "Does not have a bodyguard"; } print "<br />"; And your done, all you got to do is create a cron to pay the bg and update the day's. If it hit's 0 userDAYS it deletes the row and updates the users bodyguard to 0. And you got to code something in attack.php saying - This user has a bodyguard and it is not in jail/hospital therefor you cannot attack. I would have coded it but I am really busy with my family matters. Sorry.
  17. Hmm I was thinking that to upto 3 bodyguards. But donators 5.
  18. I am making a new modfication for V1/V2, players can hire other people as there bodyguard. If someone has a bodyguard they can not be attacked unless there bodyguard is in jail or hospital. People who has a bodyguard cannot be a bodyguard. There can only be upto 1 bodyguard per person. People who sends a request to the person, the person will get an event for how many days and how much they being paid for to become a bodyguard there bodyguard.   Any comments? Or more improvement...to what I described.
  19. Lostnation.com (Too much) Lostnation.net - Too much hassle. I am going to buy infamousnation.net - £10. (Not anymore) Going to buy nationofthelost.com
  20. Hello there, I just realised that Lostnation.net and Lostnation.com is unavailable. I need a domain to buy. And I am willing to buy any domains with nation in it. If you do please reply to this thread, with your price.
  21. Ohh, there isn't no game called Gangster warfare, someone made the Meta description up for me, It was going to be based of gangs wars. But its based on something differnt. But Im going to change it...But dont know what to change to. I'm going to be late for prayer lol. Brb.
  22. Where did gangster warfare come from? And what is it?   This is the global_func.php -   <?php function class_dropdown($connection, $ddname = "classID", $selected = -1) { global $c; $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query( "SELECT `classID`, `classNAME` FROM `player_class` ORDER BY `classID` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['classID']}'"; if ($selected == $r['classID'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['classNAME']}</option>"; } mysql_free_result($q); $ret .= "\n</select>"; return $ret; } function getPlayerClass($uId = NULL) { global $userid; if(!$uId) $uId = $userid; $u = mysql_fetch_array(mysql_query("SELECT `player_class` FROM `users` WHERE userid = {$uId}")); $class = mysql_query("SELECT `classNAME` FROM `player_class` WHERE `classID` = {$u['player_class']}"); if (mysql_num_rows($class)) { $c = mysql_fetch_array($class); return $c['classNAME']; } else return "Not Defined"; } function money_formatter($muny, $symb = '$') { $moneys = ""; $muny = (string) $muny; if (strlen($muny) <= 3) { return $symb . $muny; } $dun = 0; for ($i = strlen($muny); $i > 0; $i -= 1) { if ($dun % 3 == 0 && $dun > 0) { $moneys = "," . $moneys; } $dun += 1; $moneys = $muny[$i - 1] . $moneys; } return $symb . $moneys; } function location_dropdown($connection, $ddname = "location", $selected = -1) { $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query("SELECT * FROM cities ORDER BY cityname ASC", $connection); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['cityid']}'"; if ($selected == $r['cityid'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['cityname']}</option>"; } $ret .= "\n</select>"; return $ret; } function shop_dropdown($connection, $ddname = "shop", $selected = -1) { $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query("SELECT * FROM shops ORDER BY shopNAME ASC", $connection); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['shopID']}'"; if ($selected == $r['shopID'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['shopNAME']}</option>"; } $ret .= "\n</select>"; return $ret; } function user_dropdown($connection, $ddname = "user", $selected = -1) { global $db; $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query( "SELECT `userid`, `username` FROM `users` ORDER BY `username` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['userid']}'"; if ($selected == $r['userid'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['username']}</option>"; } mysql_free_result($q); $ret .= "\n</select>"; return $ret; } function fed_user_dropdown($connection, $ddname = "user", $selected = -1) { $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query( "SELECT * FROM users WHERE fedjail=1 ORDER BY username ASC", $connection); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['userid']}'"; if ($selected == $r['userid'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['username']}</option>"; } $ret .= "\n</select>"; return $ret; } function event_add($userid,$text,$connection=0) { $text=mysql_escape($text); mysql_query("INSERT INTO events VALUES('',$userid,UNIX_TIMESTAMP(),0,'$text','0')"); mysql_query("UPDATE users SET new_events=new_events+1 WHERE userid={$userid}"); return 1; } function forumb_user_dropdown($connection, $ddname = "user", $selected = -1) { global $db; $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query( "SELECT `userid`, `username` FROM `users` WHERE `forumban` > 0 ORDER BY `username` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['userid']}'"; if ($selected == $r['userid'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['username']}</option>"; } mysql_free_result($q); $ret .= "\n</select>"; return $ret; } function forum_dropdown($connection, $ddname = "forum", $selected = -1) { global $db; $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query( "SELECT `ff_id`, `ff_name` FROM `forum_forums` ORDER BY `ff_name` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['ff_id']}'"; if ($selected == $r['ff_id'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['ff_name']}</option>"; } mysql_free_result($q); $ret .= "\n</select>"; return $ret; } function forum2_dropdown($connection, $ddname = "forum", $selected = -1) { global $db; $ret = "<select name='$ddname' type='dropdown'>"; $q = mysql_query( "SELECT `ff_id`, `ff_name` FROM `forum_forums` WHERE `ff_auth` != 'gang' ORDER BY `ff_name` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = mysql_fetch_array($q)) { $ret .= "\n<option value='{$r['ff_id']}'"; if ($selected == $r['ff_id'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['ff_name']}</option>"; } mysql_free_result($q); $ret .= "\n</select>"; return $ret; } function mysql_escape($str) { global $c; return mysql_real_escape_string($str, $c); } function check_level() { global $ir, $c, $userid; $ir['exp_needed'] = (int) (($ir['level'] + 1) * ($ir['level'] + 1) * ($ir['level'] + 1) * 2.2); if ($ir['exp'] >= $ir['exp_needed']) { $expu = $ir['exp'] - $ir['exp_needed']; $ir['level'] += 1; $ir['exp'] = $expu; $ir['energy'] += 2; $ir['brave'] += 2; $ir['maxenergy'] += 2; $ir['maxbrave'] += 2; $ir['hp'] += 50; $ir['maxhp'] += 50; $ir['exp_needed'] = (int) (($ir['level'] + 1) * ($ir['level'] + 1) * ($ir['level'] + 1) * 2.2); mysql_query( "UPDATE users SET level=level+1,exp=$expu,energy=energy+2,brave=brave+2,maxenergy=maxenergy+2,maxbrave=maxbrave+2, hp=hp+50,maxhp=maxhp+50 where userid=$userid", $c); } } function get_rank($stat, $mykey) { global $ir, $userid, $c; $q = mysql_query( "SELECT count(*) FROM userstats us LEFT JOIN users u ON us.userid=u.userid WHERE us.$mykey > $stat AND us.userid != $userid AND u.user_level != 0", $c); return mysql_result($q, 0, 0) + 1; } /** * Given a password input given by the user and their actual details, * determine whether the password entered was correct. * * Note that password-salt systems don't require the extra md5() on the $input. * This is only here to ensure backwards compatibility - that is, * a v2 game can be upgraded to use the password salt system without having * previously used it, without resetting every user's password. * * @param string $input The input password given by the user. * Should be without slashes. * @param string $salt The user's unique pass salt * @param string $pass The user's encrypted password * * @return boolean true for equal, false for not (login failed etc) * */ function verify_user_password($input, $salt, $pass) { return ($pass === encode_password($input, $salt)); } /** * Given a password and a salt, encode them to the form which is stored in * the game's database. * * @param string $password The password to be encoded * @param string $salt The user's unique pass salt * @param boolean $already_md5 Whether the specified password is already * a md5 hash. This would be true for legacy * v2 passwords. * * @return string The resulting encoded password. */ function encode_password($password, $salt, $already_md5 = false) { if (!$already_md5) { $password = md5($password); } return md5($salt . $password); } /** * Generate a salt to use to secure a user's password * from rainbow table attacks. * * @return string The generated salt, 8 alphanumeric characters */ function generate_pass_salt() { return substr(md5(microtime_float()), 0, 8); } function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float) $usec + (float) $sec); } /** * * @return string The URL of the game. */ function determine_game_urlbase() { $domain = $_SERVER['HTTP_HOST']; $turi = $_SERVER['REQUEST_URI']; $turiq = ''; for ($t = strlen($turi) - 1; $t >= 0; $t--) { if ($turi[$t] != '/') { $turiq = $turi[$t] . $turiq; } else { break; } } $turiq = '/' . $turiq; if ($turiq == '/') { $domain .= substr($turi, 0, -1); } else { $domain .= str_replace($turiq, '', $turi); } return $domain; } /** * Get the file size in bytes of a remote file, if we can. * * @param string $url The url to the file * * @return int The file's size in bytes, or 0 if we could * not determine its size. */ function get_filesize_remote($url) { // Retrieve headers if (strlen($url) < 8) { return 0; // no file } $is_ssl = false; if (substr($url, 0, 7) == 'http://') { $port = 80; } else if (substr($url, 0, 8) == 'https://' && extension_loaded('openssl')) { $port = 443; $is_ssl = true; } else { return 0; // bad protocol } // Break up url $url_parts = explode('/', $url); $host = $url_parts[2]; unset($url_parts[2]); unset($url_parts[1]); unset($url_parts[0]); $path = '/' . implode('/', $url_parts); if (strpos($host, ':') !== false) { $host_parts = explode(':', $host); if (count($host_parts) == 2 && ctype_digit($host_parts[1])) { $port = (int) $host_parts[1]; $host = $host_parts[0]; } else { return 0; // malformed host } } $request = "HEAD {$path} HTTP/1.1\r\n" . "Host: {$host}\r\n" . "Connection: Close\r\n\r\n"; $fh = fsockopen(($is_ssl ? 'ssl://' : '') . $host, $port); if ($fh === false) { return 0; } fwrite($fh, $request); $headers = array(); $total_loaded = 0; while (!feof($fh) && $line = fgets($fh, 1024)) { if ($line == "\r\n") { break; } if (strpos($line, ':') !== false) { list($key, $val) = explode(':', $line, 2); $headers[strtolower($key)] = trim($val); } else { $headers[] = strtolower($line); } $total_loaded += strlen($line); if ($total_loaded > 50000) { // Stop loading garbage! break; } } fclose($fh); if (!isset($headers['content-length'])) { return 0; } return (int) $headers['content-length']; } // GPC fix: added in 1.1.1 if (version_compare(PHP_VERSION, '5.4.0-dev') < 0 && function_exists('get_magic_quotes_gpc')) { $_core_gpc_on = get_magic_quotes_gpc(); } else { $_core_gpc_on = false; } if (!$_core_gpc_on) { foreach ($_POST as $k => $v) { $_POST[$k] = addslashes($v); } foreach ($_GET as $k => $v) { $_GET[$k] = addslashes($v); } } // Error reporting we want @error_reporting(E_ALL & ~E_NOTICE); // Tidy? if (class_exists('tidy')) { function tidy_test() { $html = ob_get_clean(); // Specify configuration $config = array('indent' => true, 'output-xhtml' => true, 'wrap' => 200); // Tidy $tidy = new tidy; $tidy->parseString($html, $config, 'latin1'); $tidy->cleanRepair(); // Output echo $tidy; } ob_start(); register_shutdown_function('tidy_test'); }     mysql.php -   <?php date_default_timezone_set('Europe/London'); #Set default timezone $c = mysql_connect('localhost', 'LOL', 'LOL') or die(mysql_error()); mysql_select_db('LOL', $c);
  23. Hello, I have a registration script for a V1 game. Its abit messed. The userstat doesnt get inserted. And theres is alot of bugs...and security probelms..Any one can help me out?   <?php session_start(); require "mysql.php"; require "global_func.php"; print <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="JavaScript"> <!-- function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function DeleteCookie (name,path,domain) { if (GetCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // --> </script> <script language="JavaScript"> var usr; var pw; var sv; function getme() { usr = document.login.username; pw = document.login.password; sv = document.login.save; if (GetCookie('player') != null) { usr.value = GetCookie('username') pw.value = GetCookie('password') if (GetCookie('save') == 'true') { sv[0].checked = true; } } } function saveme() { if (usr.value.length != 0 && pw.value.length != 0) { if (sv[0].checked) { expdate = new Date(); expdate.setTime(expdate.getTime()+(365 * 24 * 60 * 60 * 1000)); SetCookie('username', usr.value, expdate); SetCookie('password', pw.value, expdate); SetCookie('save', 'true', expdate); } if (sv[1].checked) { DeleteCookie('username'); DeleteCookie('password'); DeleteCookie('save'); } } else { alert('You must enter a username/password.'); return false; } } </script> </head> <head> <!-- SEO Requirements --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Massive online multiplayer text based RPG game. Gangster warfare at its best."> <meta name="keywords" content="rpg games, fun games, online rpg, multiplayer games, play free game, free rpg, rpg game, online mmorpg, mmorpg games, fun game"> <meta name="robots" content="index,follow" /> <meta name="author" content="Dragon Blade"> <link href="css/style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- @import url("css/layout.css"); --> </style> <title>LostNation</title> </head> <div id="wrapper" class="bg7"> <div class="bg8"> <div id="wrapperA"></div> <div class="content"> <div id="header"> <div id="logo"> <h1>LostNation</h1> <h2> </h2> </div> <div id="splash"> <h3> </h3> </div> </div> <div id="mainmenu" class="bg3" style="margin-left: 15px;"> <ul> <li><a href="login.php" id="mainmenu1" accesskey="1" title="" class="link1">Home</a></li> <li><a href="news.php" id="mainmenu2" accesskey="2" title="" class="link1 vline">News</a></li> <li><a href="reviews.php" id="mainmenu3" accesskey="3" title="" class="link1 vline">Reviews</a></li> <li><a href="articles.php" id="mainmenu4" accesskey="4" title="" class="link1 vline">Articles</a></li> <li><a href="details.php" id="mainmenu5" accesskey="5" title="" class="link1 vline">Staff</a></li> <li><a href="contact.php" id="mainmenu6" accesskey="6" title="" class="link1 vline">Contact</a></li> </ul> <p class="text1" style="width: 200px; float: right; margin: 0px 15px 0 0;"><script language="JavaScript" type="text/javascript" src="date.js"></script></p> </div> <!-- Begin Main Content --> <div class="two-col"> <div class="colA"> <div id="box1"> <h2 class="text2 title1">LostNation Links</h2> <ul class="ul1"> <li><span class="bbit-li-info"><a href="login.php">Login</a></span></li> <li><span class="bbit-li-info"><a href="register.php">Register</a></span></li> <li><span class="bbit-li-info"><a href="resend.php">Lost Password</a></span></li> <li><span class="bbit-li-info"><a href="tos.php">Terms of Service</a></span></li> <li><span class="bbit-li-info"><a href="policy.php">Privacy Policy</a></span></li> <li><span class="bbit-li-info"><a href="preview.php">Preview</a></span></li> </ul> <div class="boxfoot"> <!-- # --> </div> </div> </div> <div class="colB"> <div id="box5"> <div class="notice-donate">LostNation Registration</div> EOF; $ip = ($_SERVER['REMOTE_ADDR']); if (file_exists('ipbans/' . $ip)) { die( "<b><span style='color: red; font-size: 120%'> Your IP has been banned, there is no way around this. </span></b> </body></html>"); } if($_POST['username']) { if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha']) { unset($_SESSION['captcha']); print "Captcha Test Failed<br /> ><a href='register.php'>Back</a>"; exit(); } unset($_SESSION['captcha']); } if ($_POST['username']) { $sm = 100; if ($_POST['promo'] == "Your Promo Code Here") { $sm += 100; } $class = mysql_query("SELECT className, money, crystals, strength, guard, agility, iq, labor FROM player_class WHERE classID = {$_POST['classID']}"); if(mysql_num_rows($class)) { $c = mysql_fetch_array($class); $money = $c["money"]+$sm; $crystals = $c["crystals"]; $strength = $c["strength"]; $guard = $c["guard"]; $agility = $c["agility"]; $iq = $c["iq"]; $labor = $c["labor"]; } else { $crystals = 10; $strength = 10; $guard = 10; $agility = 10; $iq = 10; $labor = 10; } $username=$_POST['username']; $username=str_replace(array("<", ">"), array("<", ">"), $username); $q=mysql_query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'"); $q2=mysql_query("SELECT * FROM users WHERE email='{$_POST['email']}'"); if(strlen($_POST['username']) < 6) { print "Sorry, the username is too short.<br /> ><a href='register.php'>Back</a>"; } else if(strlen($_POST['username']) > 15) { print "Sorry, the username is too large.<br /> ><a href='register.php'>Back</a>"; } else if(mysql_num_rows($q)) { print "Username already in use. Choose another.<br /> ><a href='register.php'>Back</a>"; } else if (!preg_match("/^[ a-zA-Z0-9]*$/", trim($_POST['username']))) { print "Your username contained characters that aren't allowed. Only A-Z, 0-9 and spaces accepted.<br /> ><a href='register.php'>Back</a>"; } else if(mysql_num_rows($q2)) { print "E-Mail already in use. Choose another.<br /> ><a href='register.php'>Back</a>"; } else if(strlen($_POST['password']) < 6) { print "Your password is too small.<br /> ><a href='register.php'>Back</a>"; } else if($_POST['password'] != $_POST['cpassword']) { print "The passwords did not match, go back and try again.<br /> ><a href='register.php'>Back</a>"; } else { $_POST['ref'] = abs((int) $_POST['ref']); $IP = $_SERVER['REMOTE_ADDR']; $q=mysql_query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}"); if(mysql_num_rows($q)) { die("No creating referral multies. Bad dog.<br /> ><a href='register.php'>Back</a>"); } if($_POST['ref'] > 0) { $ref=mysql_query("SELECT * FROM users WHERE userid={$_POST['ref']}"); if(!mysql_num_rows($ref)) { die("Your adding a non existent refer<br /> ><a href='register.php'>Back</a>"); } } $r=mysql_fetch_array($q); } mysql_query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup,player_class) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $money, $crystals, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP','{$_POST['classID']}')"); $i = mysql_insert_id($c); mysql_query( "INSERT INTO userstats VALUES($i, $strength, $agility, $guard, $labor, $iq)", $c); if ($_POST['ref']) { mysql_query( "UPDATE `users` SET `crystals` = `crystals` + 2 WHERE `userid` = {$_POST['ref']}"); event_add($_POST['ref'], "For refering $username to the game, you have earnt 2 valuable crystals!", $c); $e_rip = mysql_real_escape_string($rem_IP, $c); $e_oip = mysql_real_escape_string($ip, $c); mysql_query( "INSERT INTO `referals` VALUES(NULL, {$_POST['ref']}, $i, " . time() . ", '{$e_rip}', '$e_oip')", $c); } print "You have signed up, enjoy the game.<br /> > <a href='login.php'>Login</a>"; } else { $gref = abs((int) $_GET['REF']); $fref = $gref ? $gref : ''; $chars = "1234567890"; $len = strlen($chars); $_SESSION['captcha'] = ""; for ($i = 0; $i < 4; $i++) $_SESSION['captcha'] .= $chars[rand(0, $len - 1)]; echo" <br /><br /><center><div style='background-color:#222222; text-align: left; color:white; padding-left: 10px; width:75%; border:1px solid #EEEEEE'> <small><b><h3><u><b>Register:</b></u></h3> Its never been easier to sign up and register an account. <br /> Registration is free and within just a few minutes you can being joining the ultimate RPG gaming experience.<br /><br />Just complete the fields below.<br /><br /> Fields marked <font size = 3 color = red>*</font> are to be completed: <br /><br /> </div> </center><br /><br /> <form action='register.php' method='post'> <table width='75%' class='table' cellspacing='1'> <tr> <td><font color = red>*</font> Username:</td><td><center><input type='text' name='username' /></center></td> </tr> <tr> <td><font color = red>*</font> Password:</td><td><center><input type='password' name='password' /></center></td> </tr> <tr> <td><font color = red>*</font> Confirm Password:</td><td><center><input type='password' name='cpassword' /></center></td> </tr> <tr> <td><font color = red>*</font> Email:</td><td><center><input type='text' name='email' /></center></td> </tr> <tr> <td><font color = red>*</font> Confirm Email:</td><td><center><input type='text' name='cemail' /></center></td> </tr> <tr> <td>Promo Code:</td><td><center><input type='text' name='promo' /></center></td> </tr> <tr> <td>Player Class:</td><td><center>".class_dropdown(NULL, "classID")."</td></center> </tr> <tr> <td><img src='captcha.php?bgcolor=C3C3C3' width='200' height='50' /></td><td><input type='text' name='captcha' /></td> </tr> <tr> <td colspan= '2'><center><input type='submit' value='Submit' /></center></td> </form></table> <br /><br /><center><div style='background-color:#222222; text-align: left; color:white; padding-left: 10px; width:75%; border:1px solid #EEEEEE'> <small><b><h3><u><b>Disclaimer:</b></u></h3>When registering an account you accept all Terms of Service & Privacy Policy. In addition you are required to comply with all ingame rules. If you disagree with any of the Terms of Service / Privacy Policy or Game Rules at anytime you should terminate all use of your account and contact [email protected] and request that your account be deleted. <br /><br /> </div> </center><br /><br /> <hr width = 75%><center>> <a href='login.php'>Login</a><hr width = 75%></center>"; } print ' </div> </div> </div> <div id="login-wrapperB" $ie6_fix></div> <br style="clear: both;" /> </div> </div> </div> <div id="footer"><p class="style2">Game Copyright ©{$year} Dragon Blade. All rights reserved worldwide.</center></i></p></div> </div> </body> </html> '; ?>
  24. I don't know the forums table for MCCodes V2 but try and add this somewhere near function_reply.   $q1=mysql_query("SELECT * FROM forum_posts WHERE $userid=fp_poster_id AND fp_time >unix_timestamp()-60"); if(mysql_num_rows($q1) >= 1) { print "The last posting from your ID was less than 60 seconds ago.<br />Please try again later.<br/><br/> "; $h->endpage(); exit; }
  25. Hello all, I had a V2 mailbox script and I was converting it into a V1. But then I came across an error -   Fatal error: Call to undefined function mysql_fetch_single() in /home/****/public_html/****/mailbox.php on line 403   I believe it is this $db_fetch_single But when I convert it into this mysql_fetch_single I get an error? Any reasons why to?     I have fixed it!   mysql_result($q, 0, 0);
×
×
  • Create New...