Category Archives: Miscellaneous

PHP Tracker GPS and GSM Tracking

GG-Tracker tracks your mobile using GSM Cell-location in combination with GPS. It uses both GPS and GSM networks to get a position. If only GSM is available it relies on location previously stored using a GPS receiver. The position is displayed on the internet using a Google Maps integration. The operation is very simular to how Google Maps ‘My location’ works, only this time you are in control. If a GPS receiver is connected it does two things, it stores the current position and the GSM cell the phone is connected to. If the GPS is not connected anymore it checks the database for previously known coordinates of the GSM cells. When it was connected to GPS the program stored the GSM cells, so all it does, is look back and see if there is a proper fit. If it finds a fit, it reports that as a position, meaning that GPS is not necessary anymore for positioning.

 

 

<?php
//**********************************************************************************************
//**********************************************************************************************
//***** GG-Tracker is based on Aspicore GSM Tracker.                                       *****
//*****                                                                                    *****
//***** It's in a development phase and no warranties are given for anything. This program *****
//***** may not function the way you expect it and the author is not responsible for       *****
//***** anything. However, I hope you enjoy it and ammend it where possible!               *****
//*****                                                                                    *****
//***** An example of GG-Tracker is live at http://gg-tracker.eppenga.com                     *****
//**********************************************************************************************
//**********************************************************************************************

//**********************************************************************************************
//*****                                      PROGRAM                                      ******
//**********************************************************************************************

header("Expires: 0");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Content-Type: text/html; charset=ISO-8859-1");
header('Content-Disposition: inline; filename="response.html"');
?>

<?php
/* Include settings */
include ("config.php");
include ("config_check.php");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
 <style type="text/css">
 <!--
 td { font-family: verdana,arial,helvetica,sans-serif; font-size: 7pt;
 border: 1px solid black;
 vertical-align: baseline }
 th { font-family: verdana,arial,helvetica,sans-serif; font-size: 8pt; font-weight: bold;
 border: 1px solid black;
 border-style: solid; border-width: 1px;
 vertical-align: baseline }
 td.small { font-family: verdana,arial,helvetica,sans-serif; font-size: 6pt }
 body         { font-family: verdana,arial,helvetica,sans-serif; font-size: 8pt }
 base         { font-family: Courier,MONOSPACE; font-size: 10pt }
 table        { border-collapse: collapse; border: solid thin black }
 A:link         { color: black; text-decoration: underline }
 A:visited      { color: black; text-decoration: underline }
 A:active      { color: black; text-decoration: underline }
 A:hover      { color: black; text-decoration: none }
 caption      { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold }
 -->
 </style>
 <?php if ($rss) { ?>
 <link rel="alternate" type="application/rss+xml" title="GG-Tracker RSS Feed" href="<?php echo $rssfile; ?>" />
 <?php } ?>
 <meta http-equiv="refresh" content="60;URL=." />
 <title>GG-Tracker (GSM and GPS location combined)</title>
<?php

/* Open and check connection */
$link = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if (!$link) {
 printf("Connect failed: %s\n", mysqli_connect_error());
 exit();
}

/* Calculate history and produce XML files for Google Earth */
if ($ghistory) include ("calc_gearth.php");

/* Get the last known position with full details of the tracked phone */

$query = 'SELECT GPSMSGID, PHONE, STATUS, LATITUDE, LONGITUDE, SPEED_KNOTS, COURSE_DEG, TIME_RECEIVED, EVENT_TYPE, CELL_ID, LAC, MCC, MNC, NWNAME, LABEL, REMOTE_IP '
 . 'FROM GPS ORDER BY GPSMSGID DESC LIMIT 1';
$result = mysqli_query($link, $query);

if (!$result) {
 printf("Query failed: %s\r\n", mysqli_error($link));
 printf("Tried to execute the following SQL query:\r\n");
 printf("%s\r\n", $query );
 mysqli_close($link);
 exit();}

$row_cnt = mysqli_num_rows($result);
if ($row_cnt == 0) {
 printf("No data, connect Aspicore tracker first.\r\n");
 exit();
 }
else {
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $id = $line['GPSMSGID'];
 $phone = $line['PHONE'];
 $status = $line['STATUS'];
 $latitude = $line['LATITUDE'];
 $longitude = $line['LONGITUDE'];
 $speed = round($line['SPEED_KNOTS']*1.852,2);
 $course = $line['COURSE_DEG'];
 $rtime = strtotime($line['TIME_RECEIVED']) + $t_offset*3600;
 $rtime = date('Y-m-d H:i:m', $rtime);
 $nwname = $line['NWNAME'];
 $cell = $line['CELL_ID'];
 $lac = $line['LAC'];
 $mcc = $line['MCC'];
 $mnc = $line['MNC'];
 $mode = $line['EVENT_TYPE'];
 $label = $line['LABEL'];
 $ipaddress = $line['REMOTE_IP'];
}

/* Get the last two good positions for a tail */
$query = 'SELECT LATITUDE, LONGITUDE '
 . 'FROM GPS WHERE STATUS IN (\'A\', \'B\',\'X\',\'C\',\'T\',\'R\') '
 . 'ORDER BY GPSMSGID DESC LIMIT 1,3';
$result = mysqli_query($link, $query);

$row_cnt = mysqli_num_rows($result);

if ($row_cnt == 3) {
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $lat_1 = $line['LATITUDE'];
 $lon_1 = $line['LONGITUDE'];
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $lat_2 = $line['LATITUDE'];
 $lon_2 = $line['LONGITUDE'];
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $lat_3 = $line['LATITUDE'];
 $lon_3 = $line['LONGITUDE'];
}
else
{
 $lat_1 = $latitude;
 $lat_2 = $latitude;
 $lat_3 = $latitude;
 $lon_1 = $longitude;
 $lon_2 = $longitude;
 $lon_3 = $longitude;
}


