
gurpreet
Members-
Posts
834 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by gurpreet
-
Depending on whether you want to hide all staff or just admins, because most staff play the game. You could do something like what Dayo said and change it a bit: AND `user_level` != 2 (admin) Then add other and's and more user levels
-
What's line 36?
-
When you close your laptop, it saves your current laptop stuff, nothing to do with your game. Why would that matter? Setting your session or cookies to a lower time would work?
-
One good way I have found is to only give interest to active players. Maybe a query to check if the user has been on in the last 30 days, and if they have then give the interest to them. If not, simply don't, so users can't leave for a while and come back to a crap load of money.
-
Isn't the users house determined by their maxwill? The houses table just contains the price, will give etc. and the maxwill gives a number. If it doesn't equal to any houses' will, then they will have no house. I had this issue a while back but make sure all of your queries match up. I suggest doing what illusions has said though
-
It should say something like this: Will: $wiperc Change it to Will: {$ir['will']}/{$ir['maxwill']}
-
a % is like a sum. So 100% could mean 100, 10000000 or 1. The percentage is their will that they currently have divided by their total will * 100.
-
As it says, ereg is deprecated so you need to replace those with properly formatted preg_match's Also make sure your db username and password and that is correct
-
Alright thanks So none of that JS is needed? Would this work as it should? <?php include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $token = ctype_alnum($_GET['token']); $q = mysql_query("SELECT * FROM validating WHERE vdID='$token'"); $key = mysql_fetch_object($q); $q2 = mysql_query("SELECT username FROM users WHERE username='{$key->username}'"); $key2 = mysql_fetch_object($q2); print <<<EOF <head> <title>Death-Wars Validation</title> <style type="text/css"> <!-- body { background-color:#170000; margin-top: 0px; margin-bottom: 0px; font-family:calibri, helvetica, arial, geneva, sans-serif;font-size:18px;color: white; font-variant: small-caps; scrollbar-base-color: #005B70; scrollbar-arrow-color: #F3960B; scrollbar-DarkShadow-Color: #000000; } </style> </head> EOF; $IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); if(file_exists('ipbans/'.$IP)) { die("<font color=red size=+1>Your IP has been banned, there is no way around this.</font>"); } if(!$_GET['token']) { die("You have not supplied a valid link to a validation page. Please go back to your e-mail and check your link."); } $money = 1000; //Base Starting Cash $crystals = 20; //Base Starting Crystals $donor = 3; //Base Starting Donor Days if(isset($key->promo)) { $code = $key->promo; $q = mysql_query("SELECT * FROM promo WHERE code = '$code'"); $promo = mysql_fetch_array($q); $money = ($promo['cash']) ? $money + $promo['cash'] : $money; $crystals = ($promo['crystals']) ? $crystals + $promo['crystals'] : $crystals; $donor = ($promo['donor']) ? $donor + $promo['donor'] : $donor; } if($key->vdID != $token) { die("You have followed an invalid link. Please go back to your email and make sure you have the correct validation link."); } else if($key->username == $key2->username) { die("This account has already been verified. Please <a href='login.php'>Login</a> to use your account"); } { $salt = 'skyline'; $password = $key->password; $salted_hash = hash("sha512", ($salt . $password)); $uq=$db->query("SELECT userid FROM users WHERE login_name='{$_POST['username']}' AND `userpass`='{$salted_hash}'"); $mem=$db->fetch_row($uq); $db->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) VALUES ('{$key->username}', '{$key->username}', '$salted_hash', 1, $money, $crystals, $donor, 1, 100, 12, 100, 100, 5, 5, 100, 100, 1, '{$key->gender}', unix_timestamp(), '{$key->email}', -1, '$IP', '$IP')");$i=mysql_insert_id($c); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)"); $db->query("DELETE FROM validating WHERE vdID='{$_GET['token']}'"); if($_POST['ref']) { require "global_func.php"; $db->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); $db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); } print "You have signed up, enjoy the game.<br>"; $_SESSION['loggedin'] = 1; $_SESSION['userid'] = $mem['userid']; header('Location: welcome.php'); } ?>
-
Ouch I thought I had 1 or 2 problems with this script, I'll send over the table structure. Thanks for those points, I'll look into those as much as possible. Could you elaborate on your data limitation part? Thanks for your time
-
Bump Msg2short
-
My basic set up is this: The user registers and they get sent a validation link, and their info gets put into the table 'validating' The user clicks the validation link in their email and they get a confirmation message and their info gets put into the users table. However, I'm trying to make it so once they have received their confirmation and their account has been created, then they should be auto-logged in and redirected to the game. This is what I got: <?php include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $token = ctype_alnum($_GET['token']); $q = mysql_query("SELECT * FROM validating WHERE vdID='$token'"); $key = mysql_fetch_object($q); $q2 = mysql_query("SELECT username FROM users WHERE username='{$key->username}'"); $key2 = mysql_fetch_object($q2); ?> <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 = <?php $key->username ?>; pw = <?php $key->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 (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'); } } </script> <?php print <<<EOF <head> <title>Death-Wars Validation</title> <style type="text/css"> <!-- body { background-color:#170000; margin-top: 0px; margin-bottom: 0px; font-family:calibri, helvetica, arial, geneva, sans-serif;font-size:18px;color: white; font-variant: small-caps; scrollbar-base-color: #005B70; scrollbar-arrow-color: #F3960B; scrollbar-DarkShadow-Color: #000000; } </style> </head> EOF; $IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); if(file_exists('ipbans/'.$IP)) { die("<b><font color=red size=+1>Your IP has been banned, there is no way around this.</font></b></body></html>"); } if(!$_GET['token']) { die("You have not supplied a valid link to a validation page. Please go back to your e-mail and check your link."); } $money = 1000; //Base Starting Cash $crystals = 20; //Base Starting Crystals $donor = 3; //Base Starting Donor Days if(isset($key->promo)) { $code = $key->promo; $q = mysql_query("SELECT * FROM promo WHERE code = '$code'"); $promo = mysql_fetch_array($q); $money = ($promo['cash']) ? $money + $promo['cash'] : $money; $crystals = ($promo['crystals']) ? $crystals + $promo['crystals'] : $crystals; $donor = ($promo['donor']) ? $donor + $promo['donor'] : $donor; } if($key->vdID != $token) { die("You have followed an invalid link. Please go back to your email and make sure you have the correct validation link."); } else if($key->username == $key2->username) { die("This account has already been verified. Please <a href='login.php'>Login</a> to use your account"); } { $salt = '********'; $password = $key->password; $salted_hash = hash("sha512", ($salt . $password)); $db->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) VALUES ('{$key->username}', '{$key->username}', '$salted_hash', 1, $money, $crystals, $donor, 1, 100, 12, 100, 100, 5, 5, 100, 100, 1, '{$key->gender}', unix_timestamp(), '{$key->email}', -1, '$IP', '$IP')");$i=mysql_insert_id($c); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)"); $db->query("DELETE FROM validating WHERE vdID='{$_GET['token']}'"); if($_POST['ref']) { require "global_func.php"; $db->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); $db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); } print "You have signed up, enjoy the game.<br>"; ?> <meta HTTP-EQUIV="REFRESH" content="1; url=welcome.php"> <?php } ?> However, I can't get it to work. They do not get logged in and the $q2 on line 24 gives out a non-object error. Also I do not get auto logged in even if I get past this error. Could I get any help because I'm rubbish at cookies and that kind of stuff P.S - Line 21 the ctype_alnum messes up my page, when I remove that part it works properly. Am I using it wrong?
-
Just de-activate the register page and make them an account?
-
My post was directed at H4X0R666. This is a neat addon and I agree it does make things a lot easier
-
Pulling whats left of my hair out please help
gurpreet replied to Bennyh789's topic in Modification Support
As the error suggests, the error is an internal server one. Are you using a free host? -
It's basically just when you hover over the <th> or whatever the individual menu items come out.
-
Can't believe I didn't spot that! Not quite sure how tables work for layouts, but adding a td width property just for the energy seems to have fixed all of the rows. Thanks for that reply Peter
-
I tried that before, but I couldn't get it to work properly. Thanks for the reply though
-
I decided to change my energy to 100 for users and 150 for donators, and since then my bars have been weird As a temporary fix, I have made an opposite bar which is transparent. They look like this now: http://imageshack.us/photo/my-images/801/pic1bj.png/ However, I want to remove the opposite bar so there is only the coloured bar, like this: http://imageshack.us/photo/my-images/534/pic2kd.png/ However, when a bar isn't full, it all shifts to the center (there are no center tags or anything for this part of my page) like so: http://imageshack.us/photo/my-images/16/pic3kg.png/ And finally, here's my code for that part of the page: $enperc=(int) ($ir['energy']/$ir['maxenergy']*100); $wiperc=(int) ($ir['will']/$ir['maxwill']*100); $experc=(int) ($ir['exp']/$ir['exp_needed']*100); $brperc=(int) ($ir['brave']/$ir['maxbrave']*100); $hpperc=(int) ($ir['hp']/$ir['maxhp']*100); print <<<OUT <small>Name:</small><small><a href='viewuser.php?u={$ir['userid']}' title='My Profile'>$gn{$u} [{$ir['userid']}] $d</a><br /></small> <small>Money: <font color='#238E23'>{$fm}</font><br /></small> <small>Level: <font color='#238E23'>{$ir['level']}</font><br /></small> <small>Crystals: <A href=crystaltemple.php title='Crystal Temple'><font color='#238E23'>{$ir['crystals']}</font></a></small><br /> <small><b>Bricks:</b> <font color='#238E23'>{$ir['bricks']} [<a href='yourstreet.php?action=buy1'>Buy</a>]</table> <table width='100%' class='tydy' cellspacing='0'><Tr><TD> <small>Energy:</td><Td><img src=greenbar.png width=$enperc height=6 alt='{$ir['energy']}'> </small><small><font color='darkred'>({$ir['energy']})</small></font>$refill</td></tr><tr><td> <small>Will:</td><td><img src=bluebar.png width=$wiperc height=6 border='2' alt='{$wiperc}%'> </small><small><font color='darkred'>({$wiperc}%)</small></font></tr></td><tr><td> <small>Brave:</td><td><img src=yellowbar.png width=$brperc height=6 border='2' alt='{$ir['brave']}/{$ir['maxbrave']}'> </small><small><font color='darkred'>({$ir['brave']}/{$ir['maxbrave']})</small></font></td></tr><tr><td> <small>Health:</td><td><img src=greenbar.png width=$hpperc height=6 border='2' alt='{$hpperc}%'> </small><small><font color='darkred'>({$hpperc}%)</small></font></td></tr><tr><td> <small>Exp:</a></td><td><img src=bluebar.png width=$experc height=6 border='2' alt='{$experc}%'> </small><small><font color='darkred'>({$experc}%)</small></font></tr></td><tr><td></table> //More code here Any ideas? I can't see anything wrong with the code
-
Neon is telling you how to call the function. If that's too complicated, try using this one: function time_format($secs) { $times = array(3600, 60, 1); $time = ''; $tmp = ''; for($i = 0; $i < 3; $i++) { $tmp = floor($secs / $times[$i]); if($tmp < 1) { $tmp = '00'; } elseif($tmp < 10) { $tmp = '0' . $tmp; } $time .= $tmp; if($i < 2) { $time .= ':'; } $secs = $secs % $times[$i]; } return $time; }
-
Why not stick to 1, and fix the errors? You can post the errors here and people will gladly help
-
Ah I didn't spot that. Thank you very much lucky!