Wednesday, November 3, 2021

thumbnail

Know How Much Person Using Your program

 hi friend ,


Sometimes we need to know how many people use our application and how many times a day it is used, or to know who is online in the case of a chatting application or an application for online games, in order to make sure of the success or failure of the application and whether you will receive an updated version of the application as successful as the old version and is it suitable for marketing.


How you Know How Much  Person Using Your  program

using php & vb.net we can do this

acounter.php file :


<?php

$type = $_GET['action'];

if($type == "maxi")
{
    $rusers = fopen("user.txt" , "r") or die("Error!");
    $count = fread($rusers,filesize("user.txt"));
    $txt =$count += 1;
   
    $wusers =fopen("user.txt" , "w") or die ("Error!");
    fwrite($wusers,$txt);
    fclose($wusers);
    fclose($rusers);
}
else if ($type == "mini")
{
    $rusers = fopen("user.txt" , "r") or die ("Error!");
    $count = fread($rusers,filesize("user.txt"));
    $txt = $count -=1;
   
    $wusers =fopen("user.txt" , "w") or die ("Error!");
    fwrite($wusers,$txt);
    fclose($wusers);
    fclose($rusers);
}

?>

end text file named  : user.txt value 0

now vb file put this code to the form :


Public Class Form1
    Dim wclient As New System.Net.WebClient

    Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        Label2.Text = wclient.DownloadString("http://localhost/acount/acounter.php?action=mini")
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        wclient.DownloadString("http://localhost/acount/acounter.php?action=maxi")
        Label2.Text = wclient.DownloadString("http://localhost/acount/user.txt")
        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label2.Text = wclient.DownloadString("http://localhost/acount/user.txt")
    End Sub
End Class





Related Posts :

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

About