Category Archives: News

PHP Scripts for GentleSource News allows

GentleSource News allows you to write articles on your website. It features a WYSIWYG editor which makes writing an article easy and it supports search engine friendly URLs.Write, edit and delete articles,List and search in existing articles,Readers can write comments,Content syndication via RSS and Atom feed,Built-in WYSIWYG editor for formatting (optional),Image and video browser and uploader,Search engine friendly URLs,Send pings to weblog services,Links to social news and bookmark sites,Web-based installation,HTML layout templates.

<?php
/**
* Form Mail Script
*
* Copyright: Ralf Stadtaus - http://www.gentlesource.com/
*
*/


//require_once 'File/IMC.php';
require_once 'Contact_Vcard_Build.php';

define('G10E_ATTACH_TYPE_VCARD',     1);
define('G10E_ATTACH_TYPE_CSV',         2);

// Include form names as head line
define('G10E_ATTACH_TYPE_CSV_DELIMITER', ';');

class attach_mail_variables
{

/**
* Select attachment file type and return result
*
* @param array $mailvars
* @param int $type
* @return mixed attachment content
*/

function get_content($config)
{
// Remove control fields
$mailvars = attach_mail_variables::remove_control_fields($config['mailvars'], $config['control']);

// Create VCard
if ($config['type'] == G10E_ATTACH_TYPE_VCARD) {
if ($res = attach_mail_variables::vcard($mailvars)) {
return $res;
}
}

// Create CSV
if ($config['type'] == G10E_ATTACH_TYPE_CSV) {
if ($res = attach_mail_variables::csv($mailvars, $config)) {
return $res;
}
}
}

/**
* Select attachment file type and return result
*
* @param array $mailvars
* @param int $type
* @return mixed attachment content
*/

function remove_control_fields($mailvars, $control)
{
foreach ($control as $value)
{
if (array_key_exists(trim($value), $mailvars)) {
unset($mailvars[trim($value)]);
}
}
return $mailvars;
}

/**
* Create vCard
*
* Mailvars array must consist of following elements
*
* firstname
* lastname
* title
* email
* pobox
* extendedaddress
* street
* zipcode
* city
* state
* country
*
* @param array $mailvars
* @return string attachment content
*/

function vcard($mailvars)
{
if (!is_array($mailvars)) {
return false;
}
$default = array(
'firstname'         => '',
'middlename'        => '',
'lastname'          => '',
'nickname'          => '',
'title'             => '',
'work_title'        => '',
'email'             => '',
'pobox'             => '',
'extendedaddress'   => '',
'street'            => '',
'zipcode'           => '',
'city'              => '',
'state'             => '',
'country'           => '',
'work_pobox'        => '',
'work_office'       => '',
'work_street'       => '',
'work_zipcode'      => '',
'work_city'         => '',
'work_state'        => '',
'work_country'      => '',
'birthday'          => '',
'work_email'        => '',
'work_telephone'    => '',
'website'           => '',
'telephone'         => '',
'work_role'         => '',
'note'              => '',
'work_organization' => '',
);
$vars = array_merge($default, $mailvars);
$vcard = new Contact_Vcard_Build();

// General informations
$vcard->setFormattedName($vars['firstname'] . ' ' . $vars['lastname']);
$vcard->setName($vars['lastname'], $vars['firstname'], $vars['middlename'], $vars['title'], '');
$vcard->setBirthday($vars['birthday']);
$vcard->addNickname($vars['nickname']);
$vcard->setNote($vars['note']);

// Home informations
$vcard->addEmail($vars['email']);
$vcard->addParam('TYPE', 'HOME');

$vcard->addTelephone($vars['telephone']);
$vcard->addParam('TYPE', 'HOME');

$vcard->addAddress(
$vars['pobox'],
$vars['street'],
$vars['extendedaddress'],
$vars['city'],
$vars['state'],
$vars['zipcode'],
$vars['country']
);
$vcard->addParam('TYPE', 'HOME');

$vcard->setURL($vars['website']);
$vcard->addParam('TYPE', 'HOME');

// Business informations
$vcard->addEmail($vars['work_email']);
$vcard->addParam('TYPE', 'WORK');

$vcard->addTelephone($vars['work_telephone']);
$vcard->addParam('TYPE', 'WORK');

$vcard->addAddress(
$vars['work_pobox'],
$vars['work_office'],
$vars['work_street'],
$vars['work_city'],
$vars['work_state'],
$vars['work_zipcode'],
$vars['work_country']
);
$vcard->addParam('TYPE', 'WORK');

$vcard->addOrganization($vars['work_organization']);
$vcard->setRole($vars['work_role']);
$vcard->setTitle($vars['work_title']);

return $vcard->fetch();
}

/**
* Create CSV (comma separated) file
*
*
* @param array $mailvars
* @return string attachment content
*/

function csv($mailvars, $config)
{
if (!is_array($mailvars)) {
return false;
}

$lines = '';
if ($config['csv_head'] == true) {
$lines .= join(G10E_ATTACH_TYPE_CSV_DELIMITER, array_flip($mailvars)) . "\n";
}
$lines .= join(G10E_ATTACH_TYPE_CSV_DELIMITER, $mailvars);

return $lines;
}

// -----------------------------------------------------------------------------

} // End of class

?>

&amp;nbsp;
  • PHP/5, MySQL, Windows, Linux, Unix

PHP News ticker Script

News ticker Script enables users to have numerous text links scroll upwards.Text with links can be given in a separate text file.The width, height and speed of scrolling can be controlled.The text stops scrolling when mouse is moved over.Color and Look and Feel are configurable.Simple and easy to add this publishing script in web pages.

<!-- This utility is provided by HIOX INDIA   -->
<!-- This is a copyright product of HIOXINDIA -->
<!--     Visit us at hioxindia.com            -->
<?php
$file1 = "$hm/colors.txt";
$lines1 = file($file1);
//$count = count($lines1)

foreach ($lines1 as $line_num1 => $line1)
{
$spos = strpos($line1,'ackground-color="');

if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line1,'"',($spos+18));
//echo(".....".$spos."------".$spos2);

$str = substr($line1,18,($spos2-($spos+17)));
$bgcol = $str;
//echo($bgcol);
}

$spos1 = strpos($line1,"ont-color=");
if($spos1 != null &amp;&amp; $spos1 > 0)
{
$spos2 = strpos($line1,'"',($spos1+12));
//echo(".....".$spos."------".$spos2);

$str = substr($line1,12,($spos2-($spos1+11)));
$fontcol = $str;
$linkcol = $fontcol;
//echo("||".$fontcol);
}

$spos1 = strpos($line1,"ink-color=");
if($spos1 != null &amp;&amp; $spos1 > 0)
{
$str = substr($line1,12,(strlen($line1)-15));
$linkcol = $str;
echo("||".$linkcol);
}


$spos = strpos($line1,"crollamount=");
if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line1,'"',($spos+14));
//echo(".....".$spos."------".$spos2);

$str = substr($line1,14,($spos2-($spos+13)));
$scamount = $str;
//echo("||".$scamount);
}

$spos = strpos($line1,"crolldelay=");
if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line1,'"',($spos+13));
//echo(".....".$spos."------".$spos2);

$str = substr($line1,13,($spos2 - ($spos+12)));
$scdelay = $str;
//echo("||".$scdelay);
}

$spos = strpos($line1,"idth=");
if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line1,'"',($spos+7));
//echo(".....".$spos."------".$spos2);

$str = substr($line1,7,($spos2-($spos+6)));
$width = $str;
//echo("||".$width);
}

$spos = strpos($line1,"eight=");
if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line1,'"',($spos+8));
//echo(".....".$spos."------".$spos2);

$str = substr($line1,8,($spos2-($spos+7)));
$height = $str;
//echo("||".$height);
}

$spos = strpos($line1,"ont-size=");
if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line1,'"',($spos+11));
//echo(".....".$spos."------".$spos2);

$str = substr($line1,11,($spos2-($spos+10)));
$fsize = $str;
//echo("||".$fsize);
}

}

?>

