Current location: Hot Scripts Forums » Programming Languages » PHP » Lil php coding help for url shortning script


Lil php coding help for url shortning script

Reply
  #1 (permalink)  
Old 04-02-08, 09:41 PM
pede69 pede69 is offline
New Member
 
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Lil php coding help for url shortning script

Hi...

Would someone please be kind enough to help me with php code to insert into my webpage?

I have a site that shortens a url. It uses an SQL DB. (not important for this, I believe)

I need the php code to keep the shortened url in the address bar after redirecting to the landing page. The way it works now is that it shortens the url but the original url shows in the address bar after reaching the landing page.

Would someone please help me out here?

I hope I am allowed to put the url here? I am not promoting the site. I can not even use it the way it is now.

Moderators, delete this if it is not ok to be here. Thank you.

URL: gourlgo.com

If you would like, I will give you a free webhosting account for helping me get this the way I want it.
(pretty fast server) cPanel, Fantasico, RV Skin, RV Sitebuilder... the works.

Thank you,
John
Reply With Quote
  #2 (permalink)  
Old 04-02-08, 10:44 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Im having trouble understanding your question...

You want to have a url look shortened and get the url from the database?

Maybe an ID?:
PHP Code:



$sql 
'select * from table_name where Id="'.mysql_real_escape_string($_GET['id']).'"' ;
$result mysql_query($sql) ;

    if (
$row mysql_fetch_array($result))
    {
        require 
'pages/'.$row['page_name'] ;
    } 
Hope this is what you mean lol... Have you had any experiance with php? Otherwise i can explain thing more in depth

Lex
__________________
01010000 01001000 01010000
Reply With Quote
  #3 (permalink)  
Old 04-03-08, 05:04 AM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
Basically, you are going to need to use a .htaccess file and mod_rewrite to send all URI's for your URL to a script. that script will take the data, and process it by doing as Lex has said above. To add them, you would simply need to generate a random string of characters of a predefined length, and add them to the database along with the URL of the site as long as the URL and random string arent already in the db, then you will either output the random string already in the database for the URL or generate a new random string until a unique one is created respectively

Jay
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom php script needed alley Job Offers & Assistance 5 06-30-10 02:14 AM
PHP Membership Script sixflagsga Script Requests 1 05-19-05 05:23 PM
Where is this PHP script? wildatheart Script Requests 0 04-25-05 10:19 AM


All times are GMT -5. The time now is 07:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.