Tech Support Guy banner
Status
Not open for further replies.

Bookmark site

4K views 31 replies 3 participants last post by  JiminSA 
#1 ·
#4 ·
You need to give us a bit more information of exactly how you want to do this.

Do you want to share bookmarks between different computer? Do you want a webpage you host yourself? Do you want a webpage on some sort of service that stores your bookmarks for you?

Clearly define what you want to do and then maybe we can suggest something.
 
#6 ·
Which browser do you use? That depends on the answer.

If Firefox for instance you can select Bookmarks > Show All Bookmarks > Import and Backup > Export Bookmarks to HTML. This will create an html file that you can then upload to your site.

Other browsers have similar export features but without knowing which you are using .....

Firefox has a Sync setting which allows you to sync your bookmarks across multiple computers which I use rather than putting them up on the internet.
 
#8 ·
This is what I asked earlier to fully specify what you want.

This will probably have to be a bespoke application with an input form for new sites, it will probably need a database as you will want to store the urls by group of similar type.

I am not aware of anything that will do this. Try having a look at Hotscripts to see if there is something that will do this for you BUT fully specify what you want to do before you go looking so that you know if a pre-written script will do all that you want.
 
#12 ·
I don't see why not. It seems completely self-contained - i.e. it doesn't appear to use OS dependent folders et cetera - it uses a python db.
Were you looking for portability?
 
#14 ·
Russ, I've had a good Google around and have not been able to find a script that really fits what you want to do.:(
So, I had a little time on my hands and have written what I think you are looking for.
It requires you to change your .html landing page (i.e. the page where you want to show your bookmarks) to a .php file and inserting some code into it as follows:-
In the head section insert the following:-
Code:
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
This, because I've written it using bootstrap styling.
Next we need to insert a side panel to display your bookmarks. So insert the following within your body section:-
Code:
<div class="container">
	<div class="span2"> <!-- Sidebar content -->
		<h3>Bookmarks</h3>
<?php
	$filename = 'bkm_data.txt';

	if(file_exists($filename))
	{
		$data = unserialize(file_get_contents("bkm_data.txt")); // Unserializes the file's contents, thereby turning itself into an array. 
		if (!empty($data))
		{
			foreach($data as $key => $val) 
			{ // Iterates through the array 
				echo '<button type="button" class="btn btn-link"><a href="'.$val.'" target="_blank">'.$key.'</button><br />'; // Writes an href button for each key. 
			} 
		}
	}
?>				
	</div> <!-- END Sidebar content -->
</div>
Right, now for the bookmark creation program itself ...
Copy and paste the following into a Notepad++ page (or whatever editor you use) and save it as a .php file in the same folder as your landing page (in which we just inserted the above code) which you'll remember (I called mine 'booker.php')
Code:
<?php
	session_start();
	$array = array(); 

	if(isset($_POST['Name']) && $_POST['Name'] != "")
	{
		$name = htmlspecialchars($_POST['Name'], ENT_QUOTES);
		$url = htmlspecialchars($_POST['URL'], ENT_QUOTES);
		
		$filename = 'bkm_data.txt';
		if(file_exists($filename))
		{
			$array = unserialize(file_get_contents("bkm_data.txt")); // Unserializes the file's contents, thereby turning itself into an array. 
		}
		
		$array[$name] = $url;
		ksort($array);
		$res = fopen("bkm_data.txt","r+"); // Opens a resource 
		$string = serialize($array); // Sets a variable to identify the serialized array 
		$write = fwrite($res,$string); // Writes it to the file 
		@fclose($res); 
	}
	//unset($array[$name]);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="CMS to create Bookmarks">
    <meta name="author" content="Jim Ord">
    <link rel="icon" href="favicon.ico">

    <title>Bookmarker</title>

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
	<div class="container">
		<div class="row">
			<div class="span12"> <!-- form content -->
				<h3>Add a Bookmark</h3>
				<form name="Bookmark" action="" method="post">
					<label>Bookmark Name <input type="text" id="Bookmark" name="Name" required="required" /></label>
					<label>Bookmark URL <input type="text" id="Bookmark" name="URL" placeholder="http://" required="required" /></label>
					<button type="submit" class="btn btn-default">Submit</button>
				</form>
			</div> <!-- END form content -->
			<div class="span2"> <!-- Sidebar content -->
				<h3>Bookmarks</h3>
<?php
	$filename = 'bkm_data.txt';

	if(file_exists($filename))
	{
		$data = unserialize(file_get_contents("bkm_data.txt")); // Unserializes the file's contents, thereby turning itself into an array. 
		if (!empty($data))
		{
			foreach($data as $key => $val) 
			{ // Iterates through the array 
				echo '<button type="button" class="btn btn-link"><a href="'.$val.'" target="_blank">'.$key.'</button><br />'; // Writes an href button for each key. 
			} 
		}
	}
?>				
			</div> <!-- END Sidebar content -->
		</div>
	</div>