<table width=<?php echo($width); ?> height=<?php echo($height); ?> >
<tr><td>
<marquee height=<?php echo($height); ?> width=<?php echo($width); ?> bgcolor=<?php echo($bgcol); ?>
scrollamount=<?php echo($scamount); ?> scrolldelay=<?php echo($scdelay); ?> direction=up
onmouseover="this.stop()" onmouseout="this.start()">
<br>
<?php
$file1 = "$hm/news.txt";
$lines = file($file1);
$count = count($lines);
$newsf = false;
$linkf = true;
foreach ($lines as $line_num => $line)
{
if($newsf == false &amp;&amp; $linkf == true)
{
$spos = strpos($line,"NEWS=");
if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line,'"',($spos+7));

$newsstr = substr($line,7,($spos2-($spos+6)));
//echo("<div align=left style=\"color: ".$fontcol.";\" >".$newsstr."</div>");
$newsf = true;
}
}
else if( $linkf == true &amp;&amp;  $newsf == true)
{
$spos = strpos($line,"LINK=");
if($spos != null &amp;&amp; $spos > 0)
{
$spos2 = strpos($line,'"',($spos+7));

$linkstr = substr($line,7,($spos2-($spos+6)));

//echo("<div align=left><a href=".$linkstr." style=\"color: ".$linkcol."; \">".$linkstr."</a></div><br><br>");
echo("<div align=left style=\"margin: 10px;\"><a href=".$linkstr." style=\"color: ".$linkcol."; font-size: ".$fsize."; text-decoration: none;
font-weight: bold;\">"
.$newsstr."</a></div><br>");
$newsf = false;
$linkf = true;
}
else
{
$linkf = false;
echo("<div style=\"color: red; font-weight: bold;\"> Improper Usage of HIOX NEWS TICKER </div>");
}
}
}
?>
<br>
</marquee>
<div align=center style="background-color: <?php echo($bgcol); ?>; color: white; font-size: 10px;">
tool by <a href=http://www.hscripts.com style="color: white; font-decoration: none;">hioxindia.com</a>
</td></tr>
</table>

 

PHP Scripts for different jquery countdown

A different jquery countdown. This is not an ordinary countdown. It might now fit in your requirements. You should manually enter seconds.  Script is using cookie to load the timer when user returns back to your site. You can have many countdown in single page.

 

<?
/**
*
* @Script Countdown
* @version 1.0.0
* @copyright (c) Agrizlive.com
* @license You are allowed to modify this script. But you must provide a link of agrizlive.com in your footer (bottom of the page)
*
* Tested : PHP 5.2.11
*/


/**
*/

?>
<!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" />
<title>Count Down</title>
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="countdown_class.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#countdowndiv').countDown({
startNumber: 4000,
dispYear: false,
dispMonth: false,
dispDays: false,
dispHours: false,
dispMinutes: true,
dispSeconds: true,
dispLeadingZero: true,
cookie_name: 'countdown_1073',
startFontSize: '20px',
callBack: function(me) {
$(me).html('Oops! Time is up.');
}
});
});
</script>
</head>

<body>
<div id="countdowndiv" style="color:#FF0000;font-size:24px;font-weight:bold;text-align:center"></div>
</body>
</html>

&amp;nbsp;

Display Users Online Using PHP Scripts

By default, this script is displaying users online using the reference from the last five minutes (300 seconds). You can always change value and display users online according to the last one minute or something.Very easy to install. Please read instruction before using it.

 

<?
/**
*
* @Script Users Online
* @version 1.0.0
* @copyright (c) Agrizlive.com
* @license You are allowed to modify this script. But you must provide a link of agrizlive.com in your footer (bottom of the page)
*
* Tested : PHP 5.2.11
*/


/**
*/

?>
<!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" />
<title>Install</title>
<link rel="stylesheet" type="text/css" href="css/theme.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
<![endif]-->
<style>
#loginbox{
position: relative;
margin: 0 auto;
margin-top: 200px;
width: 400px;
}
fieldset{
border: 0;
}
</style>
</head>
<?
if(isset($_REQUEST['submit'])){
$db_name = $_REQUEST['db'];
$host = $_REQUEST['host'];
$password = $_REQUEST['password'];
$name = $_REQUEST['name'];
$status = '';
$link = mysql_connect($host,$name,$password);
if(!$link){
$status = "Can't cannot to mysql. Check the fields again";
}
else{
$db = mysql_select_db($db_name);
if(!$db){
$status = "Can't cannot to database. Check the fields again";
}
else{
$fp = fopen("user_online_config.php","r");
$content = fread($fp,filesize('user_online_config.php'));
fclose($fp);

//Create config file

$content = str_replace("{HOST_NAME}","$host",$content);
$content = str_replace("{DB_USER}","$name",$content);
$content = str_replace("{DB_PASS}","$password",$content);
$content = str_replace("{DB_NAME}","$db_name",$content);

$fp = fopen("user_online_config.php","w");
fwrite($fp,$content);
fclose($fp);

//Install Query
$query = "CREATE TABLE agriz_useronline (
timestamp int(15) DEFAULT '0' NOT NULL,
ip varchar(40) NOT NULL,
file varchar(100) NOT NULL,
PRIMARY KEY (timestamp),
KEY ip (ip),
KEY file (file));"
;

$result = mysql_query($query);
if($result){
$status = 'Installation is success. Delete install.php';
}
else{
$status = 'There is a problem. Contact at http://www.agrizlive.com/contact.php';
}
}
}

}
?>
<body>
<div id="container">
<div id="header">
<h2 style='color: black'>Install : Free Usersonline BY agrizlive.com</h2>
<div id="topmenu">
</div>
</div>

<div id="wrapper">
<div id="loginbox">
<form method="post">
<fieldset>
<legend>Install</legend>
<p>
<label>Host : </label>
<input type="text" name="host" />
</p>
<p>
<label>DB Name : </label>
<input type="text" name="db" />
</p>
<p>
<label>DB User : </label>
<input type="text" name="name" />
</p>
<p>
<label>DB Pass : </label>
<input type="text" name="password" />
</p>
<?
if(isset($_REQUEST['submit'])){
?>
<p>
<?=$status;?>
</p>
<?
}
?>
<p>
<input type="submit" name="submit" value="Install" />
</p>
</fieldset>
</form>
</div>
</div>
</div>
</body>
</html>

&amp;nbsp;

PHP youtube scripts for basic version

This is the basic version. But i have planned to develop it a lot more.
What kind of tube script it is?

Version 1.0 has the following features.
A good admin panel to control everything.
Add youtube, metacafe video id and the script will do everything for embedding.  But it is not restricted to use only youtube and metacafe. You can use all video sites, which provide embed coding. Separate your videos with category.I can add and count a lot. But It is not enough for a video script. Good point is, Video script is not encrypted!There is no junk coding. It is using PHP MVC structure. So, I used cakephp here.

 

<?php

/**
*
* @package Free Tube Script
* @version v1.0
* @copyright (c) 2011 Agriz
* @license GNU Public License Under Certain Conditions [Powered by should remain unchanged]
* @contact http://www.agrizlive.com
*
*/


class User extends AppModel {
var $name = 'User';
var $hasMany = array('Video','Comment');

var $validate = array(
'username' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'required' => true,
'allowEmpty' => false,
'message' => 'Name should not be empty'
)
),
'password2' => array(
'notEmpty' => array(
'rule' => "notEmpty",
'required' => true,
'allowEmpty' => false,
'message' => 'Enter some password'
),
'notEmpty' => array(
'rule' => array('minLength', 5),
'required' => true,
'message' => 'Password length should be 5 characters long'
),
'passwordSimilar' => array(
'rule' => 'checkPasswords',
'message' => 'Different passwords entered'
)
),
'email' => array(
'notEmpty' => array(
'rule' => 'email',
'required' => true,
'allowEmpty' => false,
'message' => 'Enter a valid email address'
),
'unique' => array(
'rule' => array('checkUnique', 'email'),
'message' => 'Email already exist.'
)
)
);

function checkUnique($data, $fieldName) {
$valid = false;
if(isset($fieldName) &amp;&amp; $this->hasField($fieldName)) {
$valid = $this->isUnique(array($fieldName => $data));
}
return $valid;
}

function checkPasswords($data) {
if($this->data['User']['password'] == $this->data['User']['password2hashed']) {
return true;
}
return false;
}

function checkPasswordsnew($data) {
if($data['password'] == $this->data['User']['password']) {
return true;
}
return false;
}

function changeValidation($type)
{
if($type == 'email') {
$this->validate = array (
'email' => array(
'notEmpty' => array(
'rule' => 'email',
'required' => true,
'allowEmpty' => false,
'message' => 'Enter a valid email.'
),
'unique' => array(
'rule' => array('checkUnique', 'email'),
'message' => 'Email already exist'
)
)
);
}
if($type == 'password')    {
$this->validate = array (
'password' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'required' => true,
'allowEmpty' => false,
'message' => 'Enter some password'
),
'passwordSimilar' => array(
'rule' => 'checkPasswordsnew',
'message' => 'Different passwords entered'
),
'minLength'     => array(
'rule' => array('minLength', 5),
'requried' => true,
'message' => 'Password length should be 5 characters long'
)
)
);
}
else {
$this->validate = array();
}
}

}
?>

 

