A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 43

Thread: Save to drafts feature for flashkit!

  1. #21
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    disconnected users now log out all the time! be it your laptops outa battery, you exit the window, or you click the logout button

  2. #22
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    chat now appears over users heads

  3. #23
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Chat uses 10000()(()()x less bandwidth now, scrollbar for chat is also fixed, and chat is clear for users who just logged in and chat logs are stored in a closed environment

  4. #24
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Alooy,

    I tried to look today but it would not load - 4 times.

    Your hit counter tells not the truth, if you refresh as I did to see if the game would load again(which it did not), the counter went up.
    I use a counter that only adds if you have a new ip address (not in the list of visited addresses), makes it slightly more real. I cam imagine that at least a third or more of the visits are bots and of course people refreshing or perhaps logging out.

    I wouldnt mind a quick glance if all these updates you keep saying are true and working.
    Last edited by fruitbeard; 05-04-2015 at 07:44 AM.

  5. #25
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Hi, I removed the actual game for a day, I have to remove this bug that exposes the way a certain part of the game works sorry about that, I dont advise playing the game yet, its just pre alpha testing stuff but yeah all the updates are true

  6. #26
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    I will try out ip collection than, is it legal?

  7. #27
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    HI,

    I'm not sure if it's legal or illegal, however ,all you are doing is creating a list of which ones have visited your site, not doing anything with them, most peoples ip change after a while automatically anyway.

    Saying that, Google and other places store your ip for certain things, I think this place even uses your ip for something or another!!

    How I do it is like so,

    PHP Code:
     <script language="JavaScript">
            function countUnique()
            {
                count = '<?php
                
    //error_reporting(0);
                
    $ip = (getenv("HTTP_X_FORWARDED_FOR")) ? getenv("HTTP_X_FORWARDED_FOR") : getenv("REMOTE_ADDR");
                
    $theFile ='ipvisits.txt';
                
    $lines file($theFile,FILE_IGNORE_NEW_LINES);
                
    $count count($lines);
                if (
    in_array($ip,$lines))
                {
                    echo 
    $count;
                }
                else
                {
                    
    $count++;
                    
    $addNew fopen($theFile,"a+");
                    
    fwrite($addNew"\n".$ip);
                    
    fclose($addNew);
                    echo 
    $count;
                }
                
    ?>'
                return count;
            }
        </script>
    and use vistText.text = ExternalInterface.call('countUnique'); in flash

    then you need a txt file (ipvisits.txt in this example) in the same directory or wherever you like it but change the code accordingly

    but you would also need to give your page a .php extension for this to work

  8. #28
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Hey nice, Ill try it out I've never tried ExternalInterface.call on flash

  9. #29
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Works great

  10. #30
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Excellent, I was just in the process of sending the sample files, but FK had an error so it didn't post.

    I asume you also used
    PHP Code:
    import flash.external.ExternalInterface;
    if(
    ExternalInterface)
    {
        
    visitText.text ExternalInterface.call('countUnique');


  11. #31
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    nope, i didnt use your flash code, I just ended up using your php js + also making it w+ to another textfile the actual output number and from flash just loading up the textfile, im going to make a new hitcounter design now :P

  12. #32
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    If you want to try this slightly different method that I tried its

    flash code:
    PHP Code:
    loadFile = new LoadVars();
    loadFile.onData = function(data){
        
    hits.text data;
    }
    loadFile.load("http://www.indocastles.com/play/hits.txt"); 
    php+js code:
    PHP Code:
    <script language="JavaScript"> 
            function countUnique() 
            { 
                count = '<?php 
                
    //error_reporting(0); 
                
    $ip = (getenv("HTTP_X_FORWARDED_FOR")) ? getenv("HTTP_X_FORWARDED_FOR") : getenv("REMOTE_ADDR"); 
                
    $theFile ='ipvisits.txt'
                
    $theFileNum 'hits.txt';
                
    $lines file($theFile,FILE_IGNORE_NEW_LINES); 
                
    $count count($lines); 
                if (
    in_array($ip,$lines)) 
                { 
                    echo 
    $count
                } 
                else 
                { 
                    
    $count++; 
                    
    $addNew fopen($theFile,"a+"); 
                    
    fwrite($addNew"\n".$ip); 
                    
    fclose($addNew); 
                    
                     
    $addNum fopen($theFileNum,"w+"); 
                    
    fwrite($addNum$count); 
                    
    fclose($addNum);
                    echo 
    $count
                } 
                
    ?>
                return count; 
            } 
        </script>
    thanks for contributing

  13. #33
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    It's just the same exept you make it go through two files thats all and without using external interface.
    You could also avoid using the javascript the way you are doing it by just calling the php file, it works for you anyway.

    I'm not sure where you are calling the javascript from though

    Glad I helped.

  14. #34
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    It seems to be called upon page load without even having had the swf on it, anyways the counters up, the game will be up tonight

  15. #35
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    ok i fixed le bug, you are welcome to test it out and make 2 accounts and try to talk to your self walk around: note the game is still in pre alpha and you cant attack anyone, you can just walk around with anyone online, and chat with em and shoot and them but not hurt them, 0 game play is released as of now,

  16. #36
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    in version 0.2.9t patched a bug that would logout random players who were logged on for no reason, and game uses 6% less cpu usage overall than previous versions

  17. #37
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    lol one of the unique ip visits was a web crawler xD @fruitbeard

  18. #38
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I had a look but didnt regsiter.

    Out of the 12 visits you have had ( remember your own ip changes randomly too, or you can reset your router), one being me the other being a crawler, that makes around 10%, thats quite high especially when the visitor numbers get bigger.

    I imagine you might get more robots and crawlers as and when you advertise your web address more.

  19. #39
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    hmm idk, still doesn't seem reliable I have a feeling someone can just use a proxy and make abunch of hits too, but the hit counters just for looks I dont really care much about its other purposes
    Last edited by AS3.0; 05-10-2015 at 11:45 PM.

  20. #40
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Theres nothing meant to be reliable about it Alloy, it merely stops people making an extra log count if they have already visited using their current ip.

    Of course somebody can use a proxy, but it will add that proxy address to the list once and therefore only one hit given no matter how many times they visit or refresh.

    I'm not so sure you understand what it is doing really and it certainly isn't any security system.

    Hit counters are so nineties anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center