Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

PHP site - code correction or anything else?

Links for php scripts

Moderators: macek, egami, gesf

PHP site - code correction or anything else?

Postby congthanh » Sun Jul 17, 2005 8:13 pm

Dear all,
I'm quite new to PHP. I have downloaded a demo site from the Internet (as you may see the credit hereafter).
The launched site works well with the index page (which loads But the other pages when buttons clicked,. the address name appears on the address bar but the content does not load (For example when I click about, it does not load the file "". Can anyone help me? This demo can be viewed at: - Thank you very much.
Hoang Cong Thanh (


/* ################

~~ NOTICE ~~
use this code ASIS FREE
but you need to keep this
notice and other copyright
statements in place. Thank
you for your support.



The IF statment will read the name of the file associated with the URL. it will then include the file matching
the click name.

global $click2;

$parameters = explode("=", $_SERVER['REQUEST_URI']);
$click2= $parameters[1];
$click2 = str_replace('%20',' ', $click2);

$thisyear= date(Y); // this will automatically update the Copyright year notice
if (!$click2)
include ("");

else {

if (!file_exists($text)) // check if file exist, if not include error file
{ $text="data/"; }

include ("");

function readmyfile ($filename)
$chunksize = 1*(1024*1024); // how many bytes per chunk
$buffer = ''; // reset buffer
$message = fopen($filename, 'rb');
if ($message === false) { return false; }
while (!feof($message)) { $buffer = fread($message, $chunksize); }
return $buffer;

function replaceUrl($mm)
while(strpos($mm, "[url")!==false)
$begUrl = strpos($mm, "[url");
$endUrl = strpos($mm, "[/url]");
$url = substr($mm, $begUrl, $endUrl-$begUrl+6);
$posBracket = strpos($url, "]");
if ($posBracket != null){
if ($posBracket == 4){
// [url]data[/url]
$link = substr($url, 5, $endUrl - $begUrl -5);
$htmlUrl = "<a href=\"$\">$link</a>";

$mm = str_replace($url, $htmlUrl, $mm);

echo $mm;


function explodeUrl($mm)
$items = explode("|", $mm);
$item_count= count($items);
while ($xcount<$item_count)
echo "<a href=\"?click=$items[$xcount]\" class=\"button\">&nbsp;$items[$xcount]&nbsp;</a>&nbsp;&nbsp;"; $xcount++;

New php-forum User
New php-forum User
Posts: 3
Joined: Sun Jul 17, 2005 7:54 pm
Location: Vietnam

Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.