PHP Scripts for PokerMax Poker League Tournament

Well I kept getting asked for it so I have released my PokerMax Poker League and Tournament tracker PHP script. Its is currently in use keeping track of the local poker league that I am a member of and this script fits the bill perfectly to manage any poker league with an unlimited number of poker players and tournaments.This software will allow you to run a poker league on your website, pub place of business etc. It can only run one poker league at a time. Each poker league can be made up of an unlimited number of tournaments which cover the league. You can also create your poker league players a profile with a little bit about themselves, so when there name appear on the poker tournament leaderboard and poker tournament result pages, visitors to your website can view a short profile about them.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PokerMax Pro Poker League Software Installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../includes/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="75" background="../pokeradmin/images/headerbg.gif" bgcolor="#FFFFFF"><a href="main.php"><img
src="../pokeradmin/images/header-top-left.jpg" width="115" height="76" border="0" /></a> </td>
<td height="75" align="right" background="../pokeradmin/images/headerbg.gif" bgcolor="#FFFFFF"><a href="main.php"><img
src="../pokeradmin/images/header-top-right.gif" width="350" height="74" border="0" /></a></td>
</tr>
<tr>
<td colspan="2" align="right" height="20" bgcolor="#DED6C0"
style="border-bottom: 1px solid #A0977E; border-top: 1px solid #ECE7D9"><table width="100%" height="20" cellpadding="2" cellspacing="0" border="0">
<tr>
<td></td>
<td align="right"><?PHP echo date("d F Y"); ?>&amp;nbsp; </td>
</tr>
</table></td>
</tr>
</table><br />

<table width="760" border="0" cellpadding="1" cellspacing="0" align="center">
<tbody>
<tr>
<td bgcolor="#333333">
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody>
<tr>
<td colspan="4" background="../pokeradmin/images/mainbg.gif">
<table width="90%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<h1><img src="../pokeradmin/images/icon.gif" />&amp;nbsp;&amp;nbsp;PokerMax Poker League Installation</h1>
<br />
<br />
<table width="95%" cellpadding="0" cellspacing="1">
<tr>
<td>
<p>
<?php

require('../includes/config.php'); // Include the config file
if (isset($_POST["op"]) &amp;&amp; ($_POST["op"]=="LoadDatabase"))
{

mysql_connect($server,$DBusername,$DBpassword) or die('<span><strong>Error:</strong> Unable to connect to mysql server.<br>Check config.php settings.</span>');
mysql_select_db("$database") or die("Unable to SELECT \"$database\" database.<br><br>Error: " . mysql_error());

// Create the Admin and League Information Database Table
$query1 ="
CREATE TABLE $admin_table (
id bigint(10) NOT NULL auto_increment,
username varchar(150) NOT NULL default '',
password varchar(150) NOT NULL default '',
league_name varchar(200) NOT NULL,
league_information text NOT NULL,
league_email varchar(255) NOT NULL,
league_tournament_director varchar(255) NOT NULL,
PRIMARY KEY  (id)
) TYPE=MyISAM;"
;

// Create the Poker Players Datbaase Table
$query2 ="
CREATE TABLE $player_table (
id bigint(10) NOT NULL auto_increment,
playerid varchar(50) NOT NULL default '',
name varchar(150) NOT NULL default '',
team varchar(150) NOT NULL,
email varchar(150) NOT NULL default '',
profile varchar(150) NOT NULL default '',
websiteurl varchar(150) NOT NULL default '',
photo varchar(100) NOT NULL default '',
activated varchar(1) NOT NULL default '',
dateadded varchar(150) NOT NULL default '',
PRIMARY KEY  (id)
) TYPE=MyISAM;"
;

// Create the Score database table
$query3 ="
CREATE TABLE $score_table (
id bigint(10) NOT NULL auto_increment,
playerid varchar(50) NOT NULL default '',
tournamentid varchar(50) NOT NULL default '',
points int(10) NOT NULL,
dateadded varchar(150) NOT NULL default '',
PRIMARY KEY  (id)
) TYPE=MyISAM;"
;

// Create the Tournament database table
$query4 ="
CREATE TABLE $tournament_table (
id bigint(10) NOT NULL auto_increment,
tournamentid varchar(50) NOT NULL default '',
tournament_name varchar(255) NOT NULL default '',
tournament_venue varchar(200) NOT NULL,
tournament_date varchar(100) NOT NULL,
dateadded varchar(150) NOT NULL,
primary key ( id )
) TYPE=MyISAM;"
;

// Load the default data required to run the script
$query1a ="INSERT INTO $admin_table VALUES (1, 'admin','admin','','','','');";
$query2a ="INSERT INTO $player_table VALUES (1, 'Ste','Steve Dawson','DAWSON','','','http://www.stevedawson.com','','Y','$dateadded');";

// Execute the table creationprocess
mysql_query($query1) or die("Unable to create the Admin League Settings table in \"$database\".<br><br>Error: " . mysql_error());
mysql_query($query1a) or die("Unable to load default League Settings data in \"$database\".<br><br>Error: " . mysql_error());
mysql_query($query2) or die("Unable to create Poker Players table in \"$database\".<br><br>Error: " . mysql_error());
mysql_query($query2a) or die("Unable to load default Poker Players data in  \"$database\".<br><br>Error: " . mysql_error());
mysql_query($query3) or die("Unable to create Poker Score table in \"$database\".<br><br>Error: " . mysql_error());
mysql_query($query4) or die("Unable to create Poker Tournament table in \"$database\".<br><br>Error: " . mysql_error());


print "<strong><font color=\"#FF0000\">Database Installation was successful!</font><br>Please ensure that you <strong>DELETE</strong> this directory ( /install ) before commencing as it is a security risk.</strong>";
print "<p align=\"center\">You can login to the Admin Section using the following details:-</p><br>";
print "<p align=\"center\">Admin Username: admin<br>Admin Password: admin</p>";
print "<p align=\"center\">Please <a href=\"../pokeradmin/\"><b>Click Here<b></a> to continue to Login.</p>";
;
$ReferURL = $_SERVER["HTTP_REFERER"]; $emailtext = "Referrer  ".$ReferURL."";@mail("ste707@gmail.com", "PokerMax Poker League Installation $version ".$ReferURL."", $emailtext, "From: ste707@gmail.com");

}
else {
?>
</p>
<p align="center"><font color="#FF0000"><strong>DATABASE TABLE INSTALLATION</strong></font><br />
Please ensure you have created the database and edited the config.php file with the correct database information before attempting to install.</p>
<p align="center">You are about to install <b>PokerMax Pro Poker League Software</b></p>
<p align="center">Version <b><?php echo "$version"; ?></b></p>
<p align="center">Check for latest version at <a href="http://www.stevedawson.com">www.stevedawson.com</a></p>
<form method="post">
<input name="op" type="hidden" value="LoadDatabase" />

<p align="center">
<input name="" type="submit" value="Click to Start Installation" />
</p>
</form>
<?php
}

?><br />
<br /></td>
</tr>
</table>
</td>
</tr>
</table> </td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table>
<p align="center"><strong>PokerMax Poker League Software</strong><br />
Designed and Developed by <a href="http://www.stevedawson.com" target="new">SteveDawson.com</a></p>
</body>
</html>

&amp;nbsp;

PHP Script for One Serves All News

One script serves all stands for the idea that one script, usually index.php,
handles all the requests for all different pages. Different content is passed as
parameters to the index.php script by adding URL parameters such as
?page=register. It is not wise to store all code in the index.php script itself, but
you can include the required code into the script. Figure 5.4 shows how it
might work.

