okie i've read many post but i still can't make it work. please help me here.
my random.php file
<?php
define('ROOT_PATH', './hinhanh/');
define('SCRIPT_URL', 'http://www.domainame.com/hinhanh/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
$sql = "SELECT COUNT(*) as total_images
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];
mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$full_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_thumb_file'];
print("
document.write('<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"1\" alt=\"$image_name\"></a>');
");
?>
and this is my test.html file that will be intergrated into my main index.php page... here is the code i put in there..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
</head>
<body>
LOL
<SCRIPT language='JavaScript' src='http://domainame.com/hinhanh/random.php?1'></SCRIPT>
<SCRIPT language='JavaScript' src='http://domainame.com/hinhanh/random.php?2'></SCRIPT>
<SCRIPT language='JavaScript' src='http://domainame.com/hinhanh/random.php?3'></SCRIPT>[/quote]
</body>
</html>
but then i still can't make it works.
it still showing this error
it only show the word LOL when i view the test.html file... wont show those 3 images