</body>
</html>
Finally, you need to create an empty .txt file - called bkm_data.txt (you can use MSNotepad or whatever to do this) and save it in the same folder as your landing page.
OK, upload that lot to your server, and then create a url to the above program (e.g. http://yoursite.com/booker.php) and start creating your bookmarks - enjoy;)
FYI...
I have not used a database per se, to hold your bookmarks (it's such a small load), but as you've probably seen, I am using a .txt file which I serialize and unserialize accordingly. It's a handy alternative to a db IMHO;)
Take a peek at the attachment to see how it looks ...
 

Attachments

#18 ·
Finally, you need to create an empty .txt file - called bkm_data.txt
Did you do this?
AND simply add value="http://" within the input statement and remove the placeholder="http://"
 
#20 ·
Warning: fopen(bkm_data.txt) [function.fopen]: failed to open stream: Permission denied in D:\Hosting\5711000\html\bookmarks.php on line 18
I'll need to see the full script please Russ - php included ...
 
#21 ·
JiminSA,
Here is what i have in the bookmarks.php file.

<?php
session_start();
$array = array();

if(isset($_POST['Name']) && $_POST['Name'] != "")
{
$name = htmlspecialchars($_POST['Name'], ENT_QUOTES);
$url = htmlspecialchars($_POST['URL'], ENT_QUOTES);

$filename = 'bkm_data.txt';
if(file_exists($filename))
{
$array = unserialize(file_get_contents("bkm_data.txt")); // Unserializes the file's contents, thereby turning itself into an array.
}

$array[$name] = $url;
ksort($array);
$res = fopen("bkm_data.txt","r+"); // Opens a resource
$string = serialize($array); // Sets a variable to identify the serialized array
$write = fwrite($res,$string); // Writes it to the file
@fclose($res);
}
//unset($array[$name]);
?>
<!DOCTYPE html>

Bookmarker








Add a Bookmark

Bookmark Name
Bookmark URL
Submit




Bookmarks

<?php
$filename = 'bkm_data.txt';

if(file_exists($filename))
{
$data = unserialize(file_get_contents("bkm_data.txt")); // Unserializes the file's contents, thereby turning itself into an array.
if (!empty($data))
{
foreach($data as $key => $val)
{ // Iterates through the array
echo '<a href="'.$val.'" target="_blank">'.$key.'
'; // Writes an href button for each key.
}
}
}
?>
here is the link again:

http://www.rn1162.com/bookmarks.php

Thanks,

Russ
 
#22 ·
We need to check the file permissions on bkm_data.txt. If you are using Filezilla just right click on the file on the server and set the permissions to at least '604'.
 
#23 ·
JiminSA,

I do not have permission to change file permissions on godaddy at all.

What can i do now ? Plus godaddys economy package is $3.99 a month . That is where I would be able to change permissions. Is there any other suggestions ?

Thanks,
Russ
 
#24 ·
I do not have permission to change file permissions on godaddy at all.
No problem, I don't think that the file permissions are the problem. If you can change the relative address of the file to an absolute hyperlink address it should solve it - i.e. if you change this line
Code:
$filename = 'bkm_data.txt';
to
Code:
$filename = 'http://www.rn1162.com/bkm_data.txt';
it should sort the problem (i.e change from a relative address to an absolute hyperlink address).
It seems that Godaddy has kept your local addressing (D://) when creating the 'online' address:confused:
(BTW, you can change file permission in Windows Explorer thus)
 
#25 ·
JiminSA,

this is my script now.

<?php
session_start();
$array = array();

if(isset($_POST['Name']) && $_POST['Name'] != "")
{
$name = htmlspecialchars($_POST['Name'], ENT_QUOTES);
$url = htmlspecialchars($_POST['URL'], ENT_QUOTES);

$filename = 'http://www.rn1162.com/bkm_data.txt';
if(file_exists($filename))
{
$array = unserialize(file_get_contents("bkm_data.txt")); // Unserializes the file's contents, thereby turning itself into an array.
}

$array[$name] = $url;
ksort($array);
$res = fopen("bkm_data.txt","r+"); // Opens a resource
$string = serialize($array); // Sets a variable to identify the serialized array
$write = fwrite($res,$string); // Writes it to the file
@fclose($res);
}
//unset($array[$name]);
?>
<!DOCTYPE html>

Bookmarker








Add a Bookmark

Bookmark Name
Bookmark URL
Submit




Bookmarks

<?php
$filename = 'http://www.rn1162.com/bkm_data.txt';

if(file_exists($filename))
{
$data = unserialize(file_get_contents("bkm_data.txt")); // Unserializes the file's contents, thereby turning itself into an array.
if (!empty($data))
{
foreach($data as $key => $val)
{ // Iterates through the array
echo '<a href="'.$val.'" target="_blank">'.$key.'
'; // Writes an href button for each key.
}
}
}
?>
Thanks

Russ
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top