|
-
February 19th, 2003, 02:29 AM
#1
Registered User
TinyURL
TinyURL
Might be helpfull when trying to post a link to a ms KB article or something.
-
February 19th, 2003, 04:55 AM
#2
Driver Terrier
TinyURL was created!
The following URL:
http://service1.symantec.com/SUPPORT...h.nsf/d3c44a16
78bd8f45852566aa005902cb/3f2460f30caa6f6e88256b7d00699200?Op
enDocument&sone=nav_2003_tasks.html&stg=3&prod=Nor ton%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
-
February 19th, 2003, 10:33 AM
#3
Registered User
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
-
February 25th, 2003, 02:54 PM
#4
Registered User
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
-
February 25th, 2003, 05:11 PM
#5
Registered User
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..
-
February 25th, 2003, 05:15 PM
#6
Registered User
-
February 25th, 2003, 05:20 PM
#7
Registered User
for those who would like the script
here is index.php
PHP Code:
<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\">[url]http://go.rbcode.com/l/[/url]".$id.".php</a>";
mysql_close($conenct);
} else {
form();
}
?>
here is function.php
PHP Code:
<?
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
Code:
# 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;
Last edited by +Daemon+; February 25th, 2003 at 05:23 PM.
-
February 25th, 2003, 05:56 PM
#8
Registered User
lol!!! that's amazing! You crack me up danimal.
-
February 26th, 2003, 09:42 AM
#9
Registered User
Changes to script
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
Last edited by ANumber1; February 26th, 2003 at 09:44 AM.
-
February 26th, 2003, 10:34 AM
#10
Registered User
-
March 3rd, 2003, 12:22 PM
#11
Registered User
Originally posted by Gollo
lol!!! that's amazing! You crack me up danimal.
??????
-
March 3rd, 2003, 01:51 PM
#12
Registered User
Originally posted by DANIMAL
??????
HA HA I just realized I wrote your name and not daemon. Sorry.
-
March 3rd, 2003, 01:52 PM
#13
Registered User
I figured as Much!
-
March 4th, 2003, 05:47 PM
#14
Registered User
-
March 6th, 2003, 10:11 PM
#15
Registered User
You should title your page.
Maybe Shrink that Link
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks