PHP Classes

File: EasyFunctions.php

Recommend this page to a friend!
  Packages of raja   Login and DB classes quick start   EasyFunctions.php   Download  
File: EasyFunctions.php
Role: Auxiliary script
Content type: text/plain
Description: GetScriptName, GetFileName, RedirectTo, GetServerName, GetHostName, GetCurrenURL,GetIP etc etc etc
Class: Login and DB classes quick start
Authenticate users with records in MySQL database
Author: By
Last change:
Date: 18 years ago
Size: 959 bytes
 

 

Contents

Class file image Download
<?php

function GetScriptName(){
    $ScriptName=basename($_SERVER['SCRIPT_NAME']);
    return $ScriptName;
} 

function GetFileName(){
    $FileName=basename(__FILE__);
    return $FileName;
}

function StartSessionIfNot(){
    if(session_id()){
        //nothing to do
    }else{
        session_start();
    }
}



function RedirectTo($URL,$AndExit=true){
    header("Location:$URL");
    if($AndExit){
        exit;
    }
}

function GetServerName(){
    $ServerName=$_SERVER['SERVER_NAME'];
    return $ServerName;
}

function GetHostName(){
    $HostName=$_SERVER['HTTP_HOST'];
    return $HostName;
}

function GetCurrenURL(){
    $CurrenURL=$_SERVER['REQUEST_URI'];
    return $CurrenURL;
}

function GetReferer(){
    $Referer=$_SERVER['HTTP_REFERER'];
    return $Referer;
}

function GetFormGet($VarName){
    if (isset($_GET[$VarName])){
        return $_GET[$VarName];
    }else{
        return false;
    }
}

function GetIP(){
    $IP=$_SERVER['REMOTE_ADDR'];
    return $IP;
}

?>