Friday, July 31, 2015

How to Create Visitor Counter using PHP and Mysql

You might have seen visitor counter on many websites. Visitor counter is a simple script which is used to show number of visits on your webpage. This Post will explain you the simple  code to create your own  visitor counter using PHP and Mysql. You can use this code in any of your web applications to keep track on your visitors number in database for analysis 



Just Follow Two Simple Steps to create your own visitor counter using PHP and Mysql in your Web application

  1. 1.       Create a Table in your database
  2. 2.       Create a test file to implement the code (counter.php) 


Step 1: Create Table in your database 


Simply make a table with name tbl_counter(any name) in your database to keep the records of visitors.


CREATE TABLE `tb_counter` (
`counter` INT( 11 ) NOT NULL AUTO_INCREMENT ,
PRIMARY KEY ( `counter` )

) ENGINE = MYISAM ;






Step 2: Create a php file (Test File) 

Just implement the below mentioned code in your test file after creating table in your database

<?php
session_start();
require_once 'db_con.php';

$counter='';//initilize counter
$sql="SELECT counter FROM tbl_counter";
$resultc=mysql_query($sql);
$rows=mysql_fetch_assoc($resultc);
$counter=$rows['counter'];
// if count is empty
if(empty($counter)){
$counter=1;
$insertCounter="INSERT INTO tbl_counter set counter='".$counter."'";
$result1=mysql_query($insertCounter);
}



// increment visitor count
$increasecounter=$counter+1;
$sql2="update tbl_counter set counter='".$increasecounter."'";
$result2=mysql_query($sql2);



?>
<!DOCTYPE HTML>
<html>
    <head>
        <title>
            Hits Counter
        </title>
    </head>
    <h1>
      <?php echo "Total hits in this page=" .$counter ; ?>
    </h1>
</html>

Now you are done. Execute the code in your browser.Your own visitor counter using PHP and Mysql is ready to work now

To know more  watch my video tutorial in you tube to know more

Monday, July 13, 2015

How to Create a Javascript confirmation button



A confirmation box is used to let the user make a choice. A confirmation box will appear will with an "OK" button and a "Cancel" button. Different actions will occur depending on what button the user clicks. You can specify this course of action with conditional logic. A confirmation box can be displayed using Javascript's confirm() function.

Syntax:

confirm("Text to display in the confirmation box");






Here is a Example :
<html>
 <head>
 <script type="text/javascript">
            function checkdelete()
            {
                var chk=confirm("Are you sure delete This ?");
                if(chk){
                    return true;
                   
                }
                else{
                    return false;
                }
            }
        </script>
  </head>
  <body>
  <form>
  <input type="button" onclick="return checkdelete();" value="Click me for some reason" />
  </form>
  </body>
  </html>




















Thursday, July 2, 2015

How to Remove Shortcut Virus From Your Computer Laptop Pen Drive Flash Drive Memory Card

How to remove shortcut virus? Now a day it a common question for us. If your file is infected by it, it will be hidden and inaccessible until at some point that it becomes corrupted and unusable. Not good, right?
I created this ultimate guide on how to remove shortcut virus and other important things that you need to know about this virus. To make you aware about it and be able to protect your devices against it.  I am creating a video about How to remove shortcut virus form your computer. you can see this video and easily remove shortcut virus form your computer Laptop Pen Drive Flash Drive or memory card.So let’s start.