Bits N Tricks

A platform to contribute to the best of our knowledge so someone else can be benefited.

Facebook Connect in Php 30Dec, 2010

Facebook Connect in Php

Facebook Connect in PHP,Just Follow these Steps :- Upload all the files of zip folder on server.(Attached with this post) Step 1 : Just open the file where you have to use facebook connect.(e.g abc.php) Step 2: Just include this javascript file in head :- “<script src=”http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php” type=”text/javascript”></script>”. Step 3: Include the file “facebook.php”(Uploaded with this post). Step 4: To put login button of facebook connect :- <fb:login-button onlogin=’window.location=”http://www.xyz.com/abc.php”;’ size=”medium” background=”white” ></fb:login-button> Step 5: create the object :- $facebook = new Facebook(‘Facebook API key’,’Facebook App Secret Key’,true); Step 6: To get the user id of facebook login person:- “$fUserId = $facebook->get_loggedin_user();” Step 7: To get the session key for the api -> $fc = new FacebookRestClient(‘facebook Api keyApi secret key’,$facebook->api_client->session_key);…

Posted in: PHP
Install Mac on normal machine 28Dec, 2010

Install Mac on normal machine

Introduction There are thousands of Computer Users who would always dream to own a Mac and this is not just for the beautiful looks or the powerful hardware but for the Operating System OS X which is one of the reason Apple is selling their products in large numbers. Now its quite possible for anyone to install a Mac OS X Snow Leopard the latest OS from Apple on their normal computers powered with Windows or Linux. Here are few of the reasons why you would be looking to perform this job. 1.Mac is a operating system which is less prone to viruses. 2.High graphics Steps for installing Mac on a normal Machine. Things you need for starting the installation…

Posted in: Security, Windows
How to make your website password protected using .htaccess? 10Dec, 2010

How to make your website password protected using .htaccess?

How to make a website password protected in just 2 minutes? It’s simple. Here, we will be using .htaccess to authenticate our valuable stuff on the web. Thus to achieve the same follow the below mention 3 simple steps. This whole process, will require us to create two files (.htaccess and .htpasswd) and have to put them on FTP under the folder to which we would like to make password protected. .htaccess – Below is the code for .htaccess file AuthUserFile /home/domains/xyz.com/.htpasswd [path to .htpasswd file] AuthType Basic AuthName “Warning: This is a restricted area…” .htpasswd – In this file, we need to mention the username and password using which one can login to restricted area. Username:passwordPlease note: we must…

Posted in: Apache, Security
How to run a PHP script as Cron job from SSH (Linux shell) 12Nov, 2010

How to run a PHP script as Cron job from SSH (Linux shell)

You can run a PHP script on cron by setting up a crontab For this, first login to your shell using an SSH client such as PuTTY. And on the command line, type the following command (here # means the shell prompt): # crontab -e That will put you in the Vi editor editing your crontab. First press “i” to begin inserting, then type out your cron line following the format below for each line, then press the “escape” key on your keyboard to get out of insert mode, and then type “:wq” and press “enter” to save it. The form of a crontab file is: minute hour day month weekday command For example: 42 4 1 * * /usr/bin/php…

Posted in: Cron, SSH
How to use MySQL from SSH (Linux shell) 12Nov, 2010

How to use MySQL from SSH (Linux shell)

Using MySQL from SSH may seem to be quite tricky if you’ve never done it before – but fear not – below is a list of MySQL commands that you can use to perform the required actions. Start by logging-in using a SSH client, like PuTTY, to access the shell command line. Below when you see # it means from the unix shell. And when you see mysql> it means from a MySQL prompt after logging into MySQL. To login (from unix shell) use -h hostname only if needed # mysql -h hostname -u root -p This would ask you for a password and after providing the correct password you’d be logged-in to the MySQL prompt. If you get an…

Posted in: MySQL, SSH
WinRunner (Invoking Flight Reservation) 31Aug, 2010

WinRunner (Invoking Flight Reservation)

It is a sample application we are going to test in Winrunner. Steps:- 1.) Open Win Runner 2.) Press F2(Start Recording). 3.) Press F7 4.) Select Invoke Application. 5.) Click Args. 6.) Click browse. 7.) Open C://Program Files/Mercury Interactive/WinRunner/Samples/Flight/app/flight1a 8.) Click Open 9.) Click Paste 10.) Click Execute. 11.) Input Agent Name,Password as “mercury”(always to open this). 12.) Click Ok,(Closes Fucntion Generator) 13.) Stop Recording. 14.) Closes Flight Reservation. 15.) Run the recorded Script

Posted in: Testing