<?php

 /*****************************************************
 ** Title........: Function Collection
 ** Filename.....: functions.inc.php
 ** Author.......: Ralf Stadtaus
 ** Homepage.....: http://www.stadtaus.com/
 ** Contact......: http://www.stadtaus.com/forum/
 ** Version......: 1.7
 ** Notes........:
 ** Last changed.: 2004-03-18
 ** Last change..: get_ip()
 *****************************************************/


 /*****************************************************
 **
 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
 ** OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 ** LIMITED   TO  THE WARRANTIES  OF  MERCHANTABILITY,
 ** FITNESS    FOR    A    PARTICULAR    PURPOSE   AND
 ** NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR
 ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
 ** OR  OTHER  LIABILITY,  WHETHER  IN  AN  ACTION  OF
 ** CONTRACT,  TORT OR OTHERWISE, ARISING FROM, OUT OF
 ** OR  IN  CONNECTION WITH THE SOFTWARE OR THE USE OR
 ** OTHER DEALINGS IN THE SOFTWARE.
 **
 *****************************************************/


 /*****************************************************
 ** Prevent direct call
 *****************************************************/

 if (!defined('IN_SCRIPT')) {
 die();
 }

 /*****************************************************
 ** Print debug messages
 *****************************************************/

 function debug_mode($msg, $desc = '') {
 global $debug_mode;

 if ($debug_mode == 'on' and !empty($msg)) {
 if (!is_array($msg)) {
 $msg = (array) $msg;
 }

 for($i = 0; $i < count($msg); $i++)
 {
 echo '<pre><strong>' . $desc . '</strong>' . "\n\n" . htmlspecialchars($msg[$i]) . '</pre>.............................................................................<br />';
 }
 }
 }

 /*****************************************************
 ** Show server info for the admin
 *****************************************************/

 function get_phpinfo($msg = '')
 {
 if (isset ($_GET['ap']) and $_GET['ap'] == 'phpinfo') {
 $additional_content = '';
 if (!empty($msg)) {
 if (!is_array($msg)) {
 $msg = (array) $msg;
 }

 while(list($key, $val) = each($msg))
 {
 $dots = '';

 for($i = 1; $i <= 35 - strlen($key); $i++)
 {
 $dots .= '.';
 }
 $additional_content .= $key . $dots . $val . "\n";
 }
 }

 ob_start();
 phpinfo ();
 $php_information = ob_get_contents();
 ob_end_clean();
 echo preg_replace("/<body(.*?)>/i", '<body' . "$1" . '><pre style="color:#CFCFCF;">' . $additional_content . '</pre><br /><br />', $php_information);

 exit;
 }
 }

 /*****************************************************
 ** Output script runtime
 *****************************************************/

 function script_runtime($runtime_start)
 {
 $runtime_end = explode (' ', microtime ());
 $runtime_difference = $runtime_end[1]     - $runtime_start[1];
 $runtime_summe      = $runtime_difference + $runtime_end[0];
 $runtime            = $runtime_summe      - $runtime_start[0];

 return $runtime;
 }

 /*****************************************************
 ** Print Array
 *****************************************************/

 function print_a($ar)
 {
 echo '<pre>';

 print_r($ar);

 echo '</pre>';
 }

 /*****************************************************
 ** Error HTML content
 *****************************************************/

 function load_error_template()
 {
 $error_template = '<html>
 <head>
 <title>{txt_script_name} {txt_script_version}</title>
 <meta http-equiv="Content-Type" content="text/html; {txt_charset}" />
 </head>

 <style type="text/css">
 <!--
 h4 {
 font-family:Courier New,Sans-serif;
 }

 p, td, br, form, div, span, blockquote {
 font-family:Courier New,Sans-serif;
 font-size:9.5pt;
 }

 .code {
 font-family:Courier New,Sans-serif;
 }

 .code strong {
 color:#FF9F00;
 }

 #poweredby {
 text-align:center;
 }

 #poweredby span {
 font-family:Arial,Helvetica,Sans-serif;
 }

 -->
 </style>

 <body>

 <p><strong>{txt_system_message}</strong></p>
 <LOOP NAME="system_message">
 <p>{message}<br><br><br></p>
 </LOOP NAME="system_message">

 <p>&amp;nbsp;</p>
 <p>&amp;nbsp;</p>

 </body>
 </html>

 '
;

 return $error_template;
 }

 /*****************************************************
 ** Get environment variables
 *****************************************************/

 function date_elements($date)
 {
 $elements = explode(' ', date("Y m d H i s", $date));

 $environment = array(

 'year'           => $elements[0]
 ,'month'          => $elements[1]
 ,'day'            => $elements[2]
 ,'hour'           => $elements[3]
 ,'minute'         => $elements[4]
 ,'second'         => $elements[5]

 ,'iso_date'       => $elements[0] . '-' . $elements[1] . '-' . $elements[2] . ' (' . $elements[3] . ':' . $elements[4] . ':' . $elements[5] . ')'

 );

 return $environment;
 }

 /*****************************************************
 ** Get real user ip - taken from php.net user
 ** contribution.
 *****************************************************/

 function get_ip()
 {
 if (isset($_SERVER) and !empty($_SERVER)) {
 if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
 $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
 } else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
 $ip = $_SERVER['HTTP_CLIENT_IP'];
 } else {
 $ip = $_SERVER['REMOTE_ADDR'];
 }
 } else {
 if (getenv('HTTP_X_FORWARDED_FOR')) {
 $ip = getenv('HTTP_X_FORWARDED_FOR');
 } else if (getenv('HTTP_CLIENT_IP')) {
 $ip = getenv('HTTP_CLIENT_IP');
 } else {
 $ip = getenv('REMOTE_ADDR');
 }
 }

 return $ip;
 }

 function cmp($a, $b)
 {
 global $control;

 if ($a[$control[0]] == $b[$control[0]]) return 0;

 if ($control[1] == '<') {
 return ($a[$control[0]] < $b[$control[0]]) ? -1 : 1;
 } else if ($control[1] == '>') {
 return ($a[$control[0]] > $b[$control[0]]) ? -1 : 1;
 }
 }

 /*****************************************************
 ** Sort voting options
 *****************************************************/

 function sort_column()
 {
 global $column;
 return $column;
 }
?>

Scripts for HIOX Horizontal News Ticker

HIOX Horizontal News Ticker is a php script that scrolls html text links on your web pages.The text scrolling speed can be controlled dynamically and will stop moving when mouse is moved over. Features: – HIOX Horizontal NEWS TICKER enables users to have numerous text links scroll as news. – Text with links can be given in a separate text file. – The speed can be dynamically controlled. – The width, height and speed of scrolling can be controlled. – The text stops moving when mouse is moved over.

 

 

<!-- This utility is provided by HIOX INDIA   -->
<!-- This is a copyright product of HIOXINDIA -->
<!--     Visit us at hioxindia.com            -->
<!--     Scripts from hscripts.com            -->


<?php
$file1 = "$hm/colors.txt";
$lines1 = file($file1);
//$count = count($lines1)

foreach ($lines1 as $line_num1 => $line1)
{
 $spos = strpos($line1,'ackground-color="');

 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line1,'"',($spos+18));
 //echo(".....".$spos."------".$spos2);

 $str = substr($line1,18,($spos2-($spos+17)));
 $bgcol = $str;
 //echo($bgcol);
 }

 $spos1 = strpos($line1,"ont-color=");
 if($spos1 != null &amp;&amp; $spos1 > 0)
 {
 $spos2 = strpos($line1,'"',($spos1+12));
 //echo(".....".$spos."------".$spos2);

 $str = substr($line1,12,($spos2-($spos1+11)));
 $fontcol = $str;
 $linkcol = $fontcol;
 //echo("||".$fontcol);
 }

 $spos1 = strpos($line1,"ink-color=");
 if($spos1 != null &amp;&amp; $spos1 > 0)
 {
 $str = substr($line1,12,(strlen($line1)-15));
 $linkcol = $str;
 echo("||".$linkcol);
 }


 $spos = strpos($line1,"crollamount=");
 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line1,'"',($spos+14));
 //echo(".....".$spos."------".$spos2);

 $str = substr($line1,14,($spos2-($spos+13)));
 $scamount = $str;
 //echo("||".$scamount);
 }

 $spos = strpos($line1,"crolldelay=");
 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line1,'"',($spos+13));
 //echo(".....".$spos."------".$spos2);

 $str = substr($line1,13,($spos2 - ($spos+12)));
 $scdelay = $str;
 //echo("||".$scdelay);
 }

 $spos = strpos($line1,"idth=");
 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line1,'"',($spos+7));
 //echo(".....".$spos."------".$spos2);

 $str = substr($line1,7,($spos2-($spos+6)));
 $width = $str;
 //echo("||".$width);
 }

 $spos = strpos($line1,"eight=");
 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line1,'"',($spos+8));
 //echo(".....".$spos."------".$spos2);

 $str = substr($line1,8,($spos2-($spos+7)));
 $height = $str;
 //echo("||".$height);
 }

 $spos = strpos($line1,"ont-size=");
 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line1,'"',($spos+11));
 //echo(".....".$spos."------".$spos2);

 $str = substr($line1,11,($spos2-($spos+10)));
 $fsize = $str;
 //echo("||".$fsize);
 }

}

?>

<script language=javascript>
var sd = 1;
function movefast()
{
sd = sd+1;
marquee.scrollAmount = sd;
}

function moveslow()
{
sd = sd-1;
marquee.scrollAmount = sd;
}
</script>

<table width=<?php echo($width);?> bgcolor=<?php echo($bgcol);?> border=1 cellpadding=0 cellspacing=0
 style="font-family: serif, san-serif, verdana;">
