WebmasterSite.net: PHP scripts to enable your creativity
WSN Links PHP Directory Software
PHP Scripts Webmaster Links Support Forums

Register | Forgot Password

Alt to link.php?id=

Version:
printPrint


Alt to link.php?id=
Jumpin Jack
Member

Usergroup: Customer
Joined: Jan 13, 2005
Total Topics: 21
Total Posts: 47
Posted 01/24/05 - 08:47 AM:
quote post
#1
I made a new link field called siterealname where I type the name of the site without spaces and all lowercase letters. ex - Big Top would be bigtop. I want to send my hits out using something like link.php?id=bigtop instead of the link id number.

How can I do it?
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 57
Total Posts: 6312
Posted 01/27/05 - 01:56 AM:
quote post
#2
That's a dangerous thing to do, since you can't be sure that you'll always remember to keep the names unique. You're likely to eventually end up with two links that have the same name, rendering one of them dead.

In link.php, change
if ($id > 0)

{

$thelink = new onelink('id', $id); // get for frequent later use
if ($thelink->url == '') $action = 'detail'; // if no url, don't try to go to it

}
to

if ($id > 0)

{
$id = $db->rowitem($db->select('id', 'linkstable', "siterealname='$id'"));
$thelink = new onelink('id', $id); // get for frequent later use
if ($thelink->url == '') $action = 'detail'; // if no url, don't try to go to it

}


Then just link in the templates with link.php?id={LINKSITEREALNAME} (you might want to use the mass replacement across all templates option on the 'advanced' page of your admin panel).

Edited by Paul on 01/27/05 - 01:59 AM

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
Jumpin Jack
Member

Usergroup: Customer
Joined: Jan 13, 2005
Total Topics: 21
Total Posts: 47
Posted 01/27/05 - 01:37 PM:
quote post
#3
Thanks but that code doesn't work.

When I click on a link I get the following error.

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/apache/www/htdocs/links/classes/database.php on line 69

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/apache/www/htdocs/links/classes/database.php on line 82

Fatal error: Call to a member function on a non-object in /usr/apache/www/htdocs/links/link.php on line 149
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 57
Total Posts: 6312
Posted 01/27/05 - 06:48 PM:
quote post
#4
Looks right, if that's actually your field name. Post the debug.

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
Search thread for
Download thread as


You don't have permission to post.

Please login or register.

   
 
© 2008 Paul Knierim. All rights reserved.