//Google maps script, only execute if there are positions found
if ($status <> "Z" &amp;&amp; $status <> "F") {
 echo "
 <script src=\"http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=$gmaps\"
 type=\"text/javascript\"></script>
 <script type=\"text/javascript\">

 //<![CDATA[
 function load() {
 if (GBrowserIsCompatible()) {
 var map = new GMap2(document.getElementById(\"map\"));
 map.setCenter(new GLatLng($latitude, $longitude), 14);
 map.addControl(new GSmallMapControl());
 map.addControl(new GMapTypeControl());
 var marker = new GMarker(new GLatLng($latitude, $longitude));
 map.addOverlay(marker);
 GEvent.addListener(marker, \"click\", function() {
 var html = '<div style=\"width: 250px; height: 50; padding-right: 10px\"><font size=2><b>Hello World!</b><br>This is my my current position. If you enjoy this application, please <br><a href=\"http://www.eppenga.com/gsm-gps-tracking.html\">read my webpage.<\/a><\/font><\/div>';
 marker.openInfoWindowHtml(html);
 });
 var polyline = new GPolyline([
 new GLatLng($lat_3, $lon_3),
 new GLatLng($lat_2, $lon_2),
 new GLatLng($lat_1, $lon_1),
 new GLatLng($latitude, $longitude)
 ], \"#ff0000\", 7);
 map.addOverlay(polyline);
 }
 }

 //]]>
 </script>
 "
;
}

//Get some statistical data
include ("calc_stats.php");

//The rest of the internet page
echo "
 </head>

 <body onload=\"load()\" onunload=\"GUnload()\">

 <center>
 <table width=600 cellspacing=2 cellpadding=2>
 <tr align=center>
 <td colspan=3>
 <font size=2 color=red><b>Welcome to GG-Tracker (GPS and GSM Tracking)</b></font>
 </td>
 </tr>
 <tr>
 <td><b>Location label: $label</b></td>
 <td><b>Report date: $rtime</b></td>
 <td><b>Cellphone IP-address: $ipaddress</b></td>
 </tr>
 <tr>
 <td><b>Topspeed today/ever: $maxspeed[1]/$maxspeed[0] km/h</b></td>
 <td><b>Distance to home: $disthome km</b></td>
 <td><b>GSM antenna (useful/total): $gsm_antenna[0]/$gsm_antenna[1]</b></td>
 </tr>
 </table>"
;

echo "
 <table width=600 cellspacing=0 cellpadding=0)>
 <tr><td valign=middle width=600 height=400>"
;

if (($status == "Z") || ($status == "F"))
 {
 echo "
 <br><br><br><br><br><br><br><br><br><br><br><br>
 <b>There is no image to display.</b><p>
 The GPS is not connected and the GSM location can not be found in the database.<p>
 Please check back later."
;}
else
 {echo "<div id=\"map\" style=\"width: 596px; height: 400px\"></div>";}

echo "
 </td></tr>
</table>"
;

echo "
 <table width=600 cellspacing=2 cellpadding=2>
 <tr align=center>
 <td colspan=2><b>GSM Information</b></td>
 <td colspan=2><b>GPS Information</b></td>
 </tr><tr align=left>
 <td>Network</td><td>$nwname</td>
 <td width=150>Status</td><td width=150>$status</td>
 </tr><tr align=left>
 <td width=150>Cell ID</td><td width=150>$cell</td>
 <td>Latitude</td><td>$latitude deg</td>
 </tr><tr align=left>
 <td>LAC</td><td>$lac</td>
 <td>Longitude</td><td>$longitude deg</td>
 </tr><tr align=left>
 <td>MCC</td><td>$mcc</td>
 <td>Speed</td><td>$speed km/h</td>
 </tr><tr align=left>
 <td>MNC</td><td>$mnc</td>
 <td>Course</td><td>$course deg</td>
 </tr>"
;

//Display history line if set in config.php
if (($ghistory) &amp;&amp; ($gnwlink)) {
 echo "<tr align=center>
 <td colspan=2>
 <a href=\""
.$gearthfile."\"><b>Show in Google Earth history (".$gearthperiod.")</b></a>
 </td>
 <td colspan=2>
 <a href=\""
.$gnwlinkfile."\"><b>Show in Google Earth current position</b></a>
 </td>
 </tr>"
;
}
if (($ghistory) &amp;&amp; (!$gnwlink)) {
 echo "<tr align=center>
 <td colspan=4>
 <a href=\""
.$gearthfile."\">
 <b>Show in Google Earth the history ("
.$gearthperiod."), you need Google Earth installed)</b>
 </a>
 </td>
 </tr>"
;
}
if ((!$ghistory) &amp;&amp; ($gnwlink)) {
 echo "<tr align=center>
 <td colspan=4>
 <a href=\""
.$gnwlinkfile."\">
 <b>Show in Google Earth current position (you need Google Earth installed)</b>
 </a>
 </td>
 </tr>"
;
}

//Display the rest
echo "
 </table>

 <br>
 <font size=2><b>
 <a href=\"http://www.eppenga.com/gsm-gps-tracking.html\" target=_top>More information,</a>
 <a href=\"http://www.eppenga.com/gsm-gps-tracking/equipment.html\" target=_top>setup</a> and
 <a href=\"http://sourceforge.net/projects/gg-tracker/\" target=_top>download</a>
 <a href=\"http://www.eppenga.com/gsm-gps-tracking/explanation.html\" target=_top>GG-Tracker application</a>
 </b></font>
 </a>
 <br>
 <a href=\"http://www.eppenga.com/about/contact.html\">
 <font size=1 color=black><i>GG-Tracker is an open-source development project by Ebo Eppenga</i></font>
 </a>

 </center>\r\n\r\n"
;

/* Include simple counter */
echo "<img src=\"http://teller.eppenga.com/ggtracker/counter.gif&amp;url="
 .$_SERVER['SERVER_NAME']."&amp;path=".$_SERVER['PHP_SELF']."\" border=0 width=1 height=1>";

/* Include footer */
include ("footer.php");

echo "    </body>\r\n";
echo "</html>";


/* Close and free everything */

// Free resultset
mysqli_free_result($result);

/* Close connection */
mysqli_close($link);

?>

&amp;nbsp;

 

GG-Tracker GPS and GSM Tracking

GG-Tracker tracks your mobile using GSM Cell-location in combination with GPS. It uses both GPS and GSM networks to get a position. If only GSM is available it relies on location previously stored using a GPS receiver. The position is displayed on the internet using a Google Maps integration. The operation is very simular to how Google Maps ‘My location’ works, only this time you are in control. If a GPS receiver is connected it does two things, it stores the current position and the GSM cell the phone is connected to. If the GPS is not connected anymore it checks the database for previously known coordinates of the GSM cells. When it was connected to GPS the program stored the GSM cells, so all it does, is look back and see if there is a proper fit. If it finds a fit, it reports that as a position, meaning that GPS is not necessary anymore for positioning.

 

 

<?php
//**********************************************************************************************
//**********************************************************************************************
//***** GG-Tracker is based on Aspicore GSM Tracker.                                       *****
//*****                                                                                    *****
//***** It's in a development phase and no warranties are given for anything. This program *****
//***** may not function the way you expect it and the author is not responsible for       *****
//***** anything. However, I hope you enjoy it and ammend it where possible!               *****
//*****                                                                                    *****
//***** An example of GG-Tracker is live at http://gg-tracker.eppenga.com                     *****
//**********************************************************************************************
//**********************************************************************************************

//**********************************************************************************************
//*****                                      PROGRAM                                      ******
//**********************************************************************************************

header("Expires: 0");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Content-Type: text/html; charset=ISO-8859-1");
header('Content-Disposition: inline; filename="response.html"');
?>

<?php
/* Include settings */
include ("config.php");
include ("config_check.php");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
 <style type="text/css">
 <!--
 td { font-family: verdana,arial,helvetica,sans-serif; font-size: 7pt;
 border: 1px solid black;
 vertical-align: baseline }
 th { font-family: verdana,arial,helvetica,sans-serif; font-size: 8pt; font-weight: bold;
 border: 1px solid black;
 border-style: solid; border-width: 1px;
 vertical-align: baseline }
 td.small { font-family: verdana,arial,helvetica,sans-serif; font-size: 6pt }
 body         { font-family: verdana,arial,helvetica,sans-serif; font-size: 8pt }
 base         { font-family: Courier,MONOSPACE; font-size: 10pt }
 table        { border-collapse: collapse; border: solid thin black }
 A:link         { color: black; text-decoration: underline }
 A:visited      { color: black; text-decoration: underline }
 A:active      { color: black; text-decoration: underline }
 A:hover      { color: black; text-decoration: none }
 caption      { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold }
 -->
 </style>
 <?php if ($rss) { ?>
 <link rel="alternate" type="application/rss+xml" title="GG-Tracker RSS Feed" href="<?php echo $rssfile; ?>" />
 <?php } ?>
 <meta http-equiv="refresh" content="60;URL=." />
 <title>GG-Tracker (GSM and GPS location combined)</title>
<?php

/* Open and check connection */
$link = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if (!$link) {
 printf("Connect failed: %s\n", mysqli_connect_error());
 exit();
}

/* Calculate history and produce XML files for Google Earth */
if ($ghistory) include ("calc_gearth.php");

/* Get the last known position with full details of the tracked phone */

$query = 'SELECT GPSMSGID, PHONE, STATUS, LATITUDE, LONGITUDE, SPEED_KNOTS, COURSE_DEG, TIME_RECEIVED, EVENT_TYPE, CELL_ID, LAC, MCC, MNC, NWNAME, LABEL, REMOTE_IP '
 . 'FROM GPS ORDER BY GPSMSGID DESC LIMIT 1';
$result = mysqli_query($link, $query);

if (!$result) {
 printf("Query failed: %s\r\n", mysqli_error($link));
 printf("Tried to execute the following SQL query:\r\n");
 printf("%s\r\n", $query );
 mysqli_close($link);
 exit();}

$row_cnt = mysqli_num_rows($result);
if ($row_cnt == 0) {
 printf("No data, connect Aspicore tracker first.\r\n");
 exit();
 }
else {
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $id = $line['GPSMSGID'];
 $phone = $line['PHONE'];
 $status = $line['STATUS'];
 $latitude = $line['LATITUDE'];
 $longitude = $line['LONGITUDE'];
 $speed = round($line['SPEED_KNOTS']*1.852,2);
 $course = $line['COURSE_DEG'];
 $rtime = strtotime($line['TIME_RECEIVED']) + $t_offset*3600;
 $rtime = date('Y-m-d H:i:m', $rtime);
 $nwname = $line['NWNAME'];
 $cell = $line['CELL_ID'];
 $lac = $line['LAC'];
 $mcc = $line['MCC'];
 $mnc = $line['MNC'];
 $mode = $line['EVENT_TYPE'];
 $label = $line['LABEL'];
 $ipaddress = $line['REMOTE_IP'];
}

/* Get the last two good positions for a tail */
$query = 'SELECT LATITUDE, LONGITUDE '
 . 'FROM GPS WHERE STATUS IN (\'A\', \'B\',\'X\',\'C\',\'T\',\'R\') '
 . 'ORDER BY GPSMSGID DESC LIMIT 1,3';
$result = mysqli_query($link, $query);

$row_cnt = mysqli_num_rows($result);

if ($row_cnt == 3) {
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $lat_1 = $line['LATITUDE'];
 $lon_1 = $line['LONGITUDE'];
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $lat_2 = $line['LATITUDE'];
 $lon_2 = $line['LONGITUDE'];
 $line = mysqli_fetch_array($result, MYSQLI_ASSOC);
 $lat_3 = $line['LATITUDE'];
 $lon_3 = $line['LONGITUDE'];
}
else
{
 $lat_1 = $latitude;
 $lat_2 = $latitude;
 $lat_3 = $latitude;
 $lon_1 = $longitude;
 $lon_2 = $longitude;
 $lon_3 = $longitude;
}


//Google maps script, only execute if there are positions found
if ($status <> "Z" &amp;&amp; $status <> "F") {
 echo "
 <script src=\"http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=$gmaps\"
 type=\"text/javascript\"></script>
 <script type=\"text/javascript\">

 //<![CDATA[
 function load() {
 if (GBrowserIsCompatible()) {
 var map = new GMap2(document.getElementById(\"map\"));
 map.setCenter(new GLatLng($latitude, $longitude), 14);
 map.addControl(new GSmallMapControl());
 map.addControl(new GMapTypeControl());
 var marker = new GMarker(new GLatLng($latitude, $longitude));
 map.addOverlay(marker);
 GEvent.addListener(marker, \"click\", function() {
 var html = '<div style=\"width: 250px; height: 50; padding-right: 10px\"><font size=2><b>Hello World!</b><br>This is my my current position. If you enjoy this application, please <br><a href=\"http://www.eppenga.com/gsm-gps-tracking.html\">read my webpage.<\/a><\/font><\/div>';
 marker.openInfoWindowHtml(html);
 });
 var polyline = new GPolyline([
 new GLatLng($lat_3, $lon_3),
 new GLatLng($lat_2, $lon_2),
 new GLatLng($lat_1, $lon_1),
 new GLatLng($latitude, $longitude)
 ], \"#ff0000\", 7);
 map.addOverlay(polyline);
 }
 }

 //]]>
 </script>
 "
;
}

//Get some statistical data
include ("calc_stats.php");

//The rest of the internet page
echo "
 </head>

 <body onload=\"load()\" onunload=\"GUnload()\">

 <center>
 <table width=600 cellspacing=2 cellpadding=2>
 <tr align=center>
 <td colspan=3>
 <font size=2 color=red><b>Welcome to GG-Tracker (GPS and GSM Tracking)</b></font>
 </td>
 </tr>
 <tr>
 <td><b>Location label: $label</b></td>
 <td><b>Report date: $rtime</b></td>
 <td><b>Cellphone IP-address: $ipaddress</b></td>
 </tr>
 <tr>
 <td><b>Topspeed today/ever: $maxspeed[1]/$maxspeed[0] km/h</b></td>
 <td><b>Distance to home: $disthome km</b></td>
 <td><b>GSM antenna (useful/total): $gsm_antenna[0]/$gsm_antenna[1]</b></td>
 </tr>
 </table>"
;

echo "
 <table width=600 cellspacing=0 cellpadding=0)>
 <tr><td valign=middle width=600 height=400>"
;

if (($status == "Z") || ($status == "F"))
 {
 echo "
 <br><br><br><br><br><br><br><br><br><br><br><br>
 <b>There is no image to display.</b><p>
 The GPS is not connected and the GSM location can not be found in the database.<p>
 Please check back later."
;}
else
 {echo "<div id=\"map\" style=\"width: 596px; height: 400px\"></div>";}

echo "
 </td></tr>
</table>"
;

echo "
 <table width=600 cellspacing=2 cellpadding=2>
 <tr align=center>
 <td colspan=2><b>GSM Information</b></td>
 <td colspan=2><b>GPS Information</b></td>
 </tr><tr align=left>
 <td>Network</td><td>$nwname</td>
 <td width=150>Status</td><td width=150>$status</td>
 </tr><tr align=left>
 <td width=150>Cell ID</td><td width=150>$cell</td>
 <td>Latitude</td><td>$latitude deg</td>
 </tr><tr align=left>
 <td>LAC</td><td>$lac</td>
 <td>Longitude</td><td>$longitude deg</td>
 </tr><tr align=left>
 <td>MCC</td><td>$mcc</td>
 <td>Speed</td><td>$speed km/h</td>
 </tr><tr align=left>
 <td>MNC</td><td>$mnc</td>
 <td>Course</td><td>$course deg</td>
 </tr>"
;

//Display history line if set in config.php
if (($ghistory) &amp;&amp; ($gnwlink)) {
 echo "<tr align=center>
 <td colspan=2>
 <a href=\""
.$gearthfile."\"><b>Show in Google Earth history (".$gearthperiod.")</b></a>
 </td>
 <td colspan=2>
 <a href=\""
.$gnwlinkfile."\"><b>Show in Google Earth current position</b></a>
 </td>
 </tr>"
;
}
if (($ghistory) &amp;&amp; (!$gnwlink)) {
 echo "<tr align=center>
 <td colspan=4>
 <a href=\""
.$gearthfile."\">
 <b>Show in Google Earth the history ("
.$gearthperiod."), you need Google Earth installed)</b>
 </a>
 </td>
 </tr>"
;
}
if ((!$ghistory) &amp;&amp; ($gnwlink)) {
 echo "<tr align=center>
 <td colspan=4>
 <a href=\""
.$gnwlinkfile."\">
 <b>Show in Google Earth current position (you need Google Earth installed)</b>
 </a>
 </td>
 </tr>"
;
}

//Display the rest
echo "
 </table>

 <br>
 <font size=2><b>
 <a href=\"http://www.eppenga.com/gsm-gps-tracking.html\" target=_top>More information,</a>
 <a href=\"http://www.eppenga.com/gsm-gps-tracking/equipment.html\" target=_top>setup</a> and
 <a href=\"http://sourceforge.net/projects/gg-tracker/\" target=_top>download</a>
 <a href=\"http://www.eppenga.com/gsm-gps-tracking/explanation.html\" target=_top>GG-Tracker application</a>
 </b></font>
 </a>
 <br>
 <a href=\"http://www.eppenga.com/about/contact.html\">
 <font size=1 color=black><i>GG-Tracker is an open-source development project by Ebo Eppenga</i></font>
 </a>

 </center>\r\n\r\n"
;

/* Include simple counter */
echo "<img src=\"http://teller.eppenga.com/ggtracker/counter.gif&amp;url="
 .$_SERVER['SERVER_NAME']."&amp;path=".$_SERVER['PHP_SELF']."\" border=0 width=1 height=1>";

/* Include footer */
include ("footer.php");

echo "    </body>\r\n";
echo "</html>";


/* Close and free everything */

// Free resultset
mysqli_free_result($result);

/* Close connection */
mysqli_close($link);

?>

&amp;nbsp;

PHP Small Reservation CMS with Miscellaneous

As the name says: Small Reservation CMS (based on PHP 5/MySqli) is made for small business and only for reservation purposes. One of the extras is a setup file, which allows you to choose your own individual adjustments: E.g. different periods of reservation, forbidden days, URL of web site, absolute path to XML files, max. places, days until automatic deletion of not confirmed reservations, naming the fields of the rent object showed on the homepage. Small Reservation CMS (a simple homepage is also part of the application) offers you several control features as picture upload, management of customers (incl. put into archives), overview, rent objects, articles, registrations, emailing among others.

 

 

<?php

/**
 *
 * Small Reservation CMS
 *
 * @author Claudio Biesele, <info@fastproject.ch>
 *
 * @copyright     FAST!project
 *                 Claudio Biesele
 *                Uberlandstrasse 99
 *                CH-8050 Zurich
 *                Phone +41 44 322 47 74
 *                Mobile +41 76 730 57 83
 *                www.fastproject.ch
 *                www.pimpmyhomepage.ch
 *                <info@fastproject.ch>
 *
 * Generated 10.03.2009
 *
 */


define('CLASS_FILENAME_SUFFIX', '.class.php');

function __autoload($className)
{
 $__autoloadAbsolutePath = dirname(__FILE__);

 // 'pathStart' is your web application root folder
 $pathStart = $__autoloadAbsolutePath .
 DIRECTORY_SEPARATOR;

 // 'PATH_SEPARATOR . $pathStart .'
 $classPath = PATH_SEPARATOR . $pathStart .  'classes' .
 DIRECTORY_SEPARATOR. PATH_SEPARATOR . $pathStart . 'classes/commands' .
 DIRECTORY_SEPARATOR. PATH_SEPARATOR . $pathStart . 'classes/contents' .
 DIRECTORY_SEPARATOR. PATH_SEPARATOR . $pathStart . 'classes/filters' .
 DIRECTORY_SEPARATOR;

 $oldIncludePath = get_include_path();
 set_include_path($oldIncludePath . $classPath);

 @require_once($className . CLASS_FILENAME_SUFFIX);

 // Reset to initial 'include_path'.
 set_include_path($oldIncludePath);
}

//error_reporting(E_ALL);

$checked1 = '';
$checked2 = '';
$checked3 = '';
$checked4 = '';
$checked5 = '';
$checked6 = '';
$checked7 = '';
$checked8 = '';
$checked9 = '';
$checked11 = '';
$checked13 = '';
$checked14 = '';
$checked16 = '';
$checked17 = '';
$checked18 = '';
$checked19 = '';
$checked20 = '';
$checked21 = '';
$checked22 = '';
$checked23 = '';

$selected0 = '';
$selected1 = '';
$selected2 = '';
$selected3 = '';
$selected4 = '';
$selected5 = '';

$getsetup         = new MainContent();
$id             = $getsetup->getSetupData();
$res             = $getsetup->getRescms();
$lang             = $getsetup->getLangcms();
$css             = $getsetup->getCsscms();
$forb            = $getsetup->getForcms();
$uri            = $getsetup->getUricms();
$mmname            = $getsetup->getMailname();
$mdomain        = $getsetup->getMaildomain();
$murl            = $getsetup->getMailurl();
$mdays             = $getsetup->getDayscms();
$mname             = $getsetup->getNamecms();
$mmarke            = $getsetup->getMarkecms();
$mweight        = $getsetup->getWeightcms();
$mpower            = $getsetup->getPowercms();
$mengine        = $getsetup->getEnginecms();
$mprice            = $getsetup->getPricecms();
$mfirma            = $getsetup->getFirmacms();
$mkeywords        = $getsetup->getMetakeycms();
$mdescription     = $getsetup->getMetadescrcms();
$mseats             = $getsetup->getSeatscms();
$mfolder        = $getsetup->getFoldercms();

switch ($res) {
 case 'to':
 $checked1 = 'checked="checked"';
 break;
 case 'tr':
 $checked2 = 'checked="checked"';
 break;
 case 'fo':
 $checked3 = 'checked="checked"';
 break;
 case 'fi':
 $checked4 = 'checked="checked"';
 break;
 case 'si':
 $checked5 = 'checked="checked"';
 break;
 case 'ei':
 $checked6 = 'checked="checked"';
 break;
 case 'ni':
 $checked7 = 'checked="checked"';
 break;
}
switch ($forb) {
 case 'mo':
 $checked8 = 'checked="checked"';
 break;
 case 'di':
 $checked9 = 'checked="checked"';
 break;
 case 'mi':
 $checked10 = 'checked="checked"';
 break;
 case 'do':
 $checked11 = 'checked="checked"';
 break;
 case 'fr':
 $checked12 = 'checked="checked"';
 break;
 case 'sa':
 $checked13 = 'checked="checked"';
 break;
 case 'su':
 $checked14 = 'checked="checked"';
 break;
 case 'ss':
 $checked15 = 'checked="checked"';
 break;
 case 'sm':
 $checked16 = 'checked="checked"';
 break;
}
switch ($lang) {
 case 'de':
 $checked17 = 'checked="checked"';
 break;
 case 'en':
 $checked18 = 'checked="checked"';
 break;
}
switch ($css) {
 case 'bl':
 $checked19 = 'checked="checked"';
 break;
 case 'or':
 $checked20 = 'checked="checked"';
 break;
 case 'go':
 $checked21 = 'checked="checked"';
 break;
}
switch ($mdays) {
 case '':
 $selected0 = 'selected="selected"';
 break;
 case '0':
 $selected1 = 'selected="selected"';
 break;
 case '1':
 $selected2 = 'selected="selected"';
 break;
 case '7':
 $selected3 = 'selected="selected"';
 break;
 case '14':
 $selected4 = 'selected="selected"';
 break;
 case '30':
 $selected5 = 'selected="selected"';
 break;
}
switch ($mfolder) {
 case '0':
 $checked22 = 'checked="checked"';
 break;
 case '1':
 $checked23 = 'checked="checked"';
 break;
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

 <head>
 <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
 <meta name="generator" content="Adobe GoLive 6">
 <title>Setup Datei / Small Reservation CMS</title>
 <script type="text/javascript" src="scripts/de_smallcms.js"></script>
 <link href="css/bl_back.css" rel="stylesheet" media="screen" type="text/css">
 </head>

 <body>
 <p><a href="index.html"><span>zur&amp;uuml;ck</span></a></p>
 <div id="workform"><form action="setupcms_de.php" method="post" name="FormSetupCMS" onsubmit="return validSetupForm();">
 <table width="600" border="0" cellspacing="2" cellpadding="0">
 <tr>
 <td colspan="2"><b>&amp;nbsp;Auswahl Setup-Optionen</b></td>
 </tr>
 <tr>
 <td rowspan="7" valign="top"><i>Reservations-Art setzen</i></td>
 <td><input type="radio" name="rescms" value="to" tabindex="1" <?php echo $checked1; ?> />&amp;nbsp;8-12/14-18 Uhr</td>
 </tr>
 <tr>
 <td><input type="radio" name="rescms" value="tr" tabindex="2" <?php echo $checked2; ?> />&amp;nbsp;9-12/12-15/15-18 Uhr</td>
 </tr>
 <tr>
 <td><input type="radio" name="rescms" value="fo" tabindex="3"  <?php echo $checked3; ?> />&amp;nbsp;8-10/10-12/14-16/16-18 Uhr</td>
 </tr>
 <tr>
 <td><input type="radio" name="rescms" value="fi" tabindex="4" <?php echo $checked4; ?> />&amp;nbsp;8-10/10-12/12-14/14-16/16-18 Uhr</td>
 </tr>
 <tr>
 <td><input type="radio" name="rescms" value="si" tabindex="5" <?php echo $checked5; ?> />&amp;nbsp;9-10/10-11/11-12/14-15/15-16/16-17 Uhr</td>
 </tr>
 <tr>
 <td><input type="radio" name="rescms" value="ei" tabindex="6" <?php echo $checked6; ?> />&amp;nbsp;8-9/9-10/10-11/11-12/13-14/14-15/15-16/16-17 Uhr</td>
 </tr>
 <tr>
 <td style="white-space:nowrap;"><input type="radio" name="rescms" value="ni" tabindex="7" <?php echo $checked7; ?> />&amp;nbsp;8-9/9-10/10-11/11-12/12-13/13-14/14-15/15-16/16-17 Uhr</td>
 </tr>
 <tr>
 <td rowspan="9" valign="top"><i>Gesperrte Tage setzen</i></td>
 <td><input type="radio" name="forcms" value="mo" tabindex="8" <?php echo $checked8; ?> />&amp;nbsp;Montag</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="di" tabindex="9" <?php echo $checked9; ?> />&amp;nbsp;Dienstag</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="mi" tabindex="10" <?php echo $checked10; ?> />&amp;nbsp;Mittwoch</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="do" tabindex="11" <?php echo $checked11; ?> />&amp;nbsp;Donnerstag</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="fr" tabindex="12" <?php echo $checked12; ?> />&amp;nbsp;Freitag</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="sa" tabindex="13" <?php echo $checked13; ?> />&amp;nbsp;Samstag</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="su" tabindex="14" <?php echo $checked14; ?> />&amp;nbsp;Sonntag</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="ss" tabindex="15" <?php echo $checked15; ?> />&amp;nbsp;Samstag/Sonntag</td>
 </tr>
 <tr>
 <td><input type="radio" name="forcms" value="sm" tabindex="16" <?php echo $checked16; ?> />&amp;nbsp;Sonntag/Montag</td>
 </tr>
 <tr>
 <td rowspan="2" valign="top"><i>Sprache setzen</i></td>
 <td><input type="radio" name="langcms" value="de" tabindex="17" <?php echo $checked17; ?> />&amp;nbsp;Deutsch</td>
 </tr>
 <tr>
 <td><input type="radio" name="langcms" value="en" tabindex="18" <?php echo $checked18; ?> />&amp;nbsp;Englisch</td>
 </tr>
 <tr>
 <td rowspan="3" valign="top"><i>Farbgebung setzen</i></td>
 <td><input type="radio" name="csscms" value="bl" tabindex="19" <?php echo $checked19; ?> />&amp;nbsp;DarkSlateBlue/Lavender/Red</td>
 </tr>
 <tr>
 <td><input type="radio" name="csscms" value="or" tabindex="20" <?php echo $checked20; ?> />&amp;nbsp;DarkOrange/WhiteSmoke/Black</td>
 </tr>
 <tr>
 <td><input type="radio" name="csscms" value="go" tabindex="21" <?php echo $checked21; ?> />&amp;nbsp;Gold/DimGray/White</td>
 </tr>
 <tr>
 <td valign="top"><i>Absoluter Pfad zur Dokumenten-Wurzel setzen</i> (verbindet XML-Dateien f&amp;uuml;r DropDowns)</td>
 <td><input type="text" name="uritxt" value="<?php echo $uri; ?>" tabindex="22" size="45" /><br/>
 (z.B. C:/Programme/xampp/htdocs)</td>
 </tr>
 <tr>
 <td rowspan="2" valign="top"><i>Ordner f&amp;uuml;r die Website setzen</i> (f&amp;uuml;r R&amp;uuml;ckmelde-Link bei der Best&amp;auml;tigung der Kunden-Anmeldung)</td>
 <td><input type="radio" name="cmsfolder" value="0" tabindex="23" <?php echo $checked22; ?> />&amp;nbsp;Hauptordner (www.xxx.xx)</td>
 </tr>
 <tr>
 <td><input type="radio" name="cmsfolder" value="1" tabindex="24" <?php echo $checked23; ?> />&amp;nbsp;Unterordner (www.xxx.xx/smallcms)</td>
 </tr>
 <tr>
 <td valign="top"><i>Email-Name setzen</i> (f&amp;uuml;r Returns und BCC beim Email-Versand)</td>
 <td><input type="text" name="cmsmailname" size="24" value="<?php echo $mmname; ?>" tabindex="25" />@</td>
 </tr>
 <tr>
 <td valign="top"><i>Email-Domain setzen</i> (f&amp;uuml;r Returns und BCC beim Email-Versand)</td>
 <td><input type="text" name="cmsmaildomain" size="24" value="<?php echo $mdomain; ?>" tabindex="26" /></td>
 </tr>
 <tr>
 <td valign="top"><i>URL (ohne http://) setzen</i> (gibt den Ursprung von versendeten Emails an und setzt URLs zur Best&amp;auml;tigung der Anmeldung)</td>
 <td><input type="text" name="cmsurl" size="24" value="<?php echo $murl; ?>" tabindex="27" /></td>
 </tr>
 <tr>
 <td valign="top"><i>Firmen-Name oder persönlichen Namen setzen</i> (wird auf der Homepage oder der Email angezeigt)</td>
 <td><input type="text" name="cmsfirma" size="24" value="<?php echo $mfirma; ?>" tabindex="28" /></td>
 </tr>
 <tr>
 <td valign="top"><i>Keywords setzen</i> (f&amp;uuml;r Suchmaschinen)</td>
 <td><textarea name="cmsmetakey" rows="4" cols="40" tabindex="29"><?php echo $mkeywords; ?></textarea></td>
 </tr>
 <tr>
 <td valign="top"><i>Description setzen</i> (f&amp;uuml;r Suchmaschinen)</td>
 <td><textarea name="cmsmetadescr" rows="4" cols="40" tabindex="30"><?php echo $mdescription; ?></textarea></td>
 </tr>
 <tr>
 <td valign="top"><i>Frist setzen</i> (nach der nicht angemeldete Kunden-Reservationen automatisch gel&amp;ouml;scht werden sollen)</td>
 <td><select name="cmsdays" size="1" tabindex="31">
 <option value="----" <?php echo $selected0; ?>>----</option>
 <option value="0" <?php echo $selected1; ?>>nie</option>
 <option value="1" <?php echo $selected2; ?>>1 Tag</option>
 <option value="7" <?php echo $selected3; ?>>7 Tage</option>
 <option value="14" <?php echo $selected4; ?>>14 Tage</option>
 <option value="30" <?php echo $selected5; ?>>30 Tage</option>
 </select>
 </td>
 </tr>
 <tr>
 <td valign="top"><i>Maximale Anzahl der Sitze setzen</i> (wird in der Administration den Mietobjekten zugeteilt)</td>
 <td><input type="text" name="cmsseats" size="2" maxlength="2" tabindex="32" value="<?php echo $mseats; ?>" /></td>
 </tr>
 <tr>
 <td rowspan="6" valign="top"><i>Feldnamen f&amp;uuml;r Mietobjekt setzen</i> (50 Zeichen max)</td>
 <td style="white-space:nowrap;">Name 1:&amp;nbsp;<input type="text" name="cmsname" tabindex="33" value="<?php echo $mname; ?>" size="24" />&amp;nbsp;z.B. Mietobjekt-Name</td>
 </tr>
 <tr>
 <td style="white-space:nowrap;">Name 2:&amp;nbsp;<input type="text" name="cmsmarke" tabindex="34" value="<?php echo $mmarke; ?>" size="24" />&amp;nbsp;z.B. Mietobjekt-Marke</td>
 </tr>
 <tr>
 <td style="white-space:nowrap;">Name 3:&amp;nbsp;<input type="text" name="cmsweight" tabindex="35" value="<?php echo $mweight; ?>" size="24" />&amp;nbsp;z.B. Mietobjekt-Gewicht/kg</td>
 </tr>
 <tr>
 <td style="white-space:nowrap;">Name 4:&amp;nbsp;<input type="text" name="cmspower" tabindex="36" value="<?php echo $mpower; ?>" size="24" />&amp;nbsp;z.B. Mietobjekt-Leistung/PS</td>
 </tr>
 <tr>
 <td style="white-space:nowrap;">Name 5:&amp;nbsp;<input type="text" name="cmsengine" tabindex="37" value="<?php echo $mengine; ?>" size="24" />&amp;nbsp;z.B. Mietobjekt-Platzangebot</td>
 </tr>
 <tr>
 <td style="white-space:nowrap;">Name 6:&amp;nbsp;<input type="text" name="cmsprice" tabindex="38" value="<?php echo $mprice; ?>" size="24" />&amp;nbsp;z.B. Mietobjekt-Preis (W&amp;auml;hrung)</td>
 </tr>
 <tr>
 <td><input type="reset" value="Reset Setup" tabindex="39" onclick="return resetForm();" /><input type="hidden" name="setuplang" value="de" /><input type="hidden" name="id" value="<?php echo $id; ?>" /><input type="hidden" name="pageid" value="32" /><input type="hidden" name="subcmd" value="" /><input type="hidden" name="cmd" value="setupcms" /></td>
 <td><input type="submit" name="submitSetupCMS" value="Setup eintragen" tabindex="40" /></td>
 </tr>
 </table>
 <br/><span id="adminmess"></span>
 </form>
 </div>
 </body>
</html>

&amp;nbsp;

404 Catcher PHP Script for Miscellaneous

404 Catcher is a free php script will alert you via email if someone encounters a 404 page missing error on your web site. This easy to install script can be a very useful tool on sites where digging through analytics is not a daily event or when major site updates are being made and you are redirecting old pages to new….

 

 

<?php
##########################################################
#                     404 Catcher                        #
##########################################################
#                                                        #
# This script is copyright 2009 SEO-Shop.com             #
#                                                        #
# You are granted full rights to use this script on any  #
# site you own. However, redistribution of this script   #
# REQUIRES that this copyright notice remain in place.   #
#                                                        #
# HOW TO USE THIS SCRIPT:                                #
# Create or edit .htaccess file in the document root     #
# on your web server. Insert the following line:         #
# ErrorDocument 404 404info.php                          #
##########################################################


#########################################################
# Set these variables to configure the script           #
#########################################################

# Set $docroot to the URL of the directory which contains your
# .htaccess file. Don't include trailing slash.

$docroot = "http://www.seo-shop.com";

# Set $domain to your websites domain name (no www)

$domain = "seoshop.com";

# Set $template to the full SERVER path to the HTML file that
# you want to use as a template. If you don't set this, the
# script will use its default built-in template. If you create
# your own template, place the token %OUTPUT% where you want
# the output to appear.

$template = "";

# This script is capable of mailing the details of each 404 error
# to the webmaster. Use the $reportlevel variable to control when
# you receive these reports.
#
# 0 = don't use the email capabilities, just display the page
# 1 = send email only if the error's referer contains your domain name
#     (i.e. the 404 was generated by a broken link on your site)
# 2 = send email any time a 404 error is generated (useful for tracking
#     broken links at other sites which link to you)

$reportlevel = 2;

# Set $emailaddress to the email address of whoever should be
# notified of 404 errors. Don't escape the @ symbol.
# You can leave this unassigned if you're not using email features.

$emailaddress = "info@example.com";

#########################################################
# End of configuration variables                        #
#########################################################
header('Cache-Control: public');

function send_mail(){
 global $emailaddress, $docroot;
 $errortime = date("d M Y h:i:s");
 $message = "404 Error Report\n\nA 404 error was encountered by $_SERVER[REMOTE_ADDR]";
 $message .= " on $errortime.\n\n";
 $message .= "The URI which generated the error is: \n$docroot$_SERVER[REQUEST_URI]\n\n";
 $message .= "The referring page was:\n$_SERVER[HTTP_REFERER]\n\n";
 $headers = "From: $emailaddress\nDate: $errortime -0600\n";
 $subject = "404 Error: $docroot$_SERVER[REQUEST_URI]";
 mail($emailaddress, $subject, $message, $headers);
 return;
}

header("Status: 404 Not Found");

$output = <<<EOT
<html>
<head> </head>
<body>
<h1>404 Not Found</h1>
 <p>
 <font face="Verdana, Helvetica, Arial" size="2">We are sorry. The page you requested, $docroot$_SERVER[REQUEST_URI], does not exist on this server. </font>
 </p>
 <p>
 <font face="Verdana, Helvetica, Arial" size="2">
 The details of this error have automatically been mailed to the $domain webmaster.<br />
 </font>
 </p>
 <p>
 <font face="Verdana, Helvetica, Arial" size="2">
 We should have this issue resolved shortly.<br />
 </font>
 </p>
 <p>
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 </p>
EOT
;

if($template){
 $template = implode("", file($template));
 $template = str_replace("%OUTPUT%", $output, $template);
 echo $template;
}
else{ echo $output; }

switch($reportlevel){
 case 0:
 break;
 case 1:
 if(eregi($domain, $_SERVER[HTTP_REFERER])){
 send_mail();
 }
 break;
 case 2:
 send_mail();
 break;
}

?>

PHP Scripts for myVirtualNotepad Miscellaneous

Ever felt like having a notepad where you could access wherever you are? Make a note at work and read it at your girlfriend’s house? You could email it to yourself, but that is not the same thing, not as simple. This notepad utility is the simplest possible notepad application you will find. Zero installation effort, zero fancy stuff. Just a large textfield. There are not even buttons on this thing. Just hit Ctrl-Enter to save the contents to a text file. Did I mention that you have to configure absolutely NOTHING? How cool is that?

 

 

<?php
 /*
 * # myVirtualNotepad 1.0, by Christian Dechery
 */


 // Edit the line below to set the timezone in which this app is running
 date_default_timezone_set("America/Sao_Paulo");

 $action = $_POST["action"];
 $contents = $_POST["contents"];

 if( $_GET["action"] == "dummy" ) {
 die("&amp;nbsp;");
 }

 if( $action == "update" ) {
 $arq = fopen("./notepad.txt", "w") or die("<div align=center><font face=Tahoma size=2 color=red>Error on updating notepad.txt, check file permissions.<h1>");
 if( strlen($contents)==0 ) {
 fwrite($arq, null, 0);
 } else {
 fwrite($arq, trim($contents) ) or die("<div align=center><font face=Tahoma size=2 color=red>Error on updating notepad.txt, check file permissions.<h1>");
 }

 fclose($arq);
 die("<div align=center><font face=Tahoma size=2>Last saved @ ".date("H:i:s")."</font>");
 }

 $arq = fopen("./notepad.txt", "r");

 // file not found, attempt to create one.
 if( $arq == FALSE ) {
 $arq = fopen("./notepad.txt", "w") or die("<font size=2 color=red face=Tahoma>Could not create notepad.txt file. Check folder/PHP permissions");
 $contents = "### Automatically generated file/contents. You're good to go. Enjoy! =) ###";
 fwrite($arq, $contents);
 } else {
 $contents = "";

 while( !feof($arq) ) {
 $contents .= fgets($arq, 4096);
 }
 }

 fclose($arq);
?>
<html>
 <head>
 <title>:: myVirtualNotepad :: </title>
<script language="Javascript">

 window.onbeforeunload  = onBeforeUnloadAction;

 function onBeforeUnloadAction() {
 return checkSaved();
 }

 var saved = true;
 var savedContent = '';

 function doUpdate(e) {
 var keynum;
 var keychar;

 if(window.event) { // IE
 keynum = e.keyCode;
 } else if(e.which) { // Netscape/Firefox/Opera
 keynum = e.which;
 }

 if( keynum == 13 &amp;&amp; e.ctrlKey ) { // Ctrl+Enter
 if( notepadFrm.contents.value.length == 0 ) {
 if( confirm('Are you sure you want to erase all the notepad contents?') ) {
 titleSaved();
 saved = true;
 savedContent = notepadFrm.contents.value;
 notepadFrm.submit();
 }
 } else {
 titleSaved();
 saved = true;
 savedContent = notepadFrm.contents.value;
 notepadFrm.submit();
 }
 }
 }

 function titleSaved() {
 document.title = ':: myVirtualNotepad ::';
 }

 function titleUnsaved() {
 document.title = ':: myVirtualNotepad* ::';
 }

 function doChange() {
 if( notepadFrm.contents.value != savedContent ) {
 saved = false;
 titleUnsaved();
 }

 return false;
 }

 function checkSaved() {
 if( !saved ) {
 return 'WARNING! There is unsaved content in the Notepad.';
 } else {
 return null;
 }
 }
</script>
 </head>
 <body bgcolor="#C0C0C0">
 <form method="post" name="notepadFrm" target="update">
 <input type="hidden" name="action" value="update">
 <p align="center"><font face="Tahoma" size=6>m y V i r t u a l N o t e p a d</font></p>
 <p align="center">
 <textarea rows="25" cols="100" onChange="return doChange()" onKeyDown="doUpdate(event)" name="contents" style="font-family: Verdana; padding: 5px; background-color: LightYellow">
<?php echo $contents ?></textarea><br>
 <font face="tahoma" size="2">Press Ctrl+Enter (inside the text field) to save</font>

 </p>
 </form>
 <div align="center">
 <iframe name="update" src="index.php?action=dummy" marginheight="0" marginwidth="0" height="20" width="400" frameborder="0">
 <p>Your browser does not support iframes. myVirtualNotepad won't work. =(</p>
 </iframe>
 </div>
 <p align="center><font face=Tahoma size=1>2010 - <a href=http://www.gnu.org/copyleft/>Copyleft</a>, no rights reserved. Author: <a href=mailto:christian@frofens.org>Christian Dechery</a>
 </body>
</html>

&amp;nbsp;

Scripts for Lazy Registry Class Miscellaneous

Managing globals with the registry pattern. This class provides lazy loading functionallity. This means it is possible to add a callback or class (with arguments) which will be called or instanciated when it is being used for the first time.

 

 

 

<?php
/**
 * LRegistry Class
 *
 * Managing globals with the registry pattern.
 * This class provides lazy loading functionallity. This means it is possible to
 * add a callback or class (with arguments) which will be called or instanciated
 * when it is being used for the first time.
 *
 * @version  1.0
 * @author   Victor Villaverde Laan
 * @link     http://www.freelancephp.net/php-lazy-registry-class/
 * @license  MIT license
 */

class LRegistry {

 /**
 * Singleton pattern
 * @var Registry object
 */

 private static $_instance = NULL;

 /**
 * Containing all entries
 * @var array
 */

 private $_entries = array();

 /**
 * Default overwrite entries when being set more than once
 * @var boolean
 */

 private $_default_overwrite = TRUE;

 /**
 * Private contructer for singleton protection
 */

 private final function __construct() {
 }

 /**
 * Private clone method for singleton protection
 */

 private final function __clone() {
 }

 /**
 * Get instance of this class
 * @return Registry object
 */

 public static function get_instance() {
 if ( self::$_instance === NULL )
 self::$_instance = new LRegistry;

 return self::$_instance;
 }

 /**
 * Get value of given key
 * @param string  $key
 * @param boolean $reload  reload if class or callback was already loaded
 * @return mixed
 */

 public static function get( $key, $reload = FALSE ) {
 $instance = self::get_instance();

 // check if entry exists
 if ( ! key_exists( $key, $instance->_entries ) )
 $instance->_exception( 'Key "' . $key . '" could not be found.' );

 // get current entry
 $entry = $instance->_entries[$key];

 // check if entry should be loaded or reloaded
 if ( ! $entry['loaded'] OR $reload ) {
 if ( $entry['type'] == 'class' ) {
 // get reflection class
 $ref_class = new ReflectionClass( $entry['class'] );
 // create instance
 $entry['value'] = $ref_class->newInstanceArgs( $entry['args'] );
 } else if ( $entry['type'] == 'callback' ) {
 // run callback and set return value
 $entry['value'] = call_user_func_array( $entry['callback'], $entry['args'] );
 } else {
 $instance->_exception( 'Type "' . $type . '" is not supported.' );
 }

 // set (new) value and change "loaded" setting
 $instance->_entries[$key]['value'] = $entry['value'];
 $instance->_entries[$key]['loaded'] = TRUE;
 }

 return $entry['value'];
 }

 /**
 * Set value of given key
 * @param string  $key
 * @param mixed   $value
 * @param boolean $overwrite  optional, when set will ignore the default overwrite setting
 * @return boolean  value was set succesfully
 */

 public static function set( $key, $value, $overwrite = NULL ) {
 // set normal value settings
 $settings = array( 'type' => 'value',
 'loaded' => TRUE,
 'value' => $value );

 return self::get_instance()->_set( $key, $settings, $overwrite );
 }

 /**
 * Set lazy entry of a class. Instance will only be created when entry
 * is requested using the get method.
 * @param string  $key
 * @param string  $class
 * @param array   $args
 * @param boolean $overwrite  optional, when set will ignore the default overwrite setting
 * @return boolean  value was set succesfully
 */

 public static function set_lazy_class( $key, $class, $args = array(), $overwrite = NULL ) {
 // set lazy class settings
 $settings = array( 'type' => 'class',
 'class' => $class,
 'args' => $args,
 'loaded' => FALSE,
 'value' => NULL );

 return self::get_instance()->_set( $key, $settings, $overwrite );
 }

 /**
 * Set lazy entry of a callback function.Function will only be called when entry
 * is requested using the get method.
 * @param string  $key
 * @param array   $callback
 * @param array   $args
 * @param boolean $overwrite  optional, when set will ignore the default overwrite setting
 * @return boolean  value was set succesfully
 */

 public static function set_lazy_callback( $key, $callback, $args = array(), $overwrite = NULL ) {
 // set lazy callback settings
 $settings = array( 'type' => 'callback',
 'callback' => $callback,
 'args' => $args,
 'loaded' => FALSE,
 'value' => NULL );

 return self::get_instance()->_set( $key, $settings, $overwrite );
 }

 /**
 * Check if given entry exists
 * @param string $key
 * @return boolean
 */

 public static function has( $key ) {
 return key_exists( $key, self::get_instance()->_entries );
 }

 /**
 * Check if given (lazy) entry is already loaded
 * @param string $key
 * @return boolean
 */

 public static function is_loaded( $key ) {
 return ( self::has( $key ) AND self::get_instance()->_entries[$key]['loaded'] === TRUE );
 }

 /**
 * Remove the given entry
 * @param string $key
 */

 public static function remove( $key ) {
 if ( ! self::has( $key ) )
 self::get_instance()->_exception( 'Key "' . $key . '"does not exist.' );

 unset( self::get_instance()->_entries[$key] );
 }

 /**
 * Set default overwriting entries when being set more than once.
 * @param boolean|NULL $overwrite  optional, if empty can be used as a getter
 * @return boolean
 */

 public static function default_overwrite( $overwrite = NULL ) {
 if ( $overwrite !== NULL )
 self::get_instance()->_default_overwrite = (bool) $overwrite;

 return self::get_instance()->_default_overwrite;
 }

 /**
 * Set value of given key (private use)
 * @param string  $key
 * @param mixed   $settings
 * @param boolean $overwrite  optional, when set will ignore the default overwrite setting
 * @return boolean  value was set succesfully
 */

 protected function _set( $key, $settings, $overwrite = NULL ) {
 $instance = self::get_instance();

 // check if overwriting is allowed
 $overwrite = ( $overwrite === NULL )
 ? $this->_default_overwrite
 : $overwrite;

 // check if entry exists and overwriting is allowed
 if ( key_exists( $key, $this->_entries ) AND ! $overwrite )
 return FALSE;

 $this->_entries[$key] = $settings;

 return TRUE;
 }

 /**
 * Throw an exception
 * @param string $message
 */

 protected function _exception( $message ) {
 throw new Exception( 'LRegistry: ' . $message );
 }

}

/*?> // ommit closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */

&amp;nbsp;

PHP Scripts for WPGet Miscellaneous

WPGet is a script which makes the process of including content from a WordPress 2.x powered blog in a non-WP powered page. It’s built in PHP and is 100% free software.

 

 

<?php
/*
 WPGet - retrieves WordPress posts from a database for display on a web pge
 Copyright (C) 2006-2010 Peter Upfold.

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.

 ======================================================================

 For more information:

 Email: peter@upfold.org.uk
 Web: http://peter.upfold.org.uk/projects/wpget

 VERSION: 1.0
 REVISION: $Rev: 20 $

*/


class wpGet {

// config


/********** START PASTING YOUR CONFIG HERE *********/
private $mysqluser = "username"; // your MySQL username for Wordpress
private $mysqlpass = "password"; // your MySQL password for Wordpress
private $mysqlhost = "localhost"; // your MySQL host
private $mysqldb = "wordpress"; // your MySQL database name for Wordpress
private $mysqlprefix="wp_"; // Wordpress table prefix - always include underscore at end if applicable
private $errorsto = false; // send error emails to whom?
// set the above to false if you don't want email error notifications

private $debugmode = false; // set to false when working on a real server so potential nasty people don't see MySQL errors

private $conn = false; // don't touch!


/********** STOP PASTING YOUR CONFIG HERE *********/


/****** PUBLIC VARIABLES (CAN BE CHANGED AT RUNTIME) *******/

public $dateformat = "Y-m-d H:i";
// date format for post date/time (the default above prints something like "17/10/2006 at 21:34" for October 17th)

// see http://www.php.net/date for details on the format

public $showcredit = true; // boolean
// controls whether the credit and link back to my site is shown (appreciated if you leave it on, but not compulsory)

public $categoriestoreturn = false;
// to return posts only from a particular category, turn this var
// into an array of the category names

// for example:
// var $categoriestoreturn = array();
// $categoriestoreturn[0] = "Category Name"

public $tagstoreturn = false;
// return posts only from certain tags. Works just like categoriestoreturn.
//Only use either categories or tags or neither, they do not work both at the same time currently.

public $daterange_start = false;
// Unix timestamp of the start of a daterange from which you would like to retrieve
// WordPress posts. Only posts within this var and daterange_end will be included
// in WPGet's output. Set to false to show posts regardless of date.

public $daterange_end = false;
// Unix timestamp of the end of a daterange from which you would like to retrieve
// WordPress posts. Only posts within daterange_start and this var will be included
// in WPGet's output. Set to false to show posts regardless of date.

public $searchtoreturn = false;
// Only return posts matching this search term. The post title and post content will
// be searched for this string. Only posts which match will be shown in WPGet's output.
// Leave as false to disable searching.

public $showauthor = true;
// show post author in WPGet's output

public $absoluteurldir = ".";
// if your wpget.php file is in a different directory
// to the file that will call it, specify the full web-accessible
// path (relative to the document root) of wpget.php

public $usestyle = false;
// use specified style for WPGet's output (or false for no style/custom)


/***** INTERNAL VARIABLES ONLY, DON'T CHANGE THEM *****/

private $categorylist = array();

private $catsearch = array();

private $taglist = array();

private $tagsearch = array();

private $qcount = 0;


/****** START OF CLASS FUNCTION DECLARATIONS *******/



// this function isn't mine - courtesy of mr at bbp dot biz (found at http://uk2.php.net/manual/en/function.substr.php#59719)

function html_substr($posttext, $minimum_length = 200, $length_offset = 20, $cut_words = FALSE, $dots = TRUE) {

 // $minimum_length:
 // The approximate length you want the concatenated text to be


 // $length_offset:
 // The variation in how long the text can be in this example text
 // length will be between 200 and 200-20=180 characters and the
 // character where the last tag ends

 // Reset tag counter &amp; quote checker
 $tag_counter = 0;
 $quotes_on = FALSE;
 // Check if the text is too long
 if (strlen($posttext) > $minimum_length) {
 // Reset the tag_counter and pass through (part of) the entire text
 $c = 0;
 for ($i = 0; $i < strlen($posttext); $i++) {
 // Load the current character and the next one
 // if the string has not arrived at the last character
 $current_char = substr($posttext,$i,1);
 if ($i < strlen($posttext) - 1) {
 $next_char = substr($posttext,$i + 1,1);
 }
 else {
 $next_char = "";
 }
 // First check if quotes are on
 if (!$quotes_on) {
 // Check if it's a tag
 // On a "<" add 3 if it's an opening tag (like <a href...)
 // or add only 1 if it's an ending tag (like </a>)
 if ($current_char == '<') {
 if ($next_char == '/') {
 $tag_counter += 1;
 }
 else {
 $tag_counter += 3;
 }
 }
 // Slash signifies an ending (like </a> or ... />)
 // substract 2
 if ($current_char == '/' &amp;&amp; $tag_counter <> 0) $tag_counter -= 2;
 // On a ">" substract 1
 if ($current_char == '>') $tag_counter -= 1;
 // If quotes are encountered, start ignoring the tags
 // (for directory slashes)
 if ($current_char == '"') $quotes_on = TRUE;
 }
 else {
 // IF quotes are encountered again, turn it back off
 if ($current_char == '"') $quotes_on = FALSE;
 }

 // Count only the chars outside html tags
 if($tag_counter == 2 || $tag_counter == 0){
 $c++;
 }

 // Check if the counter has reached the minimum length yet,
 // then wait for the tag_counter to become 0, and chop the string there
 if ($c > $minimum_length - $length_offset &amp;&amp; $tag_counter == 0 &amp;&amp; ($next_char == ' ' || $cut_words == TRUE)) {
 $posttext = substr($posttext,0,$i + 1);
 if($dots){
 $posttext .= '...';
 }
 return $posttext;
 }
 }
 }
 return $posttext;
}




function connectToDB() {

 if (!$this->conn)
 {

 // connects to the database and selects the right db ready for action
 $this->conn = mysql_connect($this->mysqlhost, $this->mysqluser, $this->mysqlpass) or die($this->friendlyError(mysql_error(), "{Connect}"));

 mysql_select_db($this->mysqldb) or die ($this->friendlyError(mysql_error(), "{Select DB}"));

 }

} // end connectToDB()

function friendlyError($error, $query, $line = false, $file = false) {
 // gives a friendly error should anything go wrong
 echo "<h1>Error Loading This Page</h1><p>Please contact the site administrator and let them know that there is a configuration issue with WPGet.</p>";


 if ($this->debugmode) {

 echo "<p>MySQL said: <b>".$error."</b>.</p><p>It was running the following query: <b>".$query."</b>.</p><p>The query was called on line <b>".$line."</b> by file <b>".$file."</b>.";

 }

 // mail you telling you error details
 else if ($this->errorsto != false) {

 $mail = "Hey there,<br /><br />There was a database problem with the WPGet script on your site running on <b>".$_SERVER['HTTP_HOST']."</b>.<br /><br />
 A user tried to view the page <b>"
.$_SERVER['REQUEST_URI']."</b> <i>(".$_SERVER['SCRIPT_FILENAME'].")</i>. Something went wrong with the database.
 <br /><br />MySQL said:<b> "
.$error."</b><br /><br />Query:<b> ".$query."</b>. Called on line <b>".$line."</b> by file <b>".$file."</b>.<br /><br />Have a nice day!";

 if (error_log($mail, 1, $errorsto, "From: wpget@".$_SERVER['SERVER_NAME']."\nContent-type: text/html\n")) {
 echo '<p>The site administrator has been notified of this error and should fix it soon.</p>';
 }
 else {
 echo '<p>There was a problem automatically notifying the site administrator. Please contact the person who manages this site and tell them there is a problem with WPGet.</p>';
 }

 }


}// end friendlyError()

function query($sql, $line, $file) {

 // wrapper function for all SQL queries (new as of 0.7), including new error handling
 // and supression of PHP's errors

 if (!$conn) {

 $this->connectToDB();

 }

 $result = @mysql_query($sql, $this->conn) or die ($this->friendlyError(mysql_error(), $sql, $line, $file));

 $this->qcount++;

 return $result;

} // end query()

function crash() {

 // crash function

 $this->query("hfduhf", __LINE__, __FILE__);

} // end crash()

function convert_smart_quotes($string) // not mine either - thanks to Chris Shiflett at http://shiflett.org/archive/165
{
 $search = array(chr(145),
 chr(146),
 chr(147),
 chr(148),
 chr(151));

 $replace = array('&amp;lsquo;',
 '&amp;rsquo;',
 '&amp;ldquo;',
 '&amp;rdquo;',
 '&amp;mdash;');


 return str_replace($search, $replace, $string);
}

function formatWPContent($wpdata, $chars, $stripimages, $stripembed, $stripscript, $striplinks) {

 if ($chars > 0) {
 $content = stripslashes($this->html_substr($wpdata['post_content'], $chars, 20));
 $content = $this->convert_smart_quotes($content);
 }
 else {
 $content = $wpdata['post_content'];
 $content = $this->convert_smart_quotes($content);
 }

 // strip images from posts
 if ($stripimages) {
 $content = preg_replace('#</?img[^>]*>#is', '<!--img-->', $content);
 }

 if ($stripembed) {
 // strip embeds from posts
 $content = preg_replace('#</?embed[^>]*>(.+</embed[^>]*>|)#is', '<!--embed-->', $content);
 }

 if ($stripscript) {
 // strip javascript from posts
 $content = preg_replace('#</?script[^>]*>(.+</script[^>]*>|)#is', '<!--script-->', $content);
 }

 if ($striplinks) {
 // strip any links (or other <a> tagged content) from posts
 $content = preg_replace('#</?a[^>]*>#is', '<!--link-->', $content);
 $content = preg_replace('#</?\/a[^>]*>#is', '<!--endlink-->', $content);
 }

 ?><div><?php

 echo '<h2><a href="'.$wpdata['guid'].'">'.$wpdata['post_title'].'</a></h2>'.nl2br($content).'<br /><br /><p>Posted on '.date($this->dateformat, strtotime($wpdata['post_date']));

 if ($this->showauthor)

 echo ' by '.$wpdata['display_name']; // print author name

 echo '.<br />'.$wpdata['comment_count'];


 if ($wpdata['comment_count'] > 0) {
 $jump = "#comments";
 }
 else {
 $jump = "#respond";
 }
 if ($wpdata['comment_count'] == 1) {
 $comment = "comment";
 }
 else {
 $comment = "comments";
 }

 echo ' <a href="'.$wpdata['guid'].$jump.'">'.$comment.'</a>.</p>';

 ?></div><?php

} // end formatWPContent()

function populateCategoryList() {

 // now only compatible with 2.3/2.5.x series or higher.
 // Support for < 2.2 is now dropped.

 // this function populates an array of the available categories
 // and their associated IDs so we can pull only relevant posts

 $this->connectToDB();

 $sql = "SELECT wpg_taxon.`term_taxonomy_id`, `name`, `slug`
 FROM `"
.$this->mysqlprefix."terms` AS wpg_terms
 INNER JOIN `"
.$this->mysqlprefix."term_taxonomy` AS wpg_taxon ON wpg_terms.`term_id` = wpg_taxon.`term_id`
 WHERE wpg_taxon.`taxonomy` = 'category';"
;
 $q = $this->query($sql, __LINE__, __FILE__);



 while ($ar = mysql_fetch_array($q, MYSQL_ASSOC)) {

 $this->categorylist[$ar['term_taxonomy_id']] = $ar['slug'];


 } // end while


 // now we want to create an array of the category IDs we are looking for

 /* so iterate through all the categories we've been given and
 match them to the numeric category IDs in the category list we
 just created */


 $i = 0;
 // an array counter for us

 foreach ($this->categoriestoreturn as $cat) {

 $srch = array_search($cat, $this->categorylist);

 if ($srch === false) { // treble equals to check if it is bool false and not just zero

 // category not found, throw an error and halt execution
 die("The category ".$cat." was not found, WPGet cannot get the posts!");

 }

 else {

 $this->catsearch[$i] = $srch;
 // set the list of categories to search to the ID of the current category

 $i++;
 // increment the counter

 }

 } // end foreach



} // end populateCategoryList()

function populateTagList() {

 // pull posts from a set of tags

 //  only compatible with 2.3/2.5.x series or higher.

 $this->connectToDB();

 $sql = "SELECT wpg_taxon.`term_taxonomy_id`, `name`, `slug`
 FROM `"
.$this->mysqlprefix."terms` AS wpg_terms
 INNER JOIN `"
.$this->mysqlprefix."term_taxonomy` AS wpg_taxon ON wpg_terms.`term_id` = wpg_taxon.`term_id`
 WHERE wpg_taxon.`taxonomy` = 'post_tag';"
;
 $q = $this->query($sql, __LINE__, __FILE__);



 while ($ar = mysql_fetch_array($q, MYSQL_ASSOC)) {

 $this->taglist[$ar['term_taxonomy_id']] = $ar['slug'];


 } // end while


 // now we want to create an array of the category IDs we are looking for

 /* so iterate through all the tags we've been given and
 match them to the numeric tags IDs in the tag list we
 just created */


 $i = 0;
 // an array counter for us

 foreach ($this->tagstoreturn as $tag) {

 $srch = array_search($tag, $this->taglist);

 if ($srch === false) { // treble equals to check if it is bool false and not just zero

 // tag not found, throw an error and halt execution
 die("The tag ".$tag." was not found, WPGet cannot get the posts!");

 }

 else {

 $this->tagsearch[$i] = $srch;
 // set the list of tags to search to the ID of the current tag

 $i++;
 // increment the counter

 }

 } // end foreach



} // end populateTagList()

function getWordpressEntries($number = 5, $chars = 300, $stripimages = true, $stripembed = true, $stripscript = true, $striplinks = false) {


 if (is_array($this->categoriestoreturn)) { // if we have selective categories on

 // we do it a completely different way

 // so populate the list
 $this->populateCategoryList();

 // then launch the alternative way to do it
 $this->getCatWPEntries($this->catsearch, $number, $chars, $stripimages, $stripembed, $stripscript);

 // and quit out of this function
 return;

 } // end if

 else if (is_array($this->tagstoreturn)) { // selected tags are on

 // populate tags
 $this->populateTagList();

 // launch category pull, passing in the tags
 $this->getCatWPEntries($this->tagsearch, $number, $chars, $stripimages, $stripembed, $stripscript);

 return;

 }

 $dateRangeClause = '';
 $searchClause = '';

 // if date range is set
 if ($this->daterange_start !== false &amp;&amp; $this->daterange_end !== false)
 {

 // get both start and end as Unix timestamps
 if ((int) $this->daterange_start === $this->daterange_start)
 {
 // assume a timestamp
 $start = (int) $this->daterange_start;
 }
 else {
 $start = (int) strtotime($this->daterange_start);
 }

 if ((int) $this->daterange_end === $this->daterange_end)
 {
 // assume a timestamp
 $end = (int) $this->daterange_end;
 }
 else {
 $end = (int) strtotime($this->daterange_end);
 }

 if ($start == 0 || $end == 0)
 {
 // there is a problem with the date ranges
 echo 'Invalid WPGet date ranges specified.';
 if ($this->debugmode)
 {
 echo ' on line '.__LINE__.' of '.__FILE__;
 }
 return false;
 }

 $dateRangeClause = "AND UNIX_TIMESTAMP(posts.`post_date`) > {$start} AND UNIX_TIMESTAMP(posts.`post_date`) < {$end}";

 }

 if ($this->searchtoreturn !== false)
 {

 // do a post title/post content search -- only return posts which match the search

 $this->connectToDB();
 $search = mysql_real_escape_string($this->searchtoreturn);

 $searchClause = "AND ((posts.post_title LIKE '%{$search}%') OR (posts.post_content LIKE '%{$search}%'))";


 }

 // if we have a style
 if ($this->usestyle != false) {

 $this->printStyleCSS($this->usestyle);

 }

 // gets $number of wordpress entries and prints in a friendly format
 $this->connectToDB();

 $sql = "SELECT *
 FROM `"
.$this->mysqlprefix."posts` as posts INNER JOIN `".$this->mysqlprefix."users` as users ON users.ID = posts.post_author
 WHERE posts.`post_status` = 'publish' AND posts.`post_type` = 'post'
 {$dateRangeClause}
 {$searchClause}
 ORDER BY `post_date` DESC LIMIT {$number};"
;

 $q = $this->query($sql, __LINE__, __FILE__);

 ?><div id="__wpget_entries"><?php

 while ($ar = mysql_fetch_array($q)) {
 $ar['post_ID'] = $ar[0]; // first row returned is posts.ID

 $this->formatWPContent($ar, $chars, $stripimages, $stripembed, $stripscript, $striplinks);

 }

 // Credit to me can be disabled, see top for details

 if ($this->showcredit) {
 echo '<p style="font-size:0.8em">WordPress integration powered by <a href="http://peter.upfold.org.uk/projects/wpget">WPGet</a> by Peter Upfold.</p>';
 }

 ?></div><?php


} // end getWordpressEntries()

function getSinglePost($postid, $chars = 0, $stripimages = true, $stripembed = true, $stripscript = true, $striplinks = false) {

 // gets the specified post ID
 $this->connectToDB();

 settype($postid, int);
 $postid = addslashes($postid);

 $sql = "SELECT *, posts.`ID` as `post_ID`
 FROM `"
.$this->mysqlprefix."posts` as posts INNER JOIN `".$this->mysqlprefix."users` as users ON users.ID = posts.post_author WHERE posts.`post_status` = 'publish' AND posts.`ID` = {$postid} AND users.`ID` = posts.`post_author`
 ORDER BY `post_date` DESC LIMIT 1;"
;

 $q = $this->query($sql, __LINE__, __FILE__);

 $ar = mysql_fetch_assoc($q);

 ?><div id="__wpget_entries"><?php

 $this->formatWPContent($ar, $chars, $stripimages, $stripembed, $stripscript, $striplinks);


 // Credit to me can be disabled, see top for details

 if ($this->showcredit) {
 echo '<p style="font-size:0.8em">WordPress integration powered by <a href="http://peter.upfold.org.uk/projects/wpget">WPGet</a> by Peter Upfold.</p>';
 }

 ?></div><?php


} // end getSinglePost


function getCatWPEntries($categories, $number = 5, $chars = 300, $stripimages = true, $stripembed = true, $stripscript = true, $striplinks = false) {

 $i = 0; // counter

 $catclause = "WHERE p2c.`term_taxonomy_id` IN (";

 $catclause .= implode(',', $categories);
 // implode our array of categories into a comma-delimited list for MySQL's 'IN'

 $catclause .= ')';

 $dateRangeClause = '';
 $searchClause = '';

 // if date range is set
 if ($this->daterange_start !== false &amp;&amp; $this->daterange_end !== false)
 {

 // get both start and end as Unix timestamps
 if ((int) $this->daterange_start === $this->daterange_start)
 {
 // assume a timestamp
 $start = (int) $this->daterange_start;
 }
 else {
 $start = (int) strtotime($this->daterange_start);
 }

 if ((int) $this->daterange_end === $this->daterange_end)
 {
 // assume a timestamp
 $end = (int) $this->daterange_end;
 }
 else {
 $end = (int) strtotime($this->daterange_end);
 }

 if ($start == 0 || $end == 0)
 {
 // there is a problem with the date ranges
 echo 'Invalid WPGet date ranges specified.';
 if ($this->debugmode)
 {
 echo ' on line '.__LINE__.' of '.__FILE__;
 }
 return false;
 }

 $dateRangeClause = "AND UNIX_TIMESTAMP(posts.`post_date`) > {$start} AND UNIX_TIMESTAMP(posts.`post_date`) < {$end}";

 }

 if ($this->searchtoreturn !== false)
 {

 // do a post title/post content search -- only return posts which match the search

 $this->connectToDB();
 $search = mysql_real_escape_string($this->searchtoreturn);

 $searchClause = "AND ((posts.post_title LIKE '%{$search}%') OR (posts.post_content LIKE '%{$search}%'))";


 }



 $sql = "SELECT * FROM
 `{$this->mysqlprefix}posts` AS posts INNER JOIN
 `{$this->mysqlprefix}term_relationships` AS p2c ON posts.`ID` = p2c.`object_id` INNER JOIN
 `{$this->mysqlprefix}users` AS users ON users.`ID` = posts.`post_author`
 {$catclause}
 {$dateRangeClause}
 {$searchClause}
 AND posts.`post_status` = 'publish' AND posts.`post_type` = 'post'
 ORDER BY p2c.`object_id` DESC
 LIMIT {$number};"
;

 $q = $this->query($sql, __LINE__, __FILE__);

 // duplicate prevention
 $shownPosts = array();
 $spc = 0;


 while ($ar = mysql_fetch_array($q)) {

 $ar['post_ID'] = $ar['object_id']; // for formatWPContent()

 if (!in_array($ar['object_id'], $shownPosts)) {

 $shownPosts[$spc] = $ar['object_id'];
 $spc++;

 $this->formatWPContent($ar, $chars, $stripimages, $stripembed, $stripscript, $striplinks);

 }

 } // end while

 // Credit to me can be disabled, see top for details

 if ($this->showcredit) {
 echo '<p style="font-size:0.8em">WordPress integration powered by <a href="http://peter.upfold.org.uk/projects/wpget">WPGet</a> by Peter Upfold.</p>';
 }


} // end getCatWPEntries()


} // end class

?>

&amp;nbsp;

King James Bible PHP Script Miscellaneous

A Complete Online King James Bible for your Website. Help us spread thy Word with our integrated Social Networking Tools. Easily syndicate what you have learned while reading the Bible with others on Twitter, Facebook, Myspace, Digg, YouTube?, Google, Yahoo, AOL, ASK, etc. Added Twitter API Support, Added Twitter Shout Box to Footer. Also, with our “Bookmark & Share” button you now can literally publish your thoughts with over 33 Social Networking sites instantly in one-click. Bible PHP Script v2.2 does allot more than just social bookmarking insightful Bible verses but now also translate the King James bible into 15 other languages besides English. Now share the Word of God in Arabic, German, Greek, Spanish, French, Italian, Hebrew, Korean, Russian, Slovak, Swedish, Turkish, Ukraine, Vietnamese and Chinese.

 

<?php

/**
 * File containing miscellaneous functions
 */

require_once('ClassGrepSearch.inc.php');

/**
 *
 * function to retrieve text lines from file
 *  highlighting the search string
 *
 * @param $filePath string
 * @param $classGrepSearch class Instance
 *
 */


function createLinesFromFile($filePath,$classGrepSearch)
{
 global $template;

 $linesArray = file($filePath);
 $chapterNo = (int)substr($filePath,-7,3);
 $htmlLines="";
 $classGrepSearch->setGlobalCount(0);
 $newLine = "";
 for($i=0;$i<count($linesArray);$i++)
 {
 $verseNo=(int)substr($linesArray[$i],0,strpos($linesArray[$i]," "));
 $verseText=substr($linesArray[$i],strpos($linesArray[$i]," "));
 $verseText = $classGrepSearch->allStrReplaceTag(htmlentities(html_entity_decode($verseText)),
 $template['searchResult']['Verse']['SearchKeyStartTag'],
 $template['searchResult']['Verse']['SearchKeyEndTag'] );
 if($classGrepSearch->getGlobalResult())
 {
 $htmlLines .=eval("return \"".$template['searchResult']['Verse']['ProcessHTML']."\";");
 }
 }
 $globalSearchCount = $classGrepSearch->getGlobalCount();
 return     $htmlLines;
}






/**
 *
 * function to get array of all Book Names
 *
 * return array
 *
 */


function getBooks()
{
 global $Book;

 return $Book;
}

/**
 *
 * function to get array of all Book Index from
 *  Book Names
 * return array
 *
 */



function getBookIndex()
{
 global $BookIndex;

 return $BookIndex;
}

/**
*
* function to return the Book Names
*  from start and end index
*
* @param $start_span number
* @param $end_span number
*
*    return array
*/

function getBookNames($startSpan,$endSpan)
{
 $Book = array();
 $Book = getBooks();
 $resultArray=array();
 for($i=$startSpan;$i<=$endSpan;$i++)
 {
 array_push($resultArray,$Book["All"][$i]);
 }

 return $resultArray;

}

/**
*
* function to get category name from
*  a category number
*
* @param $aCategoryNumber number
*
*    return array
*/


function getCategoryName($aCategoryNumber)
{
 $Category["11"]="Apocalyptic Books";
 $Category["3"]="Books of Moses";
 $Category["9"]="Epistles";
 $Category["4"]="Gospels";
 $Category["8"]="Historical Books";
 $Category["5"]="Major Prophets";
 $Category["6"]="Minor Prophets";
 $Category["2"]="New Testament";
 $Category["1"]="Old Testament";
 $Category["10"]="Pauline Epistles";
 $Category["7"]="Wisdom Books";
 if(isset($Category[$aCategoryNumber]))
 {
 return $Category[$aCategoryNumber];
 }
 else
 {
 return false;
 }
}

/**
*
* function to get all Book Names
*  in a particular category
*
* @param $aCategoryName string
*/


function getBookCategory($aCategoryName)
{
 $Book = array();
 $Book = getBooks();
 $resultArray=array();
 foreach($Book[$aCategoryName] as $BookName)
 {
 array_push($resultArray,$BookName);
 }
 return $resultArray;

}

/**
*
* function to create HTML Lines
* from database for the given
* search string.
*
* @param $databaseInfo array
* @param $classGrepSearch class Instance
*
* return string
*/


function createLinesFromDB($databaseInfo,$classGrepSearch)
{
 global $limit,$start_span,$end_span,$bookset,$template,$version;
 $databasehost = $databaseInfo['databasehost'];
 $databasename = $databaseInfo['databasename'];
 $databasetable = $databaseInfo['databasetable'];
 $databaseusername = $databaseInfo['databaseusername'];
 $databasepassword = $databaseInfo['databasepassword'] ;
 $classGrepSearch->setGlobalCount(0);
 $Books=getBooks();
 $htmlLines="";
 $con = @mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
 mysql_select_db($databasename);
 $searchArray=$classGrepSearch->getSearchArray();
 if($classGrepSearch->getSearchType()=="allInFile")
 {
 $varArray['limit']=$limit;
 $varArray['start_span']=$start_span;
 $varArray['end_span']=$end_span;
 $varArray['bookset']=$bookset;
 $varArray['databasetable']=$databasetable;
 $sql = createAllinChapterSQL($classGrepSearch,$varArray);
 }
 else
 {
 $sql = " SELECT * FROM ".$databasetable."  where ";

 if($limit == "bookset")
 {
 $sql .="( ";
 foreach($Books[getCategoryName($bookset)] as $BookName)
 {
 $bookId=array_search($BookName, $Books["All"]);
 $sql .="bookid = $bookId or ";
 }
 $sql=substr($sql,0,(strlen($sql)-3));
 $sql .=") and ";
 }
 if($limit == "span")
 {

 for($i=$start_span;$i<=$end_span;$i++)
 {
 if($i==$start_span)
 {
 $sql .="( ";
 }

 $sql .="bookid = $i ";
 if($i != $end_span)
 {
 $sql .=" or ";
 }
 else
 {
 $sql .=") and ";
 }
 }
 }
 foreach($searchArray as $search)
 {

 if($classGrepSearch->getCaseSensitive())
 {
 $sql .="binary ";
 }
 if($classGrepSearch->getSearchType()=="all")
 {
 $sql .= "versetext like '%".$search."%' and ";
 }else
 {
 $sql .= "versetext like '%".$search."%' or  ";
 }
 }
 $sql=substr($sql,0,(strlen($sql)-4)).";";
 }
 $result=mysql_query($sql) or die(mysql_error());
 $htmlLines="";
 $newLine ="";
 $prevChapterNo=0;
 $ChapterNo=0;
 $BookID=0;
 $prevBookID=0;
 $bookFirsttime=true;
 while($row=mysql_fetch_array($result))
 {



 $newLine="";
 $BookID=(int)$row[BOOKID];
 $ChapterNo=(int)$row[CHAPTERNO];
 $verseNo=(int)$row[VERSENO];
 $bookName=$Books["All"][$BookID];    $verseText=$classGrepSearch->allStrReplaceTag(htmlentities(html_entity_decode($row[VERSETEXT]))
 ,$template['searchResult']['Verse']['SearchKeyStartTag'],
 $template['searchResult']['Verse']['SearchKeyEndTag']);
 if($classGrepSearch->getGlobalResult())
 {
 $newLine .=$template['searchResult']['Verse']['StartHTML'];
 $newLine .=eval("return \"".$template['searchResult']['Verse']['ProcessHTML']."\";");
 $newLine .=$template['searchResult']['Verse']['EndHTML'];

 if(($BookID!=$prevBookID))
 {
 if($bookFirsttime)
 {
 $newLine =$template['searchResult']['Book']['StartHTML'].
 eval("return \"".$template['searchResult']['Book']['ProcessHTML']."\";").
 $template['searchResult']['Chapter']['StartHTML'].
 eval("return \"".$template['searchResult']['Chapter']['ProcessHTML']."\";").
 $newLine;
 $bookFirsttime=false;

 }else
 {
 $newLine =$template['searchResult']['Chapter']['EndHTML'].
 $template['searchResult']['Book']['EndHTML'].
 $template['searchResult']['Book']['StartHTML'].
 eval("return \"".$template['searchResult']['Book']['ProcessHTML']."\";").
 $template['searchResult']['Chapter']['StartHTML'].
 eval("return \"".$template['searchResult']['Chapter']['ProcessHTML']."\";").
 $newLine;
 }
 }
 else
 if(($ChapterNo!=$prevChapterNo))
 {
 $newLine =$template['searchResult']['Chapter']['EndHTML'].
 $template['searchResult']['Chapter']['StartHTML'].
 eval("return \"".$template['searchResult']['Chapter']['ProcessHTML']."\";").
 $newLine;

 }

 $prevBookID=$BookID;
 $prevChapterNo=$ChapterNo;
 $htmlLines .=$newLine;
 }

 }
 $htmlLines .=$template['searchResult']['Chapter']['EndHTML'];
 $htmlLines .=$template['searchResult']['Book']['EndHTML'];
 return $htmlLines;

}

/**
*
* function to create HTML Lines
* for sample search for the given
* search string.
*
* @param $classGrepSearch class Instance
*
* return string
*/


function createLinesFromSample($classGrepSearch)
{
 global $limit,$start_span,$end_span,$bookset;
 global $searchStringStartTag,$searchStringEndTag,$template;
 global $sampleSearch;
 $classGrepSearch->setGlobalCount(0);
 $Books=getBooks();
 $htmlLines="";
 $newLine ="";
 $prevChapterNo=0;
 $ChapterNo=0;
 $BookID=0;
 $prevBookID=0;
 $bookFirsttime=true;
 foreach($sampleSearch as $row)
 {
 $newLine="";
 $BookID=(int)$row[0];
 $ChapterNo=(int)$row[1];
 $verseNo=(int)$row[2];
 $bookName=$Books["All"][$BookID];    $verseText=$classGrepSearch->allStrReplaceTag(htmlentities(html_entity_decode($row[3]))
 ,$template['searchResult']['Verse']['SearchKeyStartTag'],
 $template['searchResult']['Verse']['SearchKeyEndTag']);
 if($classGrepSearch->getGlobalResult())
 {
 $newLine .=$template['searchResult']['Verse']['StartHTML'];
 $newLine .=eval("return \"".$template['searchResult']['Verse']['ProcessHTML']."\";");
 $newLine .=$template['searchResult']['Verse']['EndHTML'];

 if(($BookID!=$prevBookID))
 {
 if($bookFirsttime)
 {
 $newLine =$template['searchResult']['Book']['StartHTML'].
 eval("return \"".$template['searchResult']['Book']['ProcessHTML']."\";").
 $template['searchResult']['Chapter']['StartHTML'].
 eval("return \"".$template['searchResult']['Chapter']['ProcessHTML']."\";").
 $newLine;
 $bookFirsttime=false;

 }else
 {
 $newLine =$template['searchResult']['Chapter']['EndHTML'].
 $template['searchResult']['Book']['EndHTML'].
 $template['searchResult']['Book']['StartHTML'].
 eval("return \"".$template['searchResult']['Book']['ProcessHTML']."\";").
 $template['searchResult']['Chapter']['StartHTML'].
 eval("return \"".$template['searchResult']['Chapter']['ProcessHTML']."\";").
 $newLine;
 }
 }
 else
 if(($ChapterNo!=$prevChapterNo))
 {
 $newLine =$template['searchResult']['Chapter']['EndHTML'].
 $template['searchResult']['Chapter']['StartHTML'].
 eval("return \"".$template['searchResult']['Chapter']['ProcessHTML']."\";").
 $newLine;

 }

 $prevBookID=$BookID;
 $prevChapterNo=$ChapterNo;
 $htmlLines .=$newLine;
 }
 }
 $htmlLines .=$template['searchResult']['Chapter']['EndHTML'];
 $htmlLines .=$template['searchResult']['Book']['EndHTML'];

 return $htmlLines;
}

/**
*
* function to create SQL for all in chapter
* search for database
*
* @param $classGrepSearch class Instance
* @param $varArray array
*
* return string
*/


function createAllinChapterSQL($classGrepSearch,$varArray)
{
 $limit=$varArray['limit'];
 $start_span=$varArray['start_span'];
 $end_span=$varArray['end_span'];
 $bookset=$varArray['bookset'];
 $databasetable=$varArray['databasetable'];
 $sql = "select $databasetable.*  from (SELECT * FROM (";
 if($classGrepSearch->getCaseSensitive())
 {
 $binary = "binary";
 }
 else
 {
 $binary="";
 }
 $Books=getBooks();
 $searchRange="";
 if($limit == "bookset")
 {
 $searchRange ="( ";
 foreach($Books[getCategoryName($bookset)] as $BookName)
 {
 $bookId=array_search($BookName, $Books["All"]);
 $searchRange .="bookid = $bookId or ";
 }
 $searchRange=substr($searchRange,0,(strlen($searchRange)-3));
 $searchRange .=") and ";
 }
 if($limit == "span")
 {

 for($i=$start_span;$i<=$end_span;$i++)
 {
 if($i==$start_span)
 {
 $searchRange .="( ";
 }

 $searchRange .="bookid = $i ";
 if($i != $end_span)
 {
 $searchRange .=" or ";
 }
 else
 {
 $searchRange .=") and ";
 }
 }
 }
 $searchArray=$classGrepSearch->getSearchArray();

 foreach($searchArray as $search)
 {
 $sql.="SELECT DISTINCT bookid,chapterno FROM  $databasetable WHERE $searchRange $binary versetext like '%".$search."%'";
 $sql .= "UNION ALL ";
 }
 $sql=substr($sql,0,(strlen($sql)-10));
 $sql.=") AS tbl  GROUP BY tbl.bookid,tbl.chapterno  HAVING COUNT(*) = ".count($searchArray).") as tbl2 inner join $databasetable on tbl2.bookid=$databasetable.bookid and tbl2.chapterno=$databasetable.chapterno" ;

return $sql;

}



?>

&amp;nbsp;

PHP Scripts for opening hours Miscellaneous

The freeware script is an easy php opening time program in orderto show too different times passed away suitable texts, suitable for shops, practise, ect. A data bank is not required. Joomlacompatible Appearance: Example: Now our shopis closed! Monday open 08 – 12:30, 13 – 19 o’clock. The pattern is always: Opening time, lunchbreak closingtime or only: Opening time, closing-time Features: Adjustable times for every day of the week Whole day unanimously or also no lunchbreak adjustable. Freely adaptable texts. Holiday function. Quick counter for open and closed. Optional weekly overview in popup. Backend of all functions. This script is primary in german but could be translated for a few coins; use my contactform.

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html>
<head>
<title></title>
<meta name="description" content="">
 <meta name="keywords" content="">
 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<br><br>

<?php
include_once("scripte/Ampel.php");
?>

<br>
Hier also mein Öffnungszeitenskript in aktion, eingebunden wie im readme beschrieben. Unten die Steuerung; kinderleicht zu bedienen- zumindest die Zeiteinstellung;)<br>
Im ersten Kasten ist die Schnelldeaktivierung:
Man kann mit einen click das script deaktivieren und entweder text 1(zb heute geöffnet) oder text 2(zB. heute geschlossen) erscheinen lassen.<br>
Der  zweite Kasten beinhaltet die schnelle Zeiteinstellung.
<br>
Im dritten ist die Komplettsteuerung; hier können zB. auch die Ausgabetexte geändert werden.


<br><br>Über eine Spende würde ich mich freuen:<br><br>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="7043154">
<input type="image" src="https://www.paypal.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="über eine Spende würde ich mich freuen.">
<img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>

<br><br><br>




<table style="width: 775px; height: 214px; border: 3px solid #ffaa00;" border="3" cellpadding="7">
<tbody style="text-align: left;">

<tr style="text-align: left;">
<td><span style="font-size: 14pt;"><span style="color: #99cc00;">Die </span></span><span style="font-size: 14pt;"><span style="color: #99cc00;">Steuerung </span></span><span style="font-size: 14pt;"><span style="color: #99cc00;">der </span></span><span style="font-size: 14pt;"><span style="color: #99cc00;">Praxisampel:</span></span></td>
</tr>
<tr style="text-align: left;">
<td style="border-style: solid; border-width: 1px; text-align: left; background-color: #ffffff;">
<p><a href="/scripte/schalter/geschlossen.php" target="_blank"><span style="font-size: 8pt; font-family: verdana,geneva;"><strong><br />Praxis <span style="color: #ff0000;">geschlossen</span></strong>:</span></a><br /><br> Die Praxisampel wird deaktiviert und es erscheint der Text: "Die Praxis ist heute geschlossen".</p>
<a href="/scripte/schalter/offen.php" target="_blank"></a>
<p><a href="/scripte/schalter/offen.php" target="_blank"><span style="font-size: 8pt; font-family: verdana,geneva;"><strong>Praxisampel aktivieren</strong>:</span></a><br /><br> Die Praxisampel läuft wie gewohnt.</p>

<a href="/scripte/schalter/immeroffen.php" target="_blank"> </a>
<p><a href="/scripte/schalter/immeroffen.php" target="_blank"><span style="font-size: 8pt; font-family: verdana,geneva;"><strong>Praxis <span style="color: #008000;">offen</span></strong>:</span></a><br /><br> Die Ampel wird deaktiviert und es erscheint die Nachricht: "Die Praxis ist heute geöffnet"</p>
</td>
</tr>
</tbody>
</table><table style="border: 3px solid #ffaa00; width: 800px;" border="3" cellpadding="7">
<tbody>
<tr>
<td colspan="4"><strong><br />Zeittafel: Uhrzeit in der Form<strong> 00:00 - 23:59; Stunden müssen zweistellig sein.</strong><br /> Keine Mittagspause:<span style="color: black;"> Mittagspause Beginn: zu<br /></span> Ganzer Tag geschlossen:<span style="color: black;"> Öffnung: zu</span> <br /></strong></td>

</tr>
<tr>
<td colspan="4"><strong>Montag </strong></td>
</tr>
<tr bgcolor="#809FFF">
<td><iframe src="/../scripte/montag/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/montag/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/montag/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/montag/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
</tr>
<tr>
<td colspan="4"><strong>Dienstag </strong></td>

</tr>
<tr bgcolor="#9900FF">

<td><iframe src="/../scripte/dienstag/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/dienstag/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/dienstag/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/dienstag/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
</tr>

<tr>
<td colspan="4"><strong>Mittwoch </strong></td>
</tr>

<tr bgcolor="#CF9EFF">
<td>    <iframe src="/../scripte/mittwoch/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe>
</td>
<td><iframe src="/../scripte/mittwoch/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/mittwoch/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/..//scripte/mittwoch/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
</tr>
<tr>
<td colspan="4"><strong>Donnerstag </strong></td>
</tr>
<tr bgcolor="#FF9EFF">

<td><iframe src="/../scripte/donnerstag/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/donnerstag/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/donnerstag/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/donnerstag/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>


</tr>
<tr>
<td colspan="4"><strong>Freitag </strong></td>
</tr>
<tr bgcolor=#FF8080>

<td><iframe src="/../scripte/freitag/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/freitag/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/freitag/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/freitag/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
</tr>
<tr>
<td colspan="4"><strong>Samstag </strong></td>
</tr>
<tr bgcolor="#99CC00">

<td><iframe src="/../scripte/samstag/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">

</iframe></td>
<td><iframe src="/../scripte/samstag/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/samstag/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/samstag/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
</tr>
<tr>
<td colspan="4" ><strong>Sonntag </strong></td>
</tr>
<tr bgcolor="#ffff9e">
<td><iframe src="/../scripte/sonntag/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/sonntag/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>

<td><iframe src="/../scripte/sonntag/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/sonntag/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
</tr>


<tr bgcolor="yellow">
<td><iframe src="/../scripte/urlaub/steuerung1.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/urlaub/steuerung2.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/urlaub/steuerung3.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td rowspan=2><b> Urlaubseinstellungen:<br>

Tage und Monate immer zweistellig, Jahre vierstellig.
Alle Boxen müssen Werte enthalten.</b>

</font>
</td>
</tr>

<tr bgcolor="yellow">

<td><iframe src="/../scripte/urlaub/steuerung4.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/urlaub/steuerung5.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>
<td><iframe src="/../scripte/urlaub/steuerung6.php" width="200" height="120" name="SELFHTML_in_a_box">
</iframe></td>

</tr>







</tbody>
</table><table style="width: 780px; h border: 3px solid #ffaa00;color: black" border="3" cellpadding="7">
<tbody>
<tr>
<td ><strong>Komplette Ampelbenutzeroberfläche:<br /></strong> Hier können Öffnungs und Schliesszeiten  eingestellt werden(Montag-Sonntag, Urlaub), die Ampel aktiviert/deaktiviert und einige Ausgabetexte editiert werden. Font-tags können benutzt werden.<br />

Aufbau Texte: </td></tr><tr><td>

<table border="2">

<tr><td width="110">Satz Teil 1:</td><td colspan=4>Satz Teil 2: </td><td>Satz Teil 3:</td></tr>
<tr bgcolor="#99CC00">
<td> Die Praxis ist</td> <td> offen</td> <td>wieder geöffnet vormittags</td><td>wieder geöffnet nachmittags</td> <td> Montag geöffnet</td><td> <i><font size=2>Zeit</font></i> bis <i><font size=2>Zeit</font></i> Uhr</td> </tr>

<tr bgcolor="#99CC00" >
<td><font color=blue>
Satz_teil 1</td>   <td><font color=blue>satz_teil1_offen</td><td><font color=blue>Satz Teil2 wieder offen1   </td><td><font color=blue>Satz Teil2wieder offen 2 </td>  <td><font color=blue>Satz Teil 3 Wochenende</td><td><font color=blue>.......bis.......Uhr</font></td>

<tr><td colspan=4></td>
</tr>

<tr bgcolor="#809FFF"><td></td>
<td > geschlossen nachts</td> <td>geschlossen vormittags</td> <td colspan=3>geschlossen nachmittags</td>  </tr>

<tr bgcolor="#809FFF"><td></td>
<td><font color=blue> Satz Teil2 geschlossen3</td> <td> <font color=blue>Satz Teil2 geschlossen1</td> <td colspan=3><font color=blue>Satz Teil2 geschlossen2 </font></td>  </tr>
</td>
</tr>
<tr><td colspan=6><font color=blue>Format Satz Teil3</font>: formatiert Teilstücke Satz Teil 2 und 3
<br>Restliche Ausgabetexte:<br>
<font color=blue>Ampelwoche</font>: linktext vom link zur Wochenübersicht. Voreinstellung: >>Wochenuebersicht(leerlassen=kein link).<br>

<font color=blue>leerzeichen</font>: Abstand des links Wochenübersicht zum Ausgabetext. Jedes &amp;nbspX; (Ohne X geschrieben!) entspricht 1 Leerzeichen.

<br><font color=blue> Montag, Dienstag,..Sonntag</font>: Wochentage für Wochenübersicht und Standardausgabe.
<br><font color=blue>geschlossen</font>: Trigger für geschlossen(Mittagspause,Gesamttag); muss 2stellig sein. Voreinstellung: zu.
<br><font color=blue>Satz_Teil2_wieder_geöffnet4</font>: Satzbeginn Öffnungszeiten(für übermorgen oder später) bei geschlossener Praxis. Voreinstellung: Wieder geoeffnet<br>
<font color=blue>Trennzeichen</font>: Das Satzzeichen nach dem Wochentag, Voreinstellung: ,<br>
<font color=blue>deaktivierungzu, deaktivierungoffen</font> Texte der deaktivierten Praxisampel.<br>

</td></tr>
</font>
</table></td></tr><tr><td>




<table border="5" width="680px">
<tbody>
<tr>
<td width="200" valign="top"<br />Auswahlfeld:<br /> <form action="../"> <select onchange="window.open(this.options[this.selectedIndex].value,'xunten')"> <option>Wählen Sie..</option> <option value="../scripte/montag/zeit.php">Montag</option> <option value="../scripte/dienstag/zeitd.php">Dienstag</option> <option value="../scripte/mittwoch/zeit.php">Mittwoch</option> <option value="../scripte/donnerstag/zeitdo.php">Donnerstag</option> <option value="../scripte/freitag/zeit.php">Freitag</option> <option value="../scripte/samstag/zeit.php">Samstag</option> <option value="../scripte/urlaub/zeitz.php">Urlaub</option> <option value="../scripte/schalter/zeit.php">Deaktivieren/Aktivieren</option> <option value="../scripte/texte/zeit.php">Ausgabetexte</option> </select> </form></td>

<td>

<iframe src="/../scripte/ampelunten.html" width="480" height="280" name="xunten">

</iframe>

</td>

</tr>
</tbody>
</table></td></tr></table>




</body>
</html>

&amp;nbsp;

php easy :: seo report script Miscellaneous

SEO Report Script is intended to lookup for SEO results for your domain on all major search engines and other important sites and to present them on a single page. It retrieves and displays the following information about your domain: Google indexed pages, Google inbound links, Yahoo indexed pages, Yahoo inbound links, Bing indexed pages, Bing inbound links, Alexa rank, Alexa inbound links, DMOZ listing (if any) & SiteAdvisor rating. Update: modified Google results pattern to work properly with new Google search results layout.

 

<?php
/*************************************************************************
php easy :: seo report script
==========================================================================
Author:      php easy code, www.phpeasycode.com
Web Site:    http://www.phpeasycode.com
Contact:     webmaster@phpeasycode.com
*************************************************************************/


function getGooglePages($host) {
 $request = "http://www.google.com/search?q=" . urlencode("site:" . $host) . "&amp;amp;hl=en";
 $data = getPageData($request);
 preg_match('/<div id=resultStats>(About )?([\d,]+) result/si', $data, $p);
 $value = ($p[2]) ? $p[2] : "n/a";
 $string = "<a href=\"" . $request . "\">" . $value . "</a>";
 return $string;
}

function getGoogleLinks($host) {
 $request = "http://www.google.com/search?q=" . urlencode("link:" . $host) . "&amp;amp;hl=en";
 $data = getPageData($request);
 preg_match('/<div id=resultStats>(About )?([\d,]+) result/si', $data, $l);
 $value = ($l[2]) ? $l[2] : "n/a";
 $string = "<a href=\"" . $request . "\">" . $value . "</a>";
 return $string;
}

function getYahooPages($host) {
 $request = "http://siteexplorer.search.yahoo.com/search?p=" . urlencode($host);
 $data = getPageData($request);
 preg_match('/Pages \(([\d,]+)/si', $data, $p);
 $value = ($p[1]) ? $p[1] : "n/a";
 $string = "<a href=\"" . $request . "\">" . $value . "</a>";
 return $string;
}

function getYahooLinks($host) {
 $request = "http://siteexplorer.search.yahoo.com/search?p=" . urlencode($host);
 $data = getPageData($request);
 preg_match('/Inlinks \(([\d,]+)/si', $data, $l);
 $value = ($l[1]) ? $l[1] : "n/a";
 $string.= "<a href=\"" . $request . "&amp;amp;bwm=i\">" . $value . "</a>";
 return $string;
}

function getBingPages($host) {
 $request = "http://www.bing.com/search?q=" . urlencode("site:" . $host) . "&amp;amp;mkt=en-US";
 $data = getPageData($request);
 preg_match('/1-([\d]+) of ([\d,]+)/si', $data, $p);
 $value = ($p[2]) ? $p[2] : "n/a";
 $string = "<a href=\"" . $request . "\">" . $value . "</a>";
 return $string;
}

function getBingLinks($host) {
 $request = "http://www.bing.com/search?q=" . urlencode("inbody:" . $host) . "&amp;amp;mkt=en-US";
 $data = getPageData($request);
 preg_match('/1-([\d]+) of ([\d,]+)/si', $data, $p);
 $value = ($p[2]) ? $p[2] : "n/a";
 $string = "<a href=\"" . $request . "\">" . $value . "</a>";
 return $string;
}

function getAlexaRank($domain) {
 $request = "http://data.alexa.com/data?cli=10&amp;amp;dat=s&amp;amp;url=" . $domain;
 $data = getPageData($request);
 preg_match('/<POPULARITY URL="(.*?)" TEXT="([\d]+)"\/>/si', $data, $p);
 $value = ($p[2]) ? number_format($p[2]) : "n/a";
 $string = "<a href=\"http://www.alexa.com/siteinfo/" . $domain . "\">" . $value . "</a>";
 return $string;
}

function getAlexaLinks($domain) {
 $request = "http://data.alexa.com/data?cli=10&amp;amp;dat=s&amp;amp;url=" . $domain;
 $data = getPageData($request);
 preg_match('/<LINKSIN NUM="([\d]+)"\/>/si', $data, $l);
 $value = ($l[1]) ? number_format($l[1]) : "n/a";
 $string = "<a href=\"http://www.alexa.com/site/linksin/" . $domain . "\">" . $value . "</a>";
 return $string;
}

function getDMOZListings($domain) {
 $request = "http://data.alexa.com/data?cli=10&amp;amp;url=" . $domain;
 $data = getPageData($request);
 preg_match('/<SITE BASE="(.*?)" TITLE="(.*?)" DESC="(.*?)">/si', $data, $s);
 $value1 = ($s[1]) ? $s[1] : "";
 $value2 = ($s[2]) ? $s[2] : "";
 $value3 = ($s[3]) ? $s[3] : "";
 preg_match('/<CAT ID="(.*?)" TITLE="(.*?)" CID="(.*?)"\/>/si', $data, $c);
 $value4 = ($c[1]) ? $c[1] : "";
 $value5 = ($c[2]) ? $c[2] : "";
 $value6 = ($c[3]) ? $c[3] : "";
 $string = "";
 if($value4) {
 $string = "<a href=\"http://www.dmoz.org/" . str_replace("Top/","", $value4) . "\" title=\"" . $value2 . " - " . $value3 . "\">" . $value5 . "</a>";
 }
 else $string = "n/a";
 return $string;
}

function getSiteAdvisorRating($domain) {
 $request = "http://www.siteadvisor.com/sites/" . $domain . "?ref=safe&amp;amp;locale=en-US";
 $data = getPageData($request);
 preg_match('/(green|yellow|red)-xbg2\.gif/si', $data, $r);
 $value = ($r[1]) ? $r[1] : "grey";
 $string = "<a href=\"" . $request . "\">" . $value . "</a>";
 return $string;
}

function getWOTRating($domain) {
 $request = "http://api.mywot.com/0.4/public_query2?target=" . $domain;
 $data = getPageData($request);
 preg_match_all('/<application name="(\d+)" r="(\d+)" c="(\d+)"\/>/si', $data, $regs);
 $trustworthiness = ($regs[2][0]) ? $regs[2][0] : -1;
 $values = array("trustworthy","mostly","suspicious","untrustworthy","dangerous","unknown");
 if($trustworthiness>=80) $value = $values[0];
 elseif($trustworthiness>=60) $value = $values[1];
 elseif($trustworthiness>=40) $value = $values[2];
 elseif($trustworthiness>=20) $value = $values[3];
 elseif($trustworthiness>=0) $value = $values[4];
 else $value = $values[5];
 $string = "<a href=\"http://www.mywot.com/en/scorecard/" . $domain . "\">" . $value . "</a>";
 return $string;
}

function getDomainAge($domain) {
 $request = "http://reports.internic.net/cgi/whois?whois_nic=" . $domain . "&amp;type=domain";
 $data = getPageData($request);
 preg_match('/Creation Date: ([a-z0-9-]+)/si', $data, $p);
 if(!$p[1]) {
 $value = "Unknown";
 }
 else {
 $time = time() - strtotime($p[1]);
 $years = floor($time / 31556926);
 $days = floor(($time % 31556926) / 86400);
 if($years == "1") {
 $y= "1 year";
 }
 else {
 $y = $years . " years";
 }
 if($days == "1") {
 $d = "1 day";
 }
 else {
 $d = $days . " days";
 }
 $value = "$y, $d";
 }
 $string = "<a href=\"" . $request . "\">" . $value . "</a>";
 return $string;
}

function getPageData($url) {
 if(function_exists('curl_init')) {
 $ch = curl_init($url); // initialize curl with given url
 curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // add useragent
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable
 if((ini_get('open_basedir') == '') &amp;&amp; (ini_get('safe_mode') == 'Off')) {
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any
 }
 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // max. seconds to execute
 curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error
 return @curl_exec($ch);
 }
 else {
 return @file_get_contents($url);
 }
}

function getDomainFromHost($host) {
 $hostparts = explode('.', $host); // split host name to parts
 $num = count($hostparts); // get parts number
 if(preg_match('/^(ac|arpa|biz|co|com|edu|gov|info|int|me|mil|mobi|museum|name|net|org|pp|tv)$/i', $hostparts[$num-2])) { // for ccTLDs like .co.uk etc.
 $domain = $hostparts[$num-3] . '.' . $hostparts[$num-2] . '.' . $hostparts[$num-1];
 }
 else {
 $domain = $hostparts[$num-2] . '.' . $hostparts[$num-1];
 }
 return $domain;
}

$sitehost = ($_POST['sitehost']) ? $_POST['sitehost'] : $_SERVER['HTTP_HOST'];
$sitedomain = getDomainFromHost($sitehost);

?>
<html>
<head>
<title>SEO Report for <?=$sitedomain;?></title>
</head>
<body>
<form method="post" action="<?$_SERVER['PHP_SELF'];?>">
<p><b>Domain/Host Name:</b> <input type="text" name="sitehost" size='30' maxlength='50' value="<?=$sitehost;?>"> <input type="submit" value="Grab Details"></p>
</form>
<ul>
<li>Google indexed pages: <?=getGooglePages($sitehost);?></li>
<li>Google inbound links: <?=getGoogleLinks($sitehost);?></li>
<li>Yahoo indexed pages: <?=getYahooPages($sitehost);?></li>
<li>Yahoo inbound links: <?=getYahooLinks($sitehost);?></li>
<li>Bing indexed pages: <?=getBingPages($sitehost);?></li>
<li>Bing inbound links: <?=getBingLinks($sitehost);?></li>
<li>Alexa Rank: <?=getAlexaRank($sitedomain);?></li>
<li>Alexa inbound links: <?=getAlexaLinks($sitedomain);?></li>
<li>DMOZ listing: <?=getDMOZListings($sitedomain);?></li>
<li>SiteAdvisor rating: <?=getSiteAdvisorRating($sitedomain);?></li>
<li>WOT rating: <?=getWOTRating($sitedomain);?></li>
<li>Domain age: <?=getDomainAge($sitedomain);?></li>
</ul>
</body>
</html>

&amp;nbsp;