- Use It to manage your open/close status for your website .
- You can fix your start time for your website /open .
- You can fix your close time for your website /close .
- You can show the time which your website will be avaliable .
- it's easy for using .
download EasyCron :)
readme.txt
/************************************************************************
=========================================================
| @ Script Name : EasyCron
| @ Version : 1.0
| @ Description : Open and Close your website in fixed times .
| @ All rights reserved to : NaiF PHP
| @ Created In : 8-9-2006
| @ Support Site : http://www.naifphp.net
=========================================================
**************************************************************************/
# ABOUT THIS CLASS :
- Use It to manage your open/close status for your website .
- You can fix your start time for your website /open .
- You can fix your close time for your website /close .
- You can adding more hours for your website to open and close.
- You can show the time which your website will be avaliable .
- it's easy for using .
# ABOUT USING :
- go to make.php to make new cron
- include the EasyCron.php in your website header
- May you need to statement this folder 'easycron' (Chmod) the 777 .
# Notes :
- if you want to use EasyCron in another folder, just use
$obj->cron_path = "path/to/EasyCron";
then add :
include("path/to/easycron/example.php");
in the included page .
for example :
easycorn : "path/to/easycron/example.php"
add this line in example.php :
$obj->cron_path = "path/to/easycron";
you have another folder : "path/to/new_folder/index.php"
add this code in index.php for included cron page :
include("path/to/easycron/example.php");
thanks for you .
easycron.class.php
<?php
/****************************************************************************************
=========================================================================================
| @ Script Name : EasyCron
| @ Version : 1.0
| @ Description : Open and Close your website in fixed times .
| @ All rights reserved to : NaiF PHP
| @ Created In : 8-9-2006
| @ Support Site : http://www.naifphp.net
=========================================================================================
*****************************************************************************************/
class MyEasyCron
{
# Public #
// path to EasyCron.cron
var $cron_path = "./";
// Difference to Greenwich time (GMT) in hours
var $greenwich = "+3"; // 3 for ksa
// time now
var $TimeNow;
// Name's The Day's Weeks , week start with sunday
var $days_of_names = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// print my copyright with message close , default ( 1 : yes )
var $print_copyright = 1;
# Private #
// day name
var $day_name;
// hour start
var $start_time = 1;
// day number , default error number for day
var $day_number = -1;
//table setup
var $TableHtml;
// for view a 12 culomn
var $Tid = 0;
// table width
var $w_table = 90;
// rows
var $rows = 12;
// <td> width
var $w_td;
# To Show All Times , Convert Time and Author :)
function CronTable()
{
// header
$this->TableHtml = "<html dir=\"ltr\">\r\n\r\n<title> EasyCron 1.0 beta - naifphp </title>\n\r\n";
$this->TableHtml .= "<head>\r\n<script language=\"javascript\" src=\"./EasyCron.js\" type=\"text/javascript\"></script>\r\n</head>\r\n";
$this->TableHtml .= "\r\n<center>\r\n<h2> Please Select time Started Close and Started open site , Of Table :<BR></h2>\r\n</center>\r\n";
# to save copy of file created
function SaveCron($startClose,$startRun,$run_in="Every Days",$msgclose,$ViewStartRun,$yes=0)
{
$ShowStartRun = ($ViewStartRun) ? "Yes" : "No";
$msgclose = (empty($msgclose)) ? "sorry , but this site it's closed now ! " : $msgclose;
if($write_cron)
{
ECHO " The <b> EasyCron.cron </b> has created successfuly .";
return true;
}
else
{
ECHO "Sorry , But The File don't Create , please try again later . ";
return false;
}
}
# copy right
function ShowMyCopyRight()
{
$CopyRight .= "<hr><center><b><font face='Tahoma' size='2'>";
$CopyRight .= " EasyCron version: 1.0 beta , All rights reserved for : ";
$CopyRight .= " <a href='http://www.naifphp.net'>naifphp</a>";
$CopyRight .= "</font></b></center>\r\n\r\n</html>";
return ($CopyRight);
}
}
?>
admin.php
<?php
/****************************************************************************************
=========================================================================================
| @ Script Name : EasyCron
| @ Version : 1.0
| @ Description : Open and Close your website in fixed times .
| @ All rights reserved to : NaiF PHP
| @ Created In : 8-9-2006
| @ Support Site : http://www.naifphp.net
=========================================================================================
*****************************************************************************************/
C {5} # O {7} # L {Every Days} # M {sorry , but this site it's closed now ! } # V {Yes}
example.php
<?php
/****************************************************************************************
=========================================================================================
| @ Script Name : EasyCron
| @ Version : 1.0
| @ Description : Open and Close your website in fixed times .
| @ All rights reserved to : NaiF PHP
| @ Created In : 8-9-2006
| @ Support Site : http://www.naifphp.net
| @ file created in : 8-9-2006 4:44 AM
=========================================================================================
*****************************************************************************************/
/*
# Description This Example
Checks if return true => status = 'closed'
Else
return => 'value'
*/
include "easycron.class.php";
$EC = new MyEasyCron;
// you have to spicfy the EasyCron path
//$EC->cron_path = "c:/appserv/www/easycron";
$EC->ReadCron();
// if this easy corn didn't return true ,you will see this message
$Value = "<html>\n <head> <title> EasyCron Version 1.0 </title>\n\n </head>\n <body>";
$Value .= " <center> <h1> Example For Easy Cron Version 1.0 </h1> </center> ";
$Value . "</body>\n</html>";
echo $Value;
?>
EasyCron.js
/****************************************************************************************
=========================================================================================
| @ Script Name : EasyCorn
| @ Version : 1.0
| @ Description : Open and Close your website in fixed times .
| @ All rights reserved to : NaiF PHP
| @ Created In : 8-9-2006
| @ Support Site : http://www.naifphp.net
=========================================================================================
*****************************************************************************************/
function checker(fm)
{
if(fm.Cstart.value == "")
{
alert(" Please selected the time it started close !");
return false;
}
if(fm.Rstart.value == "")
{
alert(" Please selected the time it started open !");
return false;
}
}
function InsertTime(numbric) {
var STime = document.getElementById('s');
var ETime = document.getElementById('e');
var ETime2 = document.getElementById('Rstart');
var STime2 = document.getElementById('Cstart');
var resrt1 = document.getElementById('r1');
var resrt2 = document.getElementById('r2');
var WA1 = document.getElementById('whereadd1');
var WA2 = document.getElementById('whereadd2');
function resrt(x)
{
var STime = document.getElementById('s');
var ETime = document.getElementById('e');
var resrt1 = document.getElementById('r1');
var resrt2 = document.getElementById('r2');
var ETime2 = document.getElementById('Rstart');
var STime2 = document.getElementById('Cstart');