Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-07-2006, 05:35 PM   #1
Solid State Member
 
Join Date: Dec 2005
Posts: 20
Default Making a TinyURL php script...

Hello guys, i dont know very much php but i know enough to follow directions.

Im trying to modify an already existing php script. The script is called phpFaber TinyLink and is available for free here.

I have uploaded it to the link below but i have not set up the mysql db yet.
http://uploadtemp.thetechaddict.net/phpfaber_tinylink/

Instead of a submit line i want to have a text box where i can post multiple URLs.

For example...i post one url on one line....the 2nd url on the 2nd line..and the 3rd url on the 3rd line....and so on.

Then i when the user clicks submit(make tinylink)...i want php to convert each line to its own Tinylink and store it in the database. Then for it to display the new tiny links in order.

This doesnt sound too hard, im just not sure where to start.

INDEX.PHP FILE:
Quote:
<?php

require_once("./tiny_includes/config.php");
$smarty = new Smarty;
$smarty->template_dir = "$dir_ws/tiny_templates";
$smarty->compile_dir = "$dir_ws/tiny_templates_c";
$smarty->assign("url_to_index",$config['url_to_index']);

$HTTP_SESSION_VARS['searchurl'] = '';
$randlink = '';

if($_SERVER['QUERY_STRING'] && !$fullurl && !preg_match('/[\W]/',$_SERVER['QUERY_STRING'])){
//loading index.php with query
if($res = checkQueryString($_SERVER['QUERY_STRING'])){
//query found
if($res['showsplash'] && $config['refreshrate']){
$smarty->assign("fullurl",$res['fullurl']);
$smarty->assign("refreshrate",$config['refreshrate']);
$smarty->assign("ad",getAd());
$smarty->assign("records",getNumb());
$smarty->display("connect.htm");
}
else js_redirect($res['fullurl']);
}
else{
//query did not find
$smarty->display("error.htm");
}
}
else{

if($fullurl){
preg_match("/^((http:\/\/)*)(.*)/i", $fullurl, $matches1);
preg_match("/^(http:\/\/)*/i", $fullurl, $matches2);

if($matches1[1]==$matches2[1] and $matches1[3]) $u = parse_url($fullurl);
else $u['host'] = $fullurl;

$ip = gethostbyname($u['host']);

if($ip == $u['host']){
js_alert ('No such host!');
}
else $randlink = addLink($fullurl,$ip);
}

//loading index.php
$smarty->assign("fullurl",$fullurl);
$smarty->assign("randlink",$randlink);

$smarty->assign("ad",getAd());
$smarty->assign("records",getNumb());
$smarty->display("index.htm");
}

?>
w0lv3r1ne is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 06:41 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0