Jump to content
MakeWebGames

Recommended Posts

Posted

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

Posted

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.

Posted
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.

Posted

[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!

1282185183_ScreenShot2011-12-15at11_28_30.png.614b8c2deffe58ba17a388055f613cb1.png

Posted

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.

Posted

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.

Posted

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!

Posted

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?

Posted

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!

438861346_ScreenShot2011-12-21at12_37_27.png.dc912ea404130e85495a4f732938f5a5.png

Posted

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.

Posted

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.

Posted (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 by spikereloaded

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...