-
Posts
244 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by Analog
-
I also had to add mysql_query($q_set); I put it right below $q_set = sprintf(".....
-
For some reason when a gang owner accepts an application it is not setting the gang field in the user table for the player that submitted the application. Here is the function I have, which is unedited from original: function sgang_app_accept() { global $gvars; if (!gang_auth_all($gvars->userid, array('pres', 'vice'))) { echo "<h3>You are not authorized to access this portion of the staff panel.</h3>"; gang_go_back('yourgang.php?action=sgang_home'); return; } if (!isset($_REQUEST['app_id']) or intval($_REQUEST['app_id']) < 1) { echo "<h3>Which application are you accepting?</h3>"; gang_go_back('yourgang.php?action=sgang_apps'); return; } $app_id = intval($_REQUEST['app_id']); $q_count = sprintf('select count(*) from users where gang = %d', $gvars->ir['gang']); list($num_members) = mysql_fetch_row(mysql_query($q_count)); $max_members = $gvars->data['gangCAPACITY']; if ($num_members >= $gvars->data['gangCAPACITY']) { echo "<h3>The $gvars->name_sl cannot hold any more members.</h3>"; gang_go_back('yourgang.php?action=sgang_apps'); return; } // appID, appUSER, appGANG, appTEXT <<< $q_get = sprintf('select a.appUSER, u.username from applications as a left join users as u on a.appUSER = u.userid where a.appGANG = %d and a.appID = %d', $gvars->ir['gang'], $app_id); $q_get = mysql_query($q_get); if (!$q_get or mysql_num_rows($q_get) < 1) { echo "<h3>This application does not exist.</h3>"; gang_go_back('yourgang.php?action=sgang_apps'); return; } list($them_id, $them_name) = mysql_fetch_array($q_get); $q_del = sprintf('delete from applications where appGANG = %d and appID = %d', $gvars->ir['gang'], $app_id); mysql_query($q_del); if (mysql_affected_rows() < 1) { echo "<h3>The application could not be accepted.</h3>"; } else { $q_set = sprintf('udpate users set gang = %d where userid = %d and gang = 0', $gvars->ir['gang'], $them_id); if (mysql_affected_rows() < 1) { echo "<h3>The application could not be accepted.</h3>"; } else { echo "<h3>The application was accepted.</h3>"; $them_p = gang_get_profile_link($them_id, $them_name); $us_p = gang_get_profile_link($gvars->ir['userid'], $gvars->ir['username']); gang_new_event($gvars->ir['gang'], sprintf('%s accepted an application from %s', $us_p, $them_p), 'escape'); event_add($them_id, sprintf('%s accepted your application to %s', $us_p, $gvars->data['gangNAME']), $gvars->c); } } gang_go_back('yourgang.php?action=sgang_apps'); } any ideas? Never Mind, I just found the error. Surprised this hasn't been mentioned. $q_set = sprintf('udpate users set gang = %d where userid = %d and gang = 0', $gvars->ir['gang'], $them_id); should be "update" instead of udpate... lol also didn't see anywhere that $q_set is ran through a query to the DB..
-
If your just doing a straight percent you could convert it to a decimal. 100% = 1, so 5% would be 0.05 then you could use energy = energy + (maxenergy * 0.05)
-
Here try this <?php require "globals.php"; print " <table width='90%' border='1' height='20'> <tr> <th><u>[url='usersonline.php?l=5']Five Minutes[/url]</u></th> <th><u>[url='usersonline.php?l=30']Thirty Minutes[/url]</u></th> <th><u>[url='usersonline.php?l=60']One Hour[/url]</u></th> <th><u>[url='usersonline.php?l=1440']One Day[/url]</u></th> </tr> </table>"; echo "<table width='90%' border='1' height='20'> <tr> <th height='6'><u>Order</u></th> <th><u>Name</u></th> <th><u>ID</u></th> <th><u>Level</u></th> <th><u>Gender<u/></th> <th><u>Last Action<u/></th> <th><u>Money</u></th> <th><u>Attack</u></th> </tr>"; // $_GET['l'] is the length in minutes that you want to check if(isset($_GET['l'])) { $len = abs((int)$_GET['l']); } else { $len = 5; } $len = time() - $len * 60; $q=$db->query("SELECT `username`,`userid`,`laston`,`gender`,`money`,`level` FROM users WHERE laston>$len ORDER BY laston DESC"); while($r=mysql_fetch_array($q)) { $la=time()-$r['laston']; $unit="secs"; if($la >= 60) { $la=(int) ($la/60); $unit="mins"; } if($la >= 60) { $la=(int) ($la/60); $unit="hours"; if($la >= 24) { $la=(int) ($la/24); $unit="days"; } } if($r['laston'] > 0) { $la=time()-$r['laston']; $unit="seconds"; if($la >= 60) { $la=(int) ($la/60); $unit="minutes"; } if($la >= 60) { $la=(int) ($la/60); $unit="hours"; if($la >= 24) { $la=(int) ($la/24); $unit="days"; } } $str="$la $unit ago"; } else { $str="--"; } if($r['last_login'] > 0) { $ll=time()-$r['last_login']; $unit2="seconds"; if($ll >= 60) { $ll=(int) ($ll/60); $unit2="minutes"; } if($ll >= 60) { $ll=(int) ($ll/60); $unit2="hours"; if($ll >= 24) { $ll=(int) ($ll/24); $unit2="days"; } } $str2="$ll $unit2 ago"; } else { $str2="--"; } $cn++; echo "<tr> <th>$cn.</th> <th>[url='viewuser.php?u=".$r[']".rasheed($r['username'])."[/url]</th> <th>".rasheed($r['userid'])."</th> <th>".rasheed($r['level'])."</th> <th>".$r['gender']."</th> <th>$str</th> <th>$".rasheed($r['money'])."</th> <th><a href='attack.php?ID=".$r['userid']."'>Attack ".$r['gender']." "; if($r['gender'] == 'Female') { echo "her"; } else { echo "him"; } echo "</a></th> </tr>"; } echo "</table>"; $h->endpage(); ?>
-
function index() { print " <table width='90%' border='1' height='20'> <tr> <th><u>[url='usersonline.php?online=fiveminutes']Five Minutes[/url]</u></th> <th><u>[url='usersonline.php?online=thirtyminutes']Thirty Minutes[/url]</u></th> <th><u>[url='usersonline.php?online=onehour']One Hour[/url]</u></th> <th><u>[url='usersonline.php?online=oneday']One Day[/url]</u></th> </tr> </table>"; } The default for the file doesn't make a call to display anything other than the links...
-
Can someone just check over this quick please
Analog replied to CherryDarling's topic in General Discussion
echo "[url='preferences.php?action=forumchange']Forum Info Change[/url] "; if($ir['bankpinwanted'] == 1) { echo "[url='preferences.php?action=bankpin']Bank Pin Change[/url] "; } else { echo "[url='bankmanager.php']Apply for a Bank Pin[/url] "; } echo "[url='preferences.php?action=pdetailchange']Personal Detail Change[/url] "; make sure you got all necessary " and ; in place... -
post your file so we can see what you have...
-
Should be global $db, $h;
-
Downloaded it to check it out, and had a few minor issues with the display of it. First thing I noticed is the endpage() wasn't called once the gangs system was loaded. Caused my layout to a bit wacko but simple fix for that. Also had an issue with the table headers maxing out the screen width. Floydian had a quick fix via IRC Added this to the gang_get_css_styles function for the style in /gangs/content.php #gangPage p.center {width: 100%;} Very nice replacement for the standard gangs systems. Awesome work Floydian
-
It depends on what you mean as a custom template... If its something you have custom designed by someone, IMO its yours to do what you wish with. Now if its one you purchase from a template website, then it depends on what the Terms of Use are.
-
I agree. I'd start by testing each option within the game that involves transfer of money. Check your basic logs of money, items, etc.. See if anything looks abnormal. To fix a problem you must first know what is causing the problem...
-
Maybe like a feed back area on a users profile..
-
yeah I realized that after walking away for a bit. Guess I was trying to reinvent the wheel!!!
-
maybe I should sleep... After looking at this more I see I am over thinking the solution.
-
I see your point but say the user input was 'a' abs() would return 0... right? the check for positive is so that a value of negitave is not ran through query for example $_POST['num'] is -1 so it would actually add 1 wouldn't it? $i = abs((int) $_POST['num']); $db->query("UPDATE table SET field = field - $i");
-
This should only return $var if it is numerical and positive correct? Also returned $var clean for a query? function CleanNum($var) { if(!is_numeric($var) and !is_int($var)) { echo 'Error: Input was not numerical.'; exit; } else if($var < 0) { echo 'All numerical inputs must have a positive value.'; exit; } else { return abs($var); exit; } }
-
Personally I'd just remove the rank display on the gym page. To me it really serves no purpose there.
-
UPDATE users SET userpass = md5('pass') WHERE userid = 1
-
That too Bertrand. Developing with error reporting set to ALL. Thought it could improve my coding quite a bit if I try to get rid of all types of errors.
-
ohhh jeez.... I was really over thinking a solution to this.. lol Never even thought about isset()
-
Notice: Undefined index: action in C:\wamp\www\xxx\xxx\file.php on line 24 I know the error is coming from $_GET['action'] being empty during the first view of the file. So my question is.... Is there a way around this other than ditching the switch function and creating separate files for each case of the switch? I tried this but of course still get the error... if(!$_GET['action']) { $_GET['action'] = "default"; }
-
With their virtually unlimited resources they will dominate the market. It will be very hard for any single person or small group to compete against them.
-
Re: Please help.... Thats a server problem it looks like...
-
Re: hi everyone Welcome to CE..... There are many here who I'm sure could help guide you in learning PHP...
-
Re: [v1/v2] Marrgiage with Shared House[v1/v2] Yeah, I also noticed my contact staff form is posted on there also.