HTML
|
|
|
|
<?php <script language="PHP">
// DynamicPage 0.01 - Copyright (C) 2000 W10.NET Ltd, Scotland. Http://w10.net
// The complete file package will be found on: ftp://w10.net/W10/DynamicPage
/*
The copyright line above, must not be removed at any time.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Configuration code.
// ------------------- $DefaultSiteName = "A" ; $DataBaseHost = "localhost" ; $UserName = "user" ; $UserPass = "pass" ; $DataBase = "ABC" ; $BasePageName = "Index" ; $CommonPageName = "Common" ; $UndefinedPageName = "Undefined" ; // -------------------
if (empty($page)) $page = $BasePageName;
if (empty($SiteName)) $SiteName= $DefaultSiteName ;
$sql_tok = mysql_connect($DataBaseHost,$UserName,$UserPass) ; mysql_select_db($DataBase,$sql_tok) ;
Snippet($page,"") ;
mysql_close($sql_tok) ;
function Snippet($page,$xx_name)
{
global $SiteName,$sql_tok,$UndefinedPageName ;
if (strstr($xx_name,':') != "") { $xx_pn = split(":",$xx_name,2); $page = $xx_pn[0] ; $xx_name = $xx_pn[1] ; }
$sql_idx = mysql_query("select * from PAGEbuild where Wn='$SiteName' and Pn='$page' and Sn='$xx_name'",$sql_tok) ;
if (mysql_num_rows($sql_idx) == 0) Snippet($UndefinedPageName,"") ;
$xx_part = mysql_fetch_array($sql_idx) ;
$xx_text = stripslashes($xx_part[Code]) ;
$xx_Type = strtolower($xx_part[Type]) ;
if ($xx_Type == "page")
{
$xx_page = explode("n",urldecode(ereg_replace("%0D","",urlencode($xx_text)))) ;
for ($i = 0 ; $i < (sizeof($xx_page)-1) ; $i++) Snippet($page,$xx_page[$i]) ;
}
if ($xx_Type == "html") echo $xx_text ;
if ($xx_Type == "code") eval($xx_text) ;
if ($xx_Type == "pict") Object($page,$xx_name) ;
}
function Common($name) { global $CommonPageName ; Snippet($CommonPageName,$name) ; }
function Object($page,$name)
{
global $object,$SiteName,$sql_tok ;
$sql_idx_tt = mysql_query("select * from PAGEbuild where Wn='$SiteName' and Pn='$page' and Sn='$name'",$sql_tok) ;
$xx_part = mysql_fetch_array($sql_idx_tt) ;
$Type = strtolower($xx_part(Type)) ;
if ($Type == "pict") Header("Content-type: image/gif");
if ($Type == "object") Header("Content-type: $mime");
echo base64_decode($xx_part[Code]) ;
}
</script>
?>
|
|
|
Usage Example
|
|
|
Rate This Script
|
|
|
|