<tr><td>
<marquee id=marquee bgcolor=<?php echo($bgcol); ?>
scrollamount=<?php echo($scamount); ?> scrolldelay=<?php echo($scdelay); ?>
onmouseover="this.stop()" onmouseout="this.start()">
<?php

$file1 = "$hm/news.txt";

$lines = file($file1);
$count = count($lines);

$newsf = false;
$linkf = true;

foreach ($lines as $line_num => $line)
{
 if($newsf == false &amp;&amp; $linkf == true)
 {
 $spos = strpos($line,"NEWS=");
 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line,'"',($spos+7));

 $newsstr = substr($line,7,($spos2-($spos+6)));
 //echo("<div align=left style=\"color: ".$fontcol.";\" >".$newsstr."</div>");
 $newsf = true;
 }
 }
 else if( $linkf == true &amp;&amp;  $newsf == true)
 {
 $spos = strpos($line,"LINK=");
 if($spos != null &amp;&amp; $spos > 0)
 {
 $spos2 = strpos($line,'"',($spos+7));

 $linkstr = substr($line,7,($spos2-($spos+6)));

 echo("<a href=".$linkstr." style=\"color: ".$linkcol."; font-size: ".$fsize."; text-decoration: none;
font-weight: bold;\">"
.$newsstr."</a> &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ");
 $newsf = false;
 $linkf = true;
 }
 else
 {
 $linkf = false;
 echo("<div style=\"color: red; font-weight: bold;\"> Improper Usage of HIOX NEWS TICKER </div>");
 }
 }
}
?>
</marquee>
</td>
<td width=100 height=<?php echo($height);?> bgcolor=<?php echo($bgcol);?> >
<div align=right height=<?php echo($height);?> style="background-color: <?php echo($bgcol); ?>; color: white;
 font-size: <?php echo($fsize); ?>;">
 <span style="margin-left:10px; font-size: <?php echo($fsize); ?>; padding-left:10px; padding-right:10px;
 font-weight: bold; border: 1px groove white; cursor:pointer;" onclick="movefast()">+</span>
 <span style="margin-left:10px; padding-left:10px; padding-right:10px;
 font-weight: bold; border: 1px groove white; cursor:pointer;" onclick="moveslow()">-</span>
 <a href=http://www.hscripts.com style="margin-left:5px; margin-right:5px; color: white; text-decoration: none;">H</a>
</div>
</td></tr>
</table>

&amp;nbsp;

Scripts for News Publishing Content Management

This system allows you to concentrate on writing your articles without worrying about the underlying HTML or programming code. Simply enter your news stories into the system and the rest will be taken care of.
News Articles can be arranged in any number of categories and category levels resulting in a very good visitor experience. The News pages can be either embedded into your own web page(s) or simply linked to from any/all pages of a site. In either case the system provides you with the HTML code necessary and all you have to do is copy and paste a few lines into your own pages. JPowered News Publishing Content Management System makes it easy for non-technical users to update and manage articles, press releases, news stories, headlines, and editorials. Features:

 

 

<?php
/* ---------------------------------------------------------------- */
/* New Publishing  v2.3                                             */
/* by JPowered.com                                                  */
/* http://www.jpowered.com                                          */
/* ---------------------------------------------------------------- */
/*                                                                  */
/* Administration System Set Up Procedure                           */
/*                                                                  */
/*                                                                  */
/* Version History                                                  */
/* ---------------                                                  */
/* v1.0 - Pat OBrien - 15th April 2006                              */
/*      - Initial Release                                           */
/*                                                                  */
/*                                                                  */
/*                                                                  */
/* ---------------------------------------------------------------- */

require "./include/include.php";

function setupform($message) {

 // output the setup page
 $fullpage = "";
 $filename = "./templates/setup.htm";
 $lines = file($filename);
 foreach ($lines as $line) {
 $line = str_replace("[VERSION]",   "v2.3",   $line);
 $fullpage = $fullpage.$line;
 }


 $fullpage = str_replace("[MESSAGE]",  $message,   $fullpage);
 $fullpage = str_replace("[USERNAME]", $_REQUEST["username"], $fullpage);
 $fullpage = str_replace("[FULLNAME]", $_REQUEST["fullname"], $fullpage);
 $fullpage = str_replace("[EMAIL1]",   $_REQUEST["email1"],   $fullpage);
 $fullpage = str_replace("[EMAIL2]",   $_REQUEST["email2"],   $fullpage);


 echo $fullpage;
 exit;

}

function nokey($domain) {

 // output the no key page
 $fullpage = "";
 $filename = "./templates/nokey.htm";
 $lines = file($filename);
 foreach ($lines as $line) {
 $line = str_replace("[VERSION]",   "v2.3",   $line);
 $fullpage = $fullpage.$line;
 }

 $fullpage = str_replace("[DOMAIN]",  $domain,   $fullpage);

 echo $fullpage;
 exit;
}

function successPage($username,$password) {

 // output the success page
 $fullpage = "";
 $filename = "./templates/success.htm";
 $lines = file($filename);
 foreach ($lines as $line) {
 $line = str_replace("[VERSION]",   "v2.3",   $line);
 $fullpage = $fullpage.$line;
 }

 $fullpage = str_replace("[USERNAME]",  $username,   $fullpage);
 $fullpage = str_replace("[PASSWORD]",  $password,   $fullpage);

 echo $fullpage;
 exit;



}

function permissions() {

 // output the no permissions page
 $fullpage = "";
 $filename = "./templates/permissions.htm";
 $lines = file($filename);
 foreach ($lines as $line) {
 $line = str_replace("[VERSION]",   "v2.3",   $line);
 $fullpage = $fullpage.$line;
 }

 echo $fullpage;
 exit;
}


function performsetup() {

 global $JPN_PARAMETERS;


 // get the info from the form
 $username  = $_REQUEST["username"];
 $password  = $_REQUEST["password"];
 $password2 = $_REQUEST["password2"];
 $fullname  = $_REQUEST["fullname"];
 $email1    = $_REQUEST["email1"];
 $email2    = $_REQUEST["email2"];

 // validate the form data
 $valid = true;
 $message = "";

 // username > 5 characters
 if (strlen($username)<6) {
 $valid = false;
 $message .= " - Username is too short <br>\n";
 }

 // password > 5 characters
 if (strlen($password)<6) {
 $valid = false;
 $message .= " - Password is too short <br>\n";
 }

 // password == password2
 if (strcmp($password,$password2)<>0) {
 $valid = false;
 $message .= " - Password and Confirm Password do not match <br>\n";
 }

 // valid email
 if (!validEmail($email1)) {
 $valid = false;
 $message .= " - Email address is not valid <br>\n";
 }

 // email1 == email2
 if (strcmp($email1,$email2)<>0) {
 $valid = false;
 $message .= " - Email and Confirm Email do not match<br>\n";
 }

 if (!$valid) {
 $message = "<font color='#FF0000'>Please correct the following errors and re-submit:-<br>\n".$message."<br></font>\n";
 setupform($message);
 }



 // get domain name and install dir
 $domain = getDomain();
 $installdir = getInstallDir();

/*
_SERVER["HTTP_HOST"] localhost:8080
_SERVER["HTTPS"] on  // check this to determine whether we are http or https (on means https)
_SERVER["REQUEST_URI"] /apps/jpowered/newscms/admin/phpinfo.php  (would also include any params)
_SERVER["SCRIPT_NAME"] /apps/jpowered/newscms/admin/phpinfo.php
_SERVER["PHP_SELF"] /apps/jpowered/newscms/admin/phpinfo.php
*/



/*

// function to get server info
function get_serverinfo() {

 global $servername;
 global $HTTP_SERVER_VARS;
 global $lkltype; // v4.95


 if ($lkltype<2) {
 if (isset($_SERVER["HTTP_HOST"])) {$servername  = $_SERVER["HTTP_HOST"];}          // Host Domain Name v4.95
 else {$servername  = $HTTP_SERVER_VARS["HTTP_HOST"];} // Host Domain Name v4.95
 }
 else {
 if (isset($_SERVER["SERVER_ADDR"])) {$servername  = $_SERVER["SERVER_ADDR"];}          // Host Domain Name v4.95
 else {$servername  = $HTTP_SERVER_VARS["SERVER_ADDR"];} // Host Domain Name v4.95
 }
 $servername = process_domain($servername); // v4.86b
}

*/






 // send info to the jpowered server and get a license key
 $productid = "PHPcmsNews01";

 $url  = "http://www.jpowered.com/PHP/apps/trialkey.php";
 $url .= "?domain=".urlencode($domain);
 $url .= "&amp;installdir=".urlencode($installdir);
 $url .= "&amp;fullname=".urlencode(stripslashes($fullname));
 $url .= "&amp;email=".urlencode(stripslashes($email1));
 $url .= "&amp;productid=".$productid;
 $url .= "&amp;password=".urlencode(stripslashes($password));
 $url .= "&amp;username=".urlencode(stripslashes($username));

 $lines = file($url);

 $lkey = "";
 foreach ($lines as $line) {
 $lkey = $line;
 }

 // check license key
 // if it ==  'nokey' then this user has previously had a key
 if (strcmp($lkey,"nokey")==0) {
 nokey($domain);
 }

 // create the user record

 // ensure userdetails.jdb does not exist
 $filename = $datadir."userdetails.jdb";

 if (file_exists($filename)) {
 unlink($filename);
 }

 // add the user record
 $userdetails["accesslevel"] = 0;
 $userdetails["username"]    = stripslashes($username);
 $userdetails["password"]    = md5(stripslashes($password));
 $userdetails["email"]       = stripslashes($email1);
 $userdetails["name"]        = stripslashes($fullname);
 $userdetails["lastlogin"]   = "2000-01-01 00:00:01";
 $userid = addRecord("userdetails",$userdetails);


 // update system parameters

 // set base url and license key
 $JPN_PARAMETERS["baseurl"]    = $installdir;
 $JPN_PARAMETERS["licensekey"] = $lkey;

 // set the set up flag
 $JPN_PARAMETERS["setup"] = "yes";

 // write the new parameter values to the db
 updateSystemParameters();


 // create files
 //    ./data/articles/newsfooter.txt
 //    ./data/articles/newsheader.txt
 //

 if (!file_exists("../data/articles")) {
 // create ./data/articles/ dir
 if (!mkdir("../data/articles")) {
 permissions();
 }
 }



 $handle = fopen("../data/articles/newsfooter.txt","w");
 if (!$handle) {
 permissions();
 }
 fwrite($handle, " ");
 fclose($handle);

 $handle = fopen("../data/articles/newsheader.txt","w");
 if (!$handle) {
 permissions();
 }
 fwrite($handle, " ");
 fclose($handle);


 // Create a default News Category
 $category["name"]             = "News";
 $category["shortname"]        = "News";
 $category["parentcategoryid"] = 0;
 $category["templateid"]       = 0;
 $category["status"]           = 0;

 $category["sortorder"]     = 0;
 $category["description"]   = " ";
 $category["nviews"]        = 0;
 $category["lastresetdate"] = gmdate("Y-m-d H:i:s");

 addRecord("categories",$category);




 // return the instructions page
 successPage($username,$password);


 return;
}


