Showing posts with label Websites. Show all posts
Showing posts with label Websites. Show all posts

Tuesday, March 27, 2012

Get Url From Browser in Php

Getting the URL  from the parent window when you use a popup. This small Example code might help you to get the url from the parent window this can be used normal windows also

 if(isset($_SERVER['HTTP_REFERER']))
{
   
    $strPrevScheme = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_SCHEME);
 
    $strPrevHost = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
 
    $strPrevPath = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH);
 
    $strPrevURL = urlencode($strPrevScheme.'://'.$strPrevHost.$strPrevPath);
   
   
}

the parse_url(url) gives the following array 

Array
(
    [scheme] => http
    [host] => hostname
    [user] => username
    [pass] => password
    [path] => /path
    [query] => arg=value
    [fragment] => anchor
)
 

 
reference - http://in2.php.net/manual/en/function.parse-url.php 

Thursday, March 22, 2012

Closing the PopUp and redirecting Parent Window

I have tried for few hours to solve this problem Here is the simple example which helps you to solve the Problem

Problem:
 Create a PopUp window on submission of a value in PopUp the PopUp Closes and the Parent Windows redirects to Some other Page 

Solution:
Here is the simple way to solve it

Create 2 php pages

1. popup.php
Copy this Code

<html>
    <head>    
    </head>
    <body>
        <a href="#" onclick="window.open('popupcode.php','Login','height=500,width=420,scrollbars=yes');return false;">PopUp</a>
    </body>
    </html>




Tuesday, March 20, 2012

Switch Off Foreign Key Constraint

I used to use this code regularly but when i found it for the first time it took me to read many pages to read after getting the code i thought this would be useful for all people like me who want to Switch off the Foreign key Constraint in their tables

This is helpful when you are actually want to create tables irrespective of the Foreign key constraint 

To Turn Off - SET FOREIGN_KEY_CHECKS = 0;

To Turn On - SET FOREIGN_KEY_CHECKS = 1;


OAuth 2.0

Now its time to Switch on the easier and secured version of OAuth Protocol OAuth 2.0 so here is the presentation i have made which makes u people easy to understand the Protocol and important points to have talk to the server 


Presentation  - Download 




The presentation is based on the Oauth 2.0 written by the developers of Microsoft and Facebook on January 2012







Friday, March 2, 2012

Curl Using PHP in a Gist

cURL: It is  a client that deals with URL so its named as cURL so as to say that it deals with URL only 

It is used to make client communicate with the server using command line 
arguments using cURL syntax

Its main use is to provide security to the URL's sent through the browser to the server
 
 The main commands in cURL  which i found is important are


1. curl_init() - with which the main curl operation starts

2.curl_setop($charecter,options,value)


                    $charecter = curl handle returned by curl_initi()


           options = curl provides various options with general syntax 

curlOPT_XXX 
                         other options are found in - PHP website

          value = value of the url

3. curl_exec() - which is used to execute a $charecter in which the information has be moved 

4.curl_close() - this is used to close the curl connection




          






Thursday, March 1, 2012

Connect With Facebook API in Simple 7 Steps

Here is the presentation or Document Where i have described Simple 7 Steps To Connect to Facebook this can be used to any Social Networking Site

Download the Presentation From this Link ---- Download











Simple Script to Share your site in different Social Networks

A simple Script used to share your Website on Different Social Networks Replace your Wesite in the my Blog URL Place