# Please help HIT COUNTER NOT WORKING

**URL:** https://forum.kirupa.com/t/please-help-hit-counter-not-working/320984
**Category:** Uncategorized
**Created:** [April 7, 2011, 10:28am UTC](https://forum.kirupa.com/t/please-help-hit-counter-not-working/320984 "2011-04-07T10:28:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Asteroids](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Asteroids](https://forum.kirupa.com/u/Asteroids)
#### Post date: [April 7, 2011, 10:28am UTC](https://forum.kirupa.com/t/please-help-hit-counter-not-working/320984/1 "2011-04-07T10:28:21Z")

</div>

hi…

I have a flash website in AS3 and I added a HIT COUNTER that works with php and a txt database; the problem is that I have everything

uploaded to my server and there’s no #[hit count] where it supposed to, when i open the activity window [safari] I can notice that the browser

is calling the php file but there’s no answer to the swf.

this is my AS3 flash code

```auto

[COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]net[/COLOR].[COLOR=#000000]URLVariables[/COLOR];
[COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]net[/COLOR].[COLOR=#000000]URLRequest[/COLOR];
[COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]net[/COLOR].[COLOR=#000000]URLLoader[/COLOR];
[COLOR=#993300]import[/COLOR] flash.[COLOR=#000000]events[/COLOR].[COLOR=#000000]Event[/COLOR];

[COLOR=#993300]var[/COLOR] variables:URLVariables = [COLOR=#993300]new[/COLOR] URLVariables[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#993300]var[/COLOR] varSend:URLRequest = [COLOR=#993300]new[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#0000ff]"hit_parse_file.php"[/COLOR][COLOR=#000000])[/COLOR];
varSend.[COLOR=#000000]method[/COLOR] = URLRequestMethod.[COLOR=#000000]POST[/COLOR];
varSend.[COLOR=#993300]data[/COLOR] = variables;

[COLOR=#993300]var[/COLOR] varLoader:URLLoader = [COLOR=#993300]new[/COLOR] URLLoader;
varLoader.[COLOR=#000000]dataFormat[/COLOR] = URLLoaderDataFormat.[COLOR=#000000]VARIABLES[/COLOR];
varLoader.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000000]COMPLETE[/COLOR],completeLoader[COLOR=#000000])[/COLOR];

variables.[COLOR=#000000]requestCode[/COLOR] = [COLOR=#0000ff]"add1"[/COLOR];

varLoader.[COLOR=#993300]load[/COLOR][COLOR=#000000]([/COLOR]varSend[COLOR=#000000])[/COLOR];

[COLOR=#993300]function[/COLOR] completeLoader[COLOR=#000000]([/COLOR]event:Event[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR]
[COLOR=#000000]{[/COLOR]
    [COLOR=#993300]var[/COLOR] countVar = event.[COLOR=#993300]target[/COLOR].[COLOR=#993300]data[/COLOR].[COLOR=#000000]phpCount[/COLOR];
    hitCount_txt.[COLOR=#993300]text[/COLOR] = countVar;
[COLOR=#000000]}[/COLOR]

```

and this is my php code

```php
<?php 

if($_POST['requestCode']== "add1"){ 

$txtDatabase = "flash_hit_counter.txt"; 

$currentNumber = file_get_contents($txtDatabase, true); 

$fh = fopen($txtDatabase, 'w') or die("cannot open file"); 
$newNumber = CurrentNumber +1; 
$data = "$newNumber"; 
fwrite($fh, $data); 
fclose($fh); 

print "phpCountVar = $newNumber"; 
} 
?> 

```

PLEASE HELP!!!
