I have asked around for help with this script, but it all appears to be in vein. I hope anyone here can aid me, which would be great of you, please! This script came with no useful instructions, or troubleshooting, I have tried to make it work and was almost sucessfull.
The script below is a small script called hotlist, its purpose is simply to save posts in a weblog site here it is:
- THIS IS THE MAIN SCRIPT
<?php
//CHANGE THE PATH BELOW
$myhotlist = "/home/SCRIPTPATH/hotties/".$id.".php";
if (isset($remove) && file_exists($myhotlist)) {
$currentlist = file($myhotlist);
$fp = fopen ($myhotlist, "w+");
for ($i = 0; $i < count($currentlist); $i++) {
$hotone = explode("|||", $currentlist[$i]);
if ($entryid != trim($hotone[0])) {
fwrite ($fp,trim($hotone[0])."|||".trim($hotone[1])."|||".$hotone[2]);
}
}
fclose($fp);
$response = "''".$entrytitle."'' has been removed from your Favorites";
} else {
if (file_exists($myhotlist)) {
$currentlist = file($myhotlist);
for ($i = 0; $i < count($currentlist); $i++) {
$hotone = explode("|||", $currentlist[$i]);
if ($entryid == trim($hotone[0])) {
$alreadyhere = 1;
}
}
if (!isset($alreadyhere)) {
$fp = fopen ($myhotlist, "a+");
fwrite ($fp,trim($entryid)."|||".trim($entrylink)."|||".$entrytitle."\n");
fclose($fp);
$response = "''".$entrytitle."'' has been added to your Favorites";
} else {
$response = "That post was already on your hotlist.";
}
} else {
$fp = fopen ("$myhotlist", "a+");
fwrite ($fp,trim($entryid)."|||".trim($entrylink)."|||".$entrytitle."\n");
fclose($fp);
$response = "''".$entrytitle."'' has been added to your Favorites";
}
}
?>
<html>
<head>
<title>Hotlist</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="0;URL=<? echo getenv("HTTP_REFERER"); ?>">
</head>
<body bgcolor="white" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<script language="javascript">
alert("<? echo $response; ?>");
</script>
</body>
</html>
- THIS IS WHAT'S SUPPOSE TO GO ABOVE EVERY PAGE WHERE I WANT THE USER TO BE ABLE TO SEE THE "MY LIST" LIST
<?php
if (!isset($id)) {
srand((double)microtime()*1000000);
$randval = rand();
setcookie("id",$randval,time()+126144000,"/",".SITE.com",0);
$hotcookie = $randval;
} else {
$hotcookie = $id;
}
$myhotlist = "/home/PATHTOFILE/hotties/".$hotcookie.".php";
$hotarray[0] = "";
if (file_exists($myhotlist)) {
$currentlist = file($myhotlist);
for ($i = 0; $i < count($currentlist); $i++) {
$hotone = explode("|||", $currentlist[$i]);
$hotarray[$i] = trim($hotone[0]);
}
}
?>
----------------------------------------
- AND THIS IS FOR CALLING THE SAVED BOOKMARKS
<?php
if (file_exists($myhotlist) && $hotarray[0] != "") {
$currentlist = file($myhotlist);
echo "<h1>My Hotlist</h1><p>";
for ($i = 0; $i < count($currentlist); $i++) {
$hotone = explode("|||", $currentlist[$i]);
echo "<a href=\"".trim($hotone[1])."\" >".stripslashes($hotone[2])."</a><br>";
}
}
?>
THE PROBLEM:
I was sucessful in making it work, and was very happy. Then I began opening and testing on other browsers, and all the saved bookmarks showed on every browser, including my friends. The script apparently wasn't doing the right thing. Since this script is designed to assign each user/guest their own list via cookies? Well I reinstalled it, and now it is working, BUT it doesn't let me add more than one link, I don't know what is wrong with this script, and why it's acting so weird. It's a fairly nice script compared to few others out there which are very hard to find.
The brief instructions say to put the code (2.) in the top of every page, I did that. Then it says to make a folder and within that folder another one called "hotties" and chmod it to "777." Did that too, and in the other folder (the one above hotties) upload the code from #1 (1.), and then use the last code (3.) to display people's bookmarks, did that as well! But it's doing that weird "only one bookmark" thing now, arrrg!
PLEASE HELP ME FIX THIS SCRIPT AND MAKE IT WORK SMOOTH! PLEASE! THANk yOU!