spikereloaded Posted December 15, 2011 Posted December 15, 2011 Hey guys. I'm currently finding that when my users do crimes it is actually making them doing it more than once without them knowing. Eg. They are doing a crime for 2 brave and they are losing 4 brave because it is running twice. This is also happening in the forums resulting in multiple blank forum posts as well as blank topic posts. I've looked at all the changes Ive made but cnt find anything immediately obvious to me. Anybody got any ideas or tips that could help explain this?? Thanks very much Quote
lucky3809 Posted December 15, 2011 Posted December 15, 2011 somewhere you may have duplicated a query, have you checked all your queries? Quote
a_bertrand Posted December 15, 2011 Posted December 15, 2011 This could be also due to browser caching mechanism which ask first the server if a page has been modified and then ask for the page itself. So basically for one click you could get 2x a request... and therefore doing twice what the user asked. Quote
spikereloaded Posted December 15, 2011 Author Posted December 15, 2011 somewhere you may have duplicated a query, have you checked all your queries? Well as the problem is occurring on a few different pages I thought that the problem may be n globals or header, but can't see any duplicated queries there. It also doesn't happen on all pages eg. It makes the user do crimes more than once and post forum posts, but it doesn't make the user send mail twice or send money more than once. Quote
a_bertrand Posted December 15, 2011 Posted December 15, 2011 Check if you use POST for those which do things only once, and GET method for the others which occur twice... if the answer is yes, then read again what I wrote above ;) Quote
spikereloaded Posted December 15, 2011 Author Posted December 15, 2011 [ATTACH=CONFIG]206[/ATTACH] I've attached a log of one of my staff to show what is happeninig, i'm still a little confused to be honest as i don't even know which page to start looking for the problem. Sorry if i'm being blind! Quote
a_bertrand Posted December 15, 2011 Posted December 15, 2011 As said you use GET, which does request 2x... So you either need to have a "transaction" id passed and accept only one click for that transaction, or change the actions to POST and solve your issue. Quote
spikereloaded Posted December 15, 2011 Author Posted December 15, 2011 so could this be part of the problem?? print " <form action='docrime.php' method='get'> Quote
a_bertrand Posted December 15, 2011 Posted December 15, 2011 Yes, you may try to change it to method='post' but you need also to change all the $_GET['something'] in $_POST['something'] for the things you pass in hidden fields or whatever.... Try and let us know how it goes. Quote
spikereloaded Posted December 15, 2011 Author Posted December 15, 2011 i changed that section to method='post' but could not see any $_GET['sddfg']'s in my criminal page. and if i just leave the bit i changed, it comes up saying invalid crime when someone tries to do a crime?? Quote
a_bertrand Posted December 15, 2011 Posted December 15, 2011 well I don't know your code, so I can't help more than that... sorry... you must go through it and understand it ;) Quote
spikereloaded Posted December 19, 2011 Author Posted December 19, 2011 so im still having this problem. Would anybody be willing to take a look at my forum code and seeing if they can spot any problems. Wiling to pay a small amount for the help!! Quote
a_bertrand Posted December 20, 2011 Posted December 20, 2011 As said, it seems that only the GET method are duplicated, we gave you multiple ways to solve it, now either hire somebody for fixing it, or start learning PHP. Quote
spikereloaded Posted December 20, 2011 Author Posted December 20, 2011 i appreciate you have told me a number of ways to solve it but im sure you can understand that this is not my full time job. I am a beginner to php and am trying to learn as much as possible so please dont think im just being lazy. As i've already stated, i'm not sure where i should be looking? if it is happening on all pages does that mean it is likely to be within the header.php? Octarine, whats the best way to log my queries to gauge their results? again, im new to php so please excuse my ignorance! Quote
a_bertrand Posted December 20, 2011 Posted December 20, 2011 Sorry Octarine but I doubt the issue is with PHP errors, but more about how PHP is handled. And this requires a tiny bit more knowledge or tricks to avoid double loading. Quote
bluegman991 Posted December 20, 2011 Posted December 20, 2011 I have a few things for you to try. In your crimes page. Where you execute your queries. Replace $db->query with mysql_query. Are they still running twice after that? Have a few questions for you that will help me to help you better. Are ALL of your users experiencing this problem? If not is it the majority or the minority? Is this problem ONLY on the crimes page? If not is it ALL PAGES or just a select few? Quote
spikereloaded Posted December 21, 2011 Author Posted December 21, 2011 thanks bluegman ive changed all the $db queries in my crimes page but their still running twice. im pretty sure it's being experienced by everyone. I've also changed most of the $db queires in my header and mainmenu pages as well but no change. As far as i can tell it is happening on all pages as shown in the screenshot i've attached. thats from my log user page, and most of the pages show as being visited twice if not more within a second of eachother. [ATTACH=CONFIG]218[/ATTACH] thanks again! Quote
a_bertrand Posted December 21, 2011 Posted December 21, 2011 yes everything double beside POST... as I suspected. Quick solution: hire somebody like Djkanna or others to solve the issue for you, or transform your GET in POST or add a progressive number which could not be asked twice for the same player, like docrime.php?step=1 the first time, then step=2 next one and so on, and check that you don't get something you already answered in which case you don't do anything. Quote
bluegman991 Posted December 21, 2011 Posted December 21, 2011 Having the incrementing/changing GET parameter (as a_bertrand said) would only be a temporary fix. So I recommend you find someone who can fix it or do it your self. Below I will give you the first step to go through if you do choose to fix it yourself. Sorry but with me not being able to see your code I will have to make you go through more intensive tasks to find where this bug is coming from. Well first off you will wan't to test in a browser with no add-ons. Some add-ons like the ones designed to make page loading faster usually pre-load or post-load links on the page causing pages to be loaded twice. I assume that you know enough php and mysql to edit databases and pages. Things for you to do. Create a table named "qry_testing". field "id" (auto increment) field "page" (text) field "ajax" (int) field "user" (int) field "time" (int) field "usload_id" (int) field "rType" (text) field "files" (text) ^^Keep Table (will help us with other things)^^ In your headers page at the end of the page (so we can be sure everything we need is already initialized). $_SESSION['pload_id']=isset($_SESSION['pload_id']) ? $_SESSION['pload_id']+1 : 1; function trackLoad() { $incls=get_included_files(); $inclStr=''; foreach($incls as $v) { $inclStr.=$v; } $page=__FILE__; $ajax=isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH']=='xmlhttprequest' ? 1 : 0; $user=isset($_SESSION['userid']) ? $_SESSION['userid'] : 0; $time=time(); $loadid=$_SESSION['pload_id']; $rType=(!empty($_POST) ? 'POST' : '').' - '.(!empty($_GET) ? 'GET' : ''); mysql_query("INSERT INTO `qry_testing` (`page`,`ajax`,`user`,`time`,`usload_id`,`rType`,`files`) VALUES('$page',$ajax,$user,$time,$loadid,'$rType','$inclStr')"); } trackLoad(); The above will basically give you a page load history on all of your users. After a few lines get into the table post up a printscreen or copy / paste of the rows in the table. Depending on what I see from the rows that are inserted into the qry_testing table I will determine what you should do next. Quote
spikereloaded Posted December 22, 2011 Author Posted December 22, 2011 (edited) hey bluegman so i think ive found the problem, it seems to be this bit of code where i deleted the image url but left the code in?!?! any reason why that would happen ?? .lgrad { background-image:url(); background-repeat:repeat-y; width:19px; } Edited December 22, 2011 by spikereloaded Quote
bluegman991 Posted December 22, 2011 Posted December 22, 2011 (edited) Yep when you specify a blank url. html/css will translate it as the current url. So background-image:url(); is the same as background-image:url(http://domain/page.php); Which will cause it to load the current page you are on again. Edited December 22, 2011 by bluegman991 Quote
spikereloaded Posted December 22, 2011 Author Posted December 22, 2011 ahh right thank bluegman Sorry to have wasted your time with such a simple problem, but now i spose i know for the future aswell. cheers everyone for the help! Quote
Teh Sin Posted December 26, 2011 Posted December 26, 2011 I had this problem before, for me it was because I put the ad box in my main menu, look for something like that Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.