Login   Register  
Icontem

File: jQuery.AJAX/proxy.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jason Gerfen  >  jQuery.AJAX  >  jQuery.AJAX/proxy.php  >  Download  
File: jQuery.AJAX/proxy.php
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: jQuery.AJAX
Process form submissions using AJAX requests
Author: By
Last change:
Date: 2012-02-01 03:07
Size: 1,444 bytes
 

Contents

Class file image Download
<?php

/* load libraries first */
if (!file_exists('classes/class.libraries.php')){
 exit('Required libraries were not found. Please reinstall jQuery.AJAX distribution.');
}
include_once 'classes/class.libraries.php';

/* load up the libraries */
$libs = new libraries;

/* ensure sessions are started */
session_start();

/* Does a GUID exist for this machine? */
if (!isset($_SESSION[$libs->_getRealIPv4()])){
 $_SESSION[$libs->_getRealIPv4()]=$libs->_uuid();
}

/*
 * setup headers if the client set them. we do this just in case
 * the installed web server is not configured to enable these by default.
 * however, because they are set by the client the chance for modification
 * during a MITM attack is greater. the server should set these which
 * in this example the ../index.php script does and here we just mimic
 * what the client requests.
 */
header('X-Alt-Referer: '.getenv('HTTP_X_ALT_REFERER'));
header('X-Forwarded-Proto: '.getenv('HTTP_X_FORWARDED_PROTO'));
header('X-Frame-Options: '.getenv('HTTP_X_FRAME_OPTIONS'));
header('X-XSS-Protection: '.getenv('HTTP_X_XSS_PROTECTION'));

/* regenerate the session ID to help prevent replay' attacks */
session_regenerate_id(true);

/* load & initialize the XMLHttpRequest proxy processor */
if (!file_exists('classes/class.ajax.php')){
 exit('Required libraries were not found. Please reinstall jQuery.AJAX distribution.');
}
include_once 'classes/class.ajax.php';
$a = new ajax;
?>