Archive for the 'Scripts' Category

A Databse Handling Class In Php

Now this is the age of RAD (Rapid App Development Tool). To run faster in web development thins class may help you. This is simply a DBHANDLER class .
We suggest you to use the DBHANDLER Class and find its amazing potential in the modern age that is primarily governed by Rapid Application Development Tools.
class __dbConfigSys
{
var [...]

Cross Browser Window – Open In Javascript

Now a days, browser dependent scripts like javascript create problems due to the varieties of clients and versions of different browsers. So, the programmers or the web developers should be alert to implement such scripts on web. The scripts should be necessarily cross browser compatible …..
Check the simple window.open function….
var myPopupWindow = ”;
function openPopupWindow(url)
{
//If it [...]

WORKING WITH REST

rest-client.php
<?
$rs=”http://localhost/rest/rest-server.php”;
$qs=””;
$parray=array(‘amount’=>”15.00″);
foreach($parray as $par=>$value){
$qs=$qs.”$par=”.urlencode($value).”&”; }
$uri=”$rs?$qs” . “aid=01″;
echo $qs . “<br>” . $uri . “<br>”;
$cobj=curl_init($uri);
curl_setopt($cobj,CURLOPT_RETURNTRANSFER,1);
$xml=curl_exec($cobj);
curl_close($cobj);
echo htmlspecialchars($xml);
?>
rest-server.php
<?
$amount=$_GET["amount"];
if ($_GET['aid']!=”010915780″)
{
echo “Invalid A ID”;
}
else
{
$taxcalc=$amount;
echo “<?xml version=\”1.0\”?>”;
echo “<taxinfo>”;
echo “<result>”.$taxcalc.”</result>”;
echo “<result>”.$taxcalc * 20 .”</result>”;
echo “</taxinfo>”;
}
?>
Test It.

AJAX GET IN PHP

var http_request = false;
function makePOSTRequest(url) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,…
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
//http_request.overrideMimeType(‘text/xml’);
http_request.overrideMimeType(‘text/html’);
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (e) {
try {
http_request = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (e) {}
}
}
if (!http_request) {
alert(‘Cannot create XMLHTTP instance’);
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open(‘GET’, url, true);
http_request.send(null);
}
function [...]

How TO Handle Ajax POST With PHP

var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,…
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
//http_request.overrideMimeType(‘text/xml’);
http_request.overrideMimeType(‘text/html’);
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (e) {
try {
http_request = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (e) {}
}
}
if (!http_request) {
alert(‘Cannot create XMLHTTP instance’);
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open(‘POST’, [...]