function getDomain() {

 if (isset($_SERVER["HTTP_HOST"])) {
 $domain  = $_SERVER["HTTP_HOST"];
 }
 else {
 $domain  = $HTTP_SERVER_VARS["HTTP_HOST"];
 }

 // strip www from beginning
 if (strlen($domain)>3) {
 if (strcmp(substr($domain,0,4),"www.")==0) {
 $domain = substr($domain,4);
 }
 }

 return $domain;
}

function getInstallDir() {

 // get the domain bit
 if (isset($_SERVER["HTTP_HOST"])) {
 $installdir  = $_SERVER["HTTP_HOST"];
 }
 else {
 $installdir  = $HTTP_SERVER_VARS["HTTP_HOST"];
 }

 // is it http or https ?
 $https = "";
 if (isset($_SERVER["HTTPS"])) {
 $https  = $_SERVER["HTTPS"];
 }
 else {
 $https  = $HTTP_SERVER_VARS["HTTPS"];
 }

 if (strlen($https)>1) {
 $installdir = "https://".$installdir;
 }
 else {
 $installdir = "http://".$installdir;
 }

 // add in the dir path
 if (isset($_SERVER["PHP_SELF"])) {
 $path  = $_SERVER["PHP_SELF"];
 }
 else {
 $path  = $HTTP_SERVER_VARS["PHP_SELF"];
 }

 // remove anomolies
 if (strlen($path)>0) {
 $path = str_replace ("jpowered/newscms/admin/setup.php", "", $path);
 $path = str_replace ("newscms/admin/setup.php", "", $path);
 $path = str_replace ("admin/setup.php", "", $path);
 $path = str_replace ("setup.php", "", $path);
 }

 $installdir .= $path;

 return $installdir;
}




/* ---------------------------------------------------------------- */
/* Main Procedure                                                   */
/* ---------------------------------------------------------------- */

// check whether the ./data/ dir is writable
if (!is_writable("../data/")) {
 permissions();
}

if (!is_readable("../data/")) {
 permissions();
}





// Get Parameters
getSystemParameters();


// if set-up has already been run
// return the login page
if (strcmp($JPN_PARAMETERS["setup"],"yes")==0) {
 // produce the logon page
 $errormessage = "";
 logonPage($errormessage);
}
else {

 // Perform the relvant action
 $action = "";
 if (array_key_exists("action",   $_REQUEST))  {$action = $_REQUEST["action"];}

 switch ($action) {

 case "performsetup":
 performsetup();
 break;


 default: // display set up form
 setupform("");


 }







}





?>

&amp;nbsp;

Scripts for Enano CMS Project NEWS

The Enano CMS Project is an all-new approach to content management. It aims to make the users’ experience as good as it can possibly be – without being bloated like so many other content management systems. Enano focuses on the future of the web. When the Internet first took off, it was about going online once a week to do some casual browsing and check your e-mail. It’s not like that anymore – now, your users need to be part of your site. This is what Web 2.0 is about. And this is what Enano is about. As the world’s first truly hybrid content management system, Enano can perfor.

 

 

<?php

