Click to See Complete Forum and Search --> : TinyURL


Gollo
February 19th, 2003, 02:29 AM
TinyURL (http://tinyurl.com/)

Might be helpfull when trying to post a link to a ms KB article or something.

NooNoo
February 19th, 2003, 04:55 AM
:cool: TinyURL was created!
The following URL:

http://service1.symantec.com/SUPPORT/sharedtech.nsf/d3c44a16
78bd8f45852566aa005902cb/3f2460f30caa6f6e88256b7d00699200?Op
enDocument&sone=nav_2003_tasks.html&stg=3&prod=Norton%20Anti
Virus&ver=2003%20for%20Windows%202000/Me/98/XP&base=http://w
ww.symantec.com/techsupp/nav/&next=nav_2003_contact_tscs_oth
er.html&src=sg&pcode=nav&svy=

has a length of 329 characters and resulted in the following TinyURL which has a length of 23 characters:
http://tinyurl.com/629k

The Computer Valet
February 19th, 2003, 10:33 AM
http://makeashorterlink.com

is another one.

I think the only potential issue with these services is the links expire after a time.

Maybe that's not true with TinyURL, but it was/is was Makeashorterlink.

m

+Daemon+
February 25th, 2003, 02:54 PM
oh man how ez is this...

all there doing is having you post a link into there database then giving you a link..

then when someone clicks on that link it looks at the end number and checks the database sees it then sends you to the url in the database..


humm I should write somthing like this :D

+Daemon+
February 25th, 2003, 05:11 PM
ok I just created one :)

http://go.rbcode.com/

if you cannot connect to the site right now, it will be fully operational tommorrow.. I just had my web hosting service create a virtual doamin for me..

+Daemon+
February 25th, 2003, 05:15 PM
heres one :)

http://go.rbcode.com/l/4.php

+Daemon+
February 25th, 2003, 05:20 PM
for those who would like the script

here is index.php


<link href="style.css" rel="stylesheet" type="text/css">
<?
include('function.php');
if ($_REQUEST["Submit"] == "Submit") {
$today = date("F j, Y, g:i a");

$connect = mysql_connect("localhost", "root", "") or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
$db = mysql_select_db("shortlink", $connect) or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
$sql = "INSERT INTO link SET SLink = '".$_REQUEST["linkit"]."', SDate = '".$today."', SIP = '".$_SERVER["REMOTE_ADDR"]."'";
$sql_result = mysql_query($sql, $connect) or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");

$check_query = "SELECT * FROM link WHERE SIP = '".$_SERVER["REMOTE_ADDR"]."' AND SDate = '".$today."'";
$results = mysql_query($check_query, $connect);
while ($row = mysql_fetch_array($results)){
$geturl = $row["SLink"];
$id = $row["SID"];
}
$filename = "l/$id.php";
touch ($filename);
$count = strlen($_REQUEST["linkit"]);
$count2 = strlen("http://go.rbcode.com/l/".$id.".php");
$somecontent = "<? \n header(\"Location: $geturl\"); \n exit; \n ?>";

if (is_writable($filename)) {
if (!$fp = fopen($filename, 'a')) {
print "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (!fwrite($fp, $somecontent)) {
print "Cannot write to file ($filename)";
exit;
}
}

echo "<i>ShortLink was created!</i> <br>";
$str = wordwrap($_REQUEST["linkit"], 20);
?>
<b>The following URL:</b> <br> <? echo "$str\n"; ?>
<br><br>
<?
echo "Link provided has a length of ".$count." and has been shrunk to ".$count2."<br>";
echo "<a href=\"http://go.rbcode.com/1/".$id.".php\">http://go.rbcode.com/l/".$id.".php</a>";

mysql_close($conenct);
} else {
form();
}
?>


here is function.php


<?
function form() {
?>
<form name="shrinkit" method="post" action="<? echo $PHP_SELF; ?>">
<table width="640" border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="#C8D2DB">
<td width="148" bgcolor="#C8D2DB" class="txt">Enter Link to Shrink</td>
<td width="489" nowrap bgcolor="#DFE4EA">
<input name="linkit" type="text" class="form" size="65">
</td>
</tr>
<tr align="center" bgcolor="#C8D2DB">
<td colspan="2">
<input name="Submit" type="submit" class="form" value="Submit">
<input name="Submit2" type="reset" class="form" value="Reset">
</td>
</tr>
</table>
</form>
<?
}
?>


now all you gotta do is create a subdirectory called "l" and if its on a linux box give it full rights chmod 777

and here is the sql create commands for mysql


# Host: localhost
# Database: shortlink
# Table: 'link'
#
CREATE TABLE `link` (
`SID` int(11) NOT NULL auto_increment,
`SLink` longtext NOT NULL,
`SDate` text NOT NULL,
`SIP` text NOT NULL,
PRIMARY KEY (`SID`)
) TYPE=MyISAM;

Gollo
February 25th, 2003, 05:56 PM
lol!!! that's amazing! You crack me up danimal.

ANumber1
February 26th, 2003, 09:42 AM
Nice script. But you should change it to not write a file for every link. Just have them goto your script with the id of the link in your database and feed it back to them.

PS. I hope you dont use "root" user to connect to your mysql :eek2:

+Daemon+
February 26th, 2003, 10:34 AM
nope I put root and "" for password all the time when I show my code :) :p

I have it write a file every time for the short url.. if I did a varible then the id it makes it longer.. plus the files are only 200 bytes and less... doesnt take any space.. and you can clear the old filed links later...

I have the url and ip logged from the user so I can make another page for a bookmark page, so the shortin links wont just be lost forever :)

DANIMAL
March 3rd, 2003, 12:22 PM
Originally posted by Gollo
lol!!! that's amazing! You crack me up danimal.


??????:confused:

Gollo
March 3rd, 2003, 01:51 PM
Originally posted by DANIMAL
??????:confused:

HA HA I just realized I wrote your name and not daemon. Sorry.

DANIMAL
March 3rd, 2003, 01:52 PM
I figured as Much! :D ;)

+Daemon+
March 4th, 2003, 05:47 PM
:D

Thunderwind
March 6th, 2003, 10:11 PM
You should title your page.

Maybe Shrink that Link

goinpostal
March 7th, 2003, 04:32 PM
Cool it works good job

http://go.rbcode.com/l/22.php

:D

How about www.shrinkalink.com