Creating Your Own Server Stat Script
By bob | July 10, 2008
Before you create your own server stat script in PHP, it is must to check your ports are responding also you you should aware when one of your services are down, such as HTTP, MySQL, POP/SMTP, etc. Also you should be attentive toward the current server loads, and users which will be the chief indicator of a runaway script, or process.
So let’s start.
Make sure your php script must start with <?php this tells your server that it is in fact a php script
<?php
//You can replace the domain with an IP if you wish
$site = “mysite.com”; //this is the site you wish to check
// Let’s check our common ports 80, 21, and 110
$http = fsockopen($site, 80);
$ftp = fsockopen($site, 21);
$pop3 = fsockopen($site, 110);
if ($http) {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>HTTP</b>: Working</font></font><br>”;
}
else {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>HTTP</b>: Not Working</font></font><br>”;
}
if ($ftp) {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>FTP</b>: Working</font></font><br>”;
}
else {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>FTP</b>: Not Working</font></font><br>”;
}
if ($pop3) {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>POP3/SMTP</b>: Working</font></font><br>”;
}
else {
$status .= “<font face=\”Arial\”><font size=\”2\”><b>POP3/SMTP</b>: Not Working</font></font><br>”;
}
echo(”$status”);
echo(”<hr>”);
// Users and load information
$reguptime = trim(exec(”uptime”));
if ($reguptime) {
if (preg_match(”/, *(\d) (users?), .*: (.*), (.*), (.*)/”, $reguptime, $uptime)) {
$users[0] = $uptime[1];
$users[1] = $uptime[2];
$loadnow = $uptime[3];
$load15 = $uptime[4];
$load30 = $uptime[5];
}
} else {
$users[0] = “Unavailable”;
$users[1] = “–”;
$loadnow = “Unavailable”;
$load15 = “–”;
$load30 = “–”;
}
echo(”<b>Current Users:</b> $users[0]<br>
<b>Current Load:</b> $loadnow<br><b>Load 15 mins ago:</b> $load15<br><b>Load 15 mins ago:</b> $load30<br><hr>”);
// Operating system
$fp = @fopen(”/proc/version”, “r”);
if ($fp) {
$temp = fgets($fp);
fclose($fp);
if (preg_match(”/version (.*?) /”, $temp, $osarray)) {
$kernel = $osarray[1];
preg_match(”/[0-9]{5,} (\((.* *)\)\))/”, $temp, $osarray);
$flavour = $osarray[2];
$operatingsystem = $flavour.” (”.PHP_OS.” “.$kernel.”)”;
if (preg_match(”/SMP/”, $buf)) {
$operatingsystem .= ” (SMP)”;
}
} else {
$result = “(N/A)”;
}
} else {
$result = “(N/A)”;
}
echo(”<b>Operating System:</b><br>$operatingsystem”);
?>
The above code when uploaded to your server, it will display the status of your services, your user and load averages.
Now you can work with this, and make it look however you want, add new ports, etc.
Remember, this is just a very basic stat script.
Key Issues
One of the key issues you should aware that your host will need to allow the exec() funtion, in order for this to work properly.
Topics: web development | No Comments »
wp-cron.php & rss/atom feed source
By bob | June 30, 2008
wp-cron.php (source)
ignore_user_abort(true);
define(’DOING_CRON’, TRUE);
require_once(’./wp-config.php’);
if ( $_GET['check'] != wp_hash(’187425′) )
exit;
if ( get_option(’doing_cron’) > time() )
exit;
update_option(’doing_cron’, time() + 30);
$crons = _get_cron_array();
$keys = array_keys($crons);
if (!is_array($crons) || $keys[0] > time())
return;
foreach ($crons as $timestamp => $cronhooks) {
if ($timestamp > time()) break;
foreach ($cronhooks as $hook => $keys) {
foreach ($keys as $key => $args) {
$schedule = $args[’schedule’];
if ($schedule != false) {
$new_args = array($timestamp, $schedule, $hook, $args[’args’]);
call_user_func_array(’wp_reschedule_event’, $new_args);
}
wp_unschedule_event($timestamp, $hook, $args[’args’]);
do_action_ref_array($hook, $args[’args’]);
}
}
}
update_option(’doing_cron’, 0);
?>
================================================================
wp-rss.php (source)
<?php
if (empty($wp)) {
require_once(’./wp-config.php’);
wp(’feed=rss’);
}
require (ABSPATH . WPINC . ‘/feed-rss.php’);
?>
=================================================================
wp-atom.php (source)
1 <?php
2
3 if (empty($wp)) {
4 require_once(’./wp-config.php’);
5 wp(’feed=atom’);
6 }
7
8 require (ABSPATH . WPINC . ‘/feed-atom.php’);
9
10 ?>
=================================================================
Topics: wordpress tutorial | No Comments »
Create an IP based website using Ensim
By bob | June 27, 2008
To create an IP-based website make sure you should have all the required information to create a website site before you start.
To create an IP-based site:
* click Add IP-based Site (Sites section) in the shortcuts section of the Home page,.
* In the Site Name field, enter the name of the site.
* Important: The site name should have fully qualified name, containing both the host name and the domain name; do not include the www prefix. The total length of the database name (inclusive of the database prefix) should be less than 255 characters.
* In the Administrator User Name field, enter a user name for the Site Administrator, the person who will manage this new site.
* Important: You must not enter a user name starting with a number (such as 123abc). If you do, you will receive an error message and the site will fail to add.
* In the Administrator Password field, enter a password for the Site Administrator.
* Retype this password in the Confirm Administrator Password field.
* In the Email Contact field, enter the email address of the Site Administrator.
* Select an appropriate option button in the Security Level field to set the security level for the site. (if available)
* In the IP Address field, enter the IP address you are assigning to the site.
* In the Select a Service Plan field (if available), do one of the following:
If you want to use an existing Service Plan template, click the arrow and from the list, choose the name of the template you want to use.
If you do not want to use a Service Plan template, or if you want to manually assign the services available to this site, click Advanced.
The Add IP-based Site form expands to display the Service Plan form that allows you to choose the service options you want to enable for the site.
Use the Service Plan Options Information to help you complete the form.
Click Add Site.
The control panel creates the new IP-based site and assigns a temporary, default home page for it. To view this temporary home page, go to: http://<your_site_name>.
Topics: cpanel hosting | No Comments »
Common Attribute Definitions Used in XHTML
By bob | June 17, 2008
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
xmlns:xh11d="http://www.w3.org/1999/xhtml/datatypes/"
>
<xs:import namespace="http://www.w3.org/1999/xhtml/datatypes/"
schemaLocation="xhtml-datatypes-1.xsd" />
<xs:annotation>
<xs:documentation>
This is the XML Schema common attributes module for XHTML
$Id: xhtml-attribs-1.xsd,v 1.6 2005/09/26 23:37:47 ahby Exp $
</xs:documentation>
<xs:documentation source="xhtml-copyright-1.xsd"/>
<xs:documentation source="http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_commonatts"/>
</xs:annotation>
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd">
<xs:annotation>
<xs:documentation>
This import brings in the XML namespace attributes
The module itself does not provide the schemaLocation
and expects the driver schema to provide the
actual SchemaLocation.
</xs:documentation>
</xs:annotation>
</xs:import>
<xs:attributeGroup name="xhtml.id">
<xs:attribute name="id" type="xs:ID"/>
</xs:attributeGroup>
<xs:attributeGroup name="xhtml.class">
<xs:attribute name="class" type="xs:NMTOKENS"/>
</xs:attributeGroup>
<xs:attributeGroup name="xhtml.title">
<xs:attribute name="title" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="xhtml.Core.attrib">
<xs:attributeGroup ref="xhtml.id"/>
<xs:attributeGroup ref="xhtml.class"/>
<xs:attributeGroup ref="xhtml.title"/>
<xs:attributeGroup ref="xhtml.Core.extra.attrib"/>
</xs:attributeGroup>
<xs:attributeGroup name="xhtml.I18n.attrib">
<xs:attribute ref="xml:lang" />
<xs:attributeGroup ref="xhtml.I18n.extra.attrib"/>
</xs:attributeGroup>
<xs:attributeGroup name="xhtml.Common.attrib">
<xs:attributeGroup ref="xhtml.Core.attrib"/>
<xs:attributeGroup ref="xhtml.I18n.attrib"/>
<xs:attributeGroup ref="xhtml.Common.extra"/>
</xs:attributeGroup>
<!-- Global attributes -->
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute name="class" type="xs:NMTOKENS"/>
<xs:attribute name="title" type="xs:string"/>
<xs:attributeGroup name="xhtml.Global.core.attrib">
<xs:attribute ref="id"/>
<xs:attribute ref="class"/>
<xs:attribute ref="title"/>
<xs:attributeGroup ref="xhtml.Global.core.extra.attrib" />
</xs:attributeGroup>
<xs:attributeGroup name="xhtml.Global.i18n.attrib">
<xs:attribute ref="xml:lang" />
<xs:attributeGroup ref="xhtml.Global.I18n.extra.attrib"/>
</xs:attributeGroup>
<xs:attributeGroup name="xhtml.Global.common.attrib">
<xs:attributeGroup ref="xhtml.Global.core.attrib"/>
<xs:attributeGroup ref="xhtml.Global.i18n.attrib"/>
<xs:attributeGroup ref="xhtml.Global.Common.extra"/>
</xs:attributeGroup>
</xs:schema>
Topics: web designing, web development | No Comments »
Shopping Cart Software
By bob | June 4, 2008
Here are the list of shopping cart software which are widely used and most of them are from open source, this list also contain few paid shopping cart.
AbleCommerce
AbleCommerce (ASP.NET)
AbleCommerce (Cold Fusion)
A-CART Pro
Actinic Business
Actinic Catalog
Actinic Developer software
Actinic Order Manager
Advanced Cart
AFCommerce
Affiliate Guerrilla
Agora Cart
ampleShop
AShop Deluxe
AShop Deluxe 3-Domain License
ASPCart
AspDotNetStorefront ML
AspDotNetStorefront Pro
AspDotNetStorefront Standard
Avactis Shopping Cart
Avetti Commerce
BakeSale
Bizar Shop
BlueCart
BugMall
BusyBeeCart
BVC 2004 Enterprise
BVC 2004 Express
CactuShop
CandyPress Store Administration
CandyPress™ Store Administration
CandyPress™ Store Frontend
Captures
Cart Genie
Cart32 Enterprise Edition
Cart32 Free Edition
Cart32 Small Business Edition
CartIt Commerce System
Cartweaver 2
Cartweaver2 (Cold Fusion)
CATALooK.net Store Pro
cf_ezcart
CFWebstore
Charon Cart 3
Cigtek
ClearCart
ClickCart
ClickCartPro
clicshop
Clockwatchers Free
Clover Shop Lite
Clover Shop Pro
Clover Shop Ultralite
Clover Shop Ultrapro
Comersus Cart
CometMall e-Store
Commerce.cgi
CommerceV3
CRE Loaded
CS-Cart shopping cart software
CubeCart
CyberOffice (CyberShop)
CyberStrong eShop
Dansie
digiSHOP
EasyCart
eCart Professional
Ecommerce Templates (ASP)
Ecommerce Templates (PHP)
Ecommercemax Online Retail Store
Edit-X Ecommerce
EROL
EShoppingPro
Evolve eCart
Evolve Merchant
Ezimerchant Professional
fipsShop light
Fortune3 E-Commerce Wizard
Free PayPal Shopping Cart
FreeWebshop.org
GetPaid
GoECart
Hassan Consulting’s Shopping Cart
Hazel Enterprise
Heavy Metal
iisCART2000
Interchange
IntLink E-commerce
Kickasp Delux Shopping Cart
KonaKart
LetMeShop
Lite Commerce
LoadedAU
Magento
MagicWay Shopping Cart
Mal’s e-commerce Shopping Cart
Mcart 2005
MetaCart e-Shop V-8
MetaCart Free
MetaCart2
MetaCart2 for SQL Server
Midicart ASP Complete
Midicart ASP Designer
Midicart ASP Plus
Midicart PHP
Midicart PHP Complete
Midicart PHP Designer
MiniShop
MIVA Merchant 5
MMK Cart Affiliate e-commerce Suite
Mountain Commerce
MX Kart
NOP’s Free Shopping Cart
OpenCart
oscMall
osCommerce
PayPal Shopping Cart
PDG Commerce
PDG Shopping Cart
PDshop Asp.Net Edition
PDshopPro Advanced
PDshopPro Plus
PDshopPro Standard
PepperCart
PepperCart Basic
PHP Shop
PHP Simple Shop
PHPBasket
phpCart
Pinnacle Cart
ProductCart
ProductCart Build To Order
Q-Shop Pro
Quick.Cart
QuickEStore
QuikStore
RealCart
SalesCart PRO
SearchFit
SecureNetShop
Shop a la Cart
ShopDotNet
Shopping Cart
Shop-Script FREE
Shop-Script PREMIUM
Shop-Script PRO
ShopSite
ShopZone Professional
SiteDirector
SoftSlate Commerce
Squirrelcart
StaticCart
SunShop
SurfShopPRO
TopShopper Classic
Tradingeye
Trolleyed Lite
uShop
uStorekeeper
VevoCart
ViArt Shop
ViArt Shop Free
VIP Cart
VP-ASP
Web+Shop
WebCart
WEBMASTERCART
WebStores 2000
X-Cart Gold
X-Cart Pro
XSE
Zen Cart
Topics: ecommerce hosting | 2 Comments »