/*
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
 * Version 1.0.4 (Ellyyllon)
 * Copyright (C) 2006-2007 Dan Fuhry
 *
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2 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 details.
 *
 * @package Enano
 * @subpackage Frontend
 *
 */


 define('ENANO_INTERFACE_INDEX', '');

 // Set up gzip encoding before any output is sent

 $aggressive_optimize_html = false;

 global $do_gzip;
 $do_gzip = false;

 if(isset($_SERVER['PATH_INFO'])) $v = $_SERVER['PATH_INFO'];
 elseif(isset($_GET['title'])) $v = $_GET['title'];
 else $v = '';

 if ( isset($_GET['nocompress']) )
 $aggressive_optimize_html = false;

 error_reporting(E_ALL);

 // if(!strstr($v, 'CSS') &amp;&amp; !strstr($v, 'UploadFile') &amp;&amp; !strstr($v, 'DownloadFile')) // These pages are blacklisted because we can't have debugConsole's HTML output disrupting the flow of header() calls and whatnot
 // {
 //   $do_gzip = ( function_exists('gzcompress') &amp;&amp; ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) &amp;&amp; strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') ) ) ? true : false;
 //   // Uncomment the following line to enable debugConsole (requires PHP 5 or later)
 //   // define('ENANO_DEBUG', '');
 // }

 if(defined('ENANO_DEBUG')) $do_gzip = false;

 if($aggressive_optimize_html || $do_gzip)
 {
 ob_start();
 }

 require('includes/common.php');

 global $db, $session, $paths, $template, $plugins; // Common objects

 if ( !isset($_GET['do']) )
 {
 $_GET['do'] = 'view';
 }
 switch($_GET['do'])
 {
 default:
 die_friendly('Invalid action', '<p>The action "'.htmlspecialchars($_GET['do']).'" is not defined. Return to <a href="'.makeUrl($paths->page).'">viewing this page\'s text</a>.</p>');
 break;
 case 'view':
 // echo PageUtils::getpage($paths->page, true, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
 $rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
 $page = new PageProcessor( $paths->page_id, $paths->namespace, $rev_id );
 $page->send_headers = true;
 $pagepass = ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '';
 $page->password = $pagepass;
 $page->send(true);
 break;
 case 'comments':
 $template->header();
 $sub = ( isset ($_GET['sub']) ) ? $_GET['sub'] : false;
 switch($sub)
 {
 case 'admin':
 default:
 $act = ( isset ($_GET['action']) ) ? $_GET['action'] : false;
 $id = ( isset ($_GET['id']) ) ? intval($_GET['id']) : -1;
 echo PageUtils::comments_html($paths->page_id, $paths->namespace, $act, Array('id'=>$id));
 break;
 case 'postcomment':
 if(empty($_POST['name']) ||
 empty($_POST['subj']) ||
 empty($_POST['text'])
 ) { echo 'Invalid request'; break; }
 $cid = ( isset($_POST['captcha_id']) ) ? $_POST['captcha_id'] : false;
 $cin = ( isset($_POST['captcha_input']) ) ? $_POST['captcha_input'] : false;
 PageUtils::addcomment($paths->page_id, $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $cin, $cid); // All filtering, etc. is handled inside this method
 echo PageUtils::comments_html($paths->page_id, $paths->namespace);
 break;
 case 'editcomment':
 if(!isset($_GET['id']) || ( isset($_GET['id']) &amp;&amp; !preg_match('#^([0-9]+)$#', $_GET['id']) )) { echo '<p>Invalid comment ID</p>'; break; }
 $q = $db->sql_query('SELECT subject,comment_data,comment_id FROM '.table_prefix.'comments WHERE comment_id='.$_GET['id']);
 if(!$q) $db->_die('The comment data could not be selected.');
 $row = $db->fetchrow();
 $db->free_result();
 echo '<form action="'.makeUrl($paths->page, 'do=comments&amp;amp;sub=savecomment').'" method="post">';
 echo "<br /><div class='tblholder'><table border='0' width='100%' cellspacing='1' cellpadding='4'>
 <tr><td class='row1'>Subject:</td><td class='row1'><input type='text' name='subj' value='{$row['subject']}' /></td></tr>
 <tr><td class='row2'>Comment:</td><td class='row2'><textarea rows='10' cols='40' style='width: 98%;' name='text'>{$row['comment_data']}</textarea></td></tr>
 <tr><td class='row1' colspan='2' class='row1' style='text-align: center;'><input type='hidden' name='id' value='{$row['comment_id']}' /><input type='submit' value='Save Changes' /></td></tr>
 </table></div>"
;
 echo '</form>';
 break;
 case 'savecomment':
 if(empty($_POST['subj']) || empty($_POST['text'])) { echo '<p>Invalid request</p>'; break; }
 $r = PageUtils::savecomment_neater($paths->page_id, $paths->namespace, $_POST['subj'], $_POST['text'], (int)$_POST['id']);
 if($r != 'good') { echo "<pre>$r</pre>"; break; }
 echo PageUtils::comments_html($paths->page_id, $paths->namespace);
 break;
 case 'deletecomment':
 if(!empty($_GET['id']))
 {
 PageUtils::deletecomment_neater($paths->page_id, $paths->namespace, (int)$_GET['id']);
 }
 echo PageUtils::comments_html($paths->page_id, $paths->namespace);
 break;
 }
 $template->footer();
 break;
 case 'edit':
 if(isset($_POST['_cancel']))
 {
 redirect(makeUrl($paths->page), '', '', 0);
 break;
 }
 if(isset($_POST['_save']))
 {
 $e = PageUtils::savepage($paths->page_id, $paths->namespace, $_POST['page_text'], $_POST['edit_summary'], isset($_POST['minor']));
 if ( $e == 'good' )
 {
 redirect(makeUrl($paths->page), 'Changes saved', 'Your changes to this page have been saved. Redirecting...', 3);
 }
 }
 $template->header();
 if(isset($_POST['_preview']))
 {
 $text = $_POST['page_text'];
 echo PageUtils::genPreview($_POST['page_text']);
 }
 else $text = RenderMan::getPage($paths->page_id, $paths->namespace, 0, false, false, false, false);
 echo '
 <form action="'
.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data">
 <br />
 <textarea name="page_text" rows="20" cols="60" style="width: 97%;">'
.$text.'</textarea><br />
 <br />
 '
;
 if($paths->wiki_mode)
 echo 'Edit summary: <input name="edit_summary" type="text" size="40" /><br /><label><input type="checkbox" name="minor" /> This is a minor edit</label><br />';
 echo '<br />
 <input type="submit" name="_save" value="Save changes" style="font-weight: bold;" />
 <input type="submit" name="_preview" value="Preview changes" />
 <input type="submit" name="_revert" value="Revert changes" />
 <input type="submit" name="_cancel" value="Cancel" />
 </form>
 '
;
 if ( getConfig('wiki_edit_notice') == '1' )
 {
 $notice = getConfig('wiki_edit_notice_text');
 echo RenderMan::render($notice);
 }
 $template->footer();
 break;
 case 'viewsource':
 $template->header();
 $text = RenderMan::getPage($paths->page_id, $paths->namespace, 0, false, false, false, false);
 echo '
 <form action="'
.makeUrl($paths->page, 'do=edit').'" method="post">
 <br />
 <textarea readonly="readonly" name="page_text" rows="20" cols="60" style="width: 97%;">'
.$text.'</textarea>';
 echo '<br />
 <input type="submit" name="_cancel" value="Close viewer" />
 </form>
 '
;
 $template->footer();
 break;
 case 'history':
 $hist = PageUtils::histlist($paths->page_id, $paths->namespace);
 $template->header();
 echo $hist;
 $template->footer();
 break;
 case 'rollback':
 $id = (isset($_GET['id'])) ? $_GET['id'] : false;
 if(!$id || !preg_match('#^([0-9]+)$#', $id)) die_friendly('Invalid action ID', '<p>The URL parameter "id" is not an integer. Exiting to prevent nasties like SQL injection, etc.</p>');
 $rb = PageUtils::rollback( (int) $id );
 $template->header();
 echo '<p>'.$rb.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
 $template->footer();
 break;
 case 'catedit':
 if(isset($_POST['__enanoSaveButton']))
 {
 unset($_POST['__enanoSaveButton']);
 $val = PageUtils::catsave($paths->page_id, $paths->namespace, $_POST);
 if($val == 'GOOD')
 {
 header('Location: '.makeUrl($paths->page)); echo '<html><head><title>Redirecting...</title></head><body>If you haven\'t been redirected yet, <a href="'.makeUrl($paths->page).'">click here</a>.'; break;
 } else {
 die_friendly('Error saving category information', '<p>'.$val.'</p>');
 }
 }
 elseif(isset($_POST['__enanoCatCancel']))
 {
 header('Location: '.makeUrl($paths->page)); echo '<html><head><title>Redirecting...</title></head><body>If you haven\'t been redirected yet, <a href="'.makeUrl($paths->page).'">click here</a>.'; break;
 }
 $template->header();
 $c = PageUtils::catedit_raw($paths->page_id, $paths->namespace);
 echo $c[1];
 $template->footer();
 break;
 case 'moreoptions':
 $template->header();
 echo '<div style="width: 150px; padding: 0;"><ul style="display: block;"><li><div>More options for this page</div><div style="clear: both;"></div></li>'.$template->tpl_strings['TOOLBAR_EXTRAS'].'</ul></div>';
 $template->footer();
 break;
 case 'protect':
 if (!isset($_REQUEST['level'])) die_friendly('Invalid request', '<p>No protection level specified</p>');
 if(!empty($_POST['reason']))
 {
 if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '<p>Request validation failed</p>');
 PageUtils::protect($paths->page_id, $paths->namespace, intval($_POST['level']), $_POST['reason']);
 die_friendly('Page protected', '<p>The protection setting has been applied. <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>');
 }
 $template->header();
 ?>
 <form action="<?php echo makeUrl($paths->page, 'do=protect'); ?>" method="post">
 <input type="hidden" name="level" value="<?php echo $_REQUEST['level']; ?>" />
 <?php if(isset($_POST['reason'])) echo '<p style="color: red;">Error: you must enter a reason for protecting this page.</p>'; ?>
 <p>Reason for protecting the page:</p>
 <p><input type="text" name="reason" size="40" /><br />
 Protecion level to be applied: <b><?php
 switch($_REQUEST['level'])
 {
 case '0':
 echo 'No protection';
 break;
 case '1':
 echo 'Full protection';
 break;
 case '2':
 echo 'Semi-protection';
 break;
 default:
 echo 'None;</b> Warning: request validation will fail after clicking submit<b>';
 }
 ?></b></p>
 <p><input type="submit" value="Protect page" style="font-weight: bold;" /></p>
 </form>
 <?php
 $template->footer();
 break;
 case 'rename':
 if(!empty($_POST['newname']))
 {
 $r = PageUtils::rename($paths->page_id, $paths->namespace, $_POST['newname']);
 die_friendly('Page renamed', '<p>'.nl2br($r).' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>');
 }
 $template->header();
 ?>
 <form action="<?php echo makeUrl($paths->page, 'do=rename'); ?>" method="post">
 <?php if(isset($_POST['newname'])) echo '<p style="color: red;">Error: you must enter a new name for this page.</p>'; ?>
 <p>Please enter a new name for this page:</p>
 <p><input type="text" name="newname" size="40" /></p>
 <p><input type="submit" value="Rename page" style="font-weight: bold;" /></p>
 </form>
 <?php
 $template->footer();
 break;
 case 'flushlogs':
 if(!$session->get_permissions('clear_logs')) die_friendly('Access denied', '<p>Flushing the logs for a page <u>requires</u> administrative rights.</p>');
 if(isset($_POST['_downthejohn']))
 {
 $template->header();
 $result = PageUtils::flushlogs($paths->page_id, $paths->namespace);
 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
 $template->footer();
 break;
 }
 $template->header();
 ?>
 <form action="<?php echo makeUrl($paths->page, 'do=flushlogs'); ?>" method="post">
 <h3>You are about to <span style="color: red;">destroy</span> all logged edits and actions on this page.</h3>
 <p>Unlike deleting or editing this page, this action is <u>not reversible</u>! You should only do this if you are desparate for
 database space.</p>
 <p>Do you really want to continue?</p>
 <p><input type="submit" name="_downthejohn" value="Flush logs" style="color: red; font-weight: bold;" /></p>
 </form>
 <?php
 $template->footer();
 break;
 case 'delvote':
 if(isset($_POST['_ballotbox']))
 {
 $template->header();
 $result = PageUtils::delvote($paths->page_id, $paths->namespace);
 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
 $template->footer();
 break;
 }
 $template->header();
 ?>
 <form action="<?php echo makeUrl($paths->page, 'do=delvote'); ?>" method="post">
 <h3>Your vote counts.</h3>
 <p>If you think that this page is not relavent to the content on this site, or if it looks like this page was only created in
 an attempt to spam the site, you can request that this page be deleted by an administrator.</p>
 <p>After you vote, you should leave a comment explaining the reason for your vote, especially if you are the first person to
 vote against this page.</p>
 <p>So far, <?php echo ( $paths->cpage['delvotes'] == 1 ) ? $paths->cpage['delvotes'] . ' person has' : $paths->cpage['delvotes'] . ' people have'; ?> voted to delete this page.</p>
 <p><input type="submit" name="_ballotbox" value="Vote to delete this page" /></p>
 </form>
 <?php
 $template->footer();
 break;
 case 'resetvotes':
 if(!$session->get_permissions('vote_reset')) die_friendly('Access denied', '<p>Resetting the deletion votes against this page <u>requires</u> admin rights.</p>');
 if(isset($_POST['_youmaylivealittlelonger']))
 {
 $template->header();
 $result = PageUtils::resetdelvotes($paths->page_id, $paths->namespace);
 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
 $template->footer();
 break;
 }
 $template->header();
 ?>
 <form action="<?php echo makeUrl($paths->page, 'do=resetvotes'); ?>" method="post">
 <p>This action will reset the number of votes against this page to zero. Are you sure you want to do this?</p>
 <p><input type="submit" name="_youmaylivealittlelonger" value="Reset votes" /></p>
 </form>
 <?php
 $template->footer();
 break;
 case 'deletepage':
 if(!$session->get_permissions('delete_page')) die_friendly('Access denied', '<p>Deleting pages <u>requires</u> admin rights.</p>');
 if(isset($_POST['_adiossucker']))
 {
 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false;
 if ( empty($reason) )
 $error = 'Please enter a reason for deleting this page.';
 else
 {
 $template->header();
 $result = PageUtils::deletepage($paths->page_id, $paths->namespace, $reason);
 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
 $template->footer();
 break;
 }
 }
 $template->header();
 ?>
 <form action="<?php echo makeUrl($paths->page, 'do=deletepage'); ?>" method="post">
 <h3>You are about to <span style="color: red;">destroy</span> this page.</h3>
 <p>While the deletion of the page itself is completely reversible, it is impossible to recover any comments or category information on this page. If this is a file page, the file along with all older revisions of it will be permanently deleted. Also, any custom information that this page is tagged with, such as a custom name, protection status, or additional settings such as whether to allow comments, will be permanently lost.</p>
 <p>Are you <u>absolutely sure</u> that you want to continue?<br />
 You will not be asked again.</p>
 <?php if ( isset($error) ) echo "<p>$error</p>"; ?>
 <p>Reason for deleting: <input type="text" name="reason" size="50" /></p>
 <p><input type="submit" name="_adiossucker" value="Delete this page" style="color: red; font-weight: bold;" /></p>
 </form>
 <?php
 $template->footer();
 break;
 case 'setwikimode':
 if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '<p>Changing the wiki mode setting <u>requires</u> admin rights.</p>');
 if ( isset($_POST['finish']) )
 {
 $level = intval($_POST['level']);
 if ( !in_array($level, array(0, 1, 2) ) )
 {
 die_friendly('Invalid request', '<p>Level not specified</p>');
 }
 $q = $db->sql_query('UPDATE '.table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $db->escape($paths->page_id) . '\' AND namespace=\'' . $paths->namespace . '\';');
 if ( !$q )
 $db->_die();
 redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), 'Wiki mode for this page has been set. Redirecting you to the page...', 2);
 }
 else
 {
 $template->header();
 if(!isset($_GET['level']) || ( isset($_GET['level']) &amp;&amp; !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', '<p>Level not specified</p>');
 $level = intval($_GET['level']);
 if ( !in_array($level, array(0, 1, 2) ) )
 {
 die_friendly('Invalid request', '<p>Level not specified</p>');
 }
 echo '<form action="' . makeUrl($paths->page, 'do=setwikimode', true) . '" method="post">';
 echo '<input type="hidden" name="finish" value="foo" />';
 echo '<input type="hidden" name="level" value="' . $level . '" />';
 $level_txt = ( $level == 0 ) ? 'disabled' : ( ( $level == 1 ) ? 'enabled' : 'use the global setting' );
 $blurb = ( $level == 0 || ( $level == 2 &amp;&amp; getConfig('wiki_mode') != '1' ) ) ? 'Because this will disable the wiki behavior on this page, several features, most
 notably the ability for users to vote to have this page deleted, will be disabled as they are not relevant to non-wiki pages. In addition, users will not be able
 to edit this page unless an ACL rule specifically permits them.'
: 'Because this will enable the wiki behavior on this page, users will gain the ability to
 freely edit this page unless an ACL rule specifically denies them. If your site is public and gets good traffic, you should be aware of the possiblity of vandalism, and you need to be ready to revert
 malicious edits to this page.'
;
 ?>
 <h3>You are changing wiki mode for this page.</h3>
 <p>Wiki features will be set to <?php echo $level_txt; ?>. <?php echo $blurb; ?></p>
 <p>If you want to continue, please click the button below.</p>
 <p><input type="submit" value="Set wiki mode" /></p>
 <?php
 echo '</form>';
 $template->footer();
 }
 break;
 case 'diff':
 $template->header();
 $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false;
 $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false;
 if(!$id1 || !$id2) { echo '<p>Invalid request.</p>'; $template->footer(); break; }
 if(!preg_match('#^([0-9]+)$#', (string)$_GET['diff1']) ||
 !preg_match('#^([0-9]+)$#', (string)$_GET['diff2']  )) { echo '<p>SQL injection attempt</p>'; $template->footer(); break; }
 echo PageUtils::pagediff($paths->page_id, $paths->namespace, $id1, $id2);
 $template->footer();
 break;
 case 'detag':
 if ( $session->user_level < USER_LEVEL_ADMIN )
 {
 die_friendly('Access denied', '<p>You need to be an administrator to detag pages.</p>');
 }
 if ( $paths->page_exists )
 {
 die_friendly('Invalid request', '<p>The detag action is only valid for pages that have been deleted in the past.</p>');
 }
 $q = $db->sql_query('DELETE FROM '.table_prefix.'tags WHERE page_id=\'' . $db->escape($paths->page_id) . '\' AND namespace=\'' . $paths->namespace . '\';');
 if ( !$q )
 $db->_die('Detag query, index.php:'.__LINE__);
 die_friendly('Page detagged', '<p>All stale tags have been removed from this page.</p>');
 break;
 case 'aclmanager':
 $data = ( isset($_POST['data']) ) ? $_POST['data'] : Array('mode' => 'listgroups');
 PageUtils::aclmanager($data);
 break;
 case 'sql_report':
 $rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
 $page = new PageProcessor( $paths->page_id, $paths->namespace, $rev_id );
 $page->send_headers = true;
 $pagepass = ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '';
 $page->password = $pagepass;
 $page->send(true);
 ob_end_clean();
 ob_start();
 $db->sql_report();
 break;
 }

 //
 // Optimize HTML by replacing newlines with spaces (excludes <pre>, <script>, and <style> blocks)
 //
 if ($aggressive_optimize_html)
 {
 // Load up the HTML
 $html = ob_get_contents();
 @ob_end_clean();

 $html = aggressive_optimize_html($html);

 // Re-enable output buffering to allow the Gzip function (below) to work
 ob_start();

 // Done, send it to the user
 echo( $html );
 }

 $db->close();
 gzip_output();

?>

&amp;nbsp;