Skip to content
WJunction - Webmaster Forum

Needed Simple Link shortenin script ..

Status
Not open for further replies.
Hi..
Guys..
I m in need of link shortening script..for the personal use..means i dont want to open a get to paid link shorten ..

[STRIKE]What i want to be in script :
Basically i want a script that can able to show a particular page before the destination link..
Ex
If i ve shorten the www.google.com ..
So when user click on this shorten link..
There is page with ads on it (this ads put by me of various ad network) for 5 seconds..
Then after visitor will redirect to google.com ..note that visitor doesnt need to click on skip ad button(so i dont want to add this skip button) its ll be autoredirect..
[/STRIKE]

....Special thanks to Lifetalk.. this problem solved :)


now remaining Full Page Script
,

so my desired link will convert into shorten link

desired link means : particular domain [like mediafire.com, wupload.com, filesonic.com] only such links will get converted..


Hope this is possible..
Can anyone help ??

Contact info
sandippatel1110@gmail.com
 
Last edited:

12 comments

Why don't you use YOURLS
It is a short for Your Own URLS

http://yourls.org

It's free and reliable. Most webhost with CPANEL provide it with the Softacoulous Installer. It's easy to setup. Just need PHP and Database service. MYSQL or Firebird or what ever you have.
 
Here is one i dont use any more.

Code:
https://rapidshare.com/files/1097322345/eg_order_gavo.rar

I have full rights to it, so is ok to share here :)
 
@Gavo can you tell me whats the difference between your script and the adf.ly clone?

And thanks for sharing it as well.
 
Quick and messy code, but it works. You'll need to style the DIV elements though.

PHP:
<?php
if (isset($_GET['link']))
{
  $link = trim($_GET['link']);
}
?>

<script type="text/javascript"><!--
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
//--></script>


<div 
   id="example3div" 
   style="border-style:dotted; 
          padding:10px; 
          font-size:24px; 
          width:200px; 
          text-align:center;">

</div>

<script type="text/javascript"><!--
var containerID = "example3div";
var number = 10; //change to no. of secs to wait
var timerID = setInterval("CountdownTimer()",1000);
function CountdownTimer() {
if(number > 1) {
	number--;
	ReplaceContentInContainer(containerID,number);
	}
else {
	clearInterval(timerID);
	ReplaceContentInContainer(containerID,'<a href="<?php echo $link; ?>"><?php echo $link; ?></a>');
	}
}
//--></script>

Usage:
- Copy the code, save it to a file. Save file as .php (anyfile.php).
- Link in the format
Code:
http://example.com/file.php?link=http://filehost.com/file.ext
- Edit the code to change the countdown timer (check the comment for the variable to edit) and to style the DIV element.
 
hey,
Lifetalk you're really great.. :)

thanks for the script..

but if you can provide me the full page script in java so it can convert all link into above example as i do have around 12,000 links i can't edit each n every link.

means,
just put a full page script in between <body> and </body> tag will convert all links automatically to for selected domain and i don't wont exclude domain feature.

means, i want to convert only which has example.com, mydomain.com and so on the list of domain for which i want.

Code:
http://example.com/file.php?link=http://filehost.com/file.ext
just like zpages has a full page script..

here is the full page script of zpages if you could edit n make it ...

http://zpag.es/js/zl.js

and to use it here is the code, i have got from zpag.es
Code:
<script>
var z_t = 'pa'
var domains = ['mediafire.com','lulzimg.com', 'msn.com', 'megaupload.com', 'rapidshare.com', 'yoursite.com', ];
var z_vid = 7891213; [B][i don't need this one][/B]
var z_id = myid; [B][i also don't need this one][/B]
</script>
<script src="http://zpag.es/js/zl.js"></script>
btw,thanks for the help, its really works ! i love it...

or

Is there any script which auto add such prefix

Code:
http://example.com/file.php?link=

to selected domain ??
 
Last edited:
Try this javascript for full page script
Used zpage function too

Create a new file "autoshorten.js" or anything
Add this in that

PHP:
<!-- Soft2050 -- Auto Link Shortner through javascript
var alfoundlLinks = document.links;
for (var i=0; i<alfoundlLinks.length; i++) {

    if (chkcon(shortem, alfoundlLinks[i].href)) {
            alfoundlLinks[i].href = varurl + alfoundlLinks[i].href;
    } 
    
}

function chkcon(d_list, domain) {
    for(var i = 0; i < d_list.length; i++) {
        if(domain.toLowerCase().indexOf(d_list[i])>-1){
            return true;
        }
    }
    return false;
}

Then in your html page, add this according to your requirements:
PHP:
<script language="javascript" type="text/javascript">
var varurl = "http://localhost/index.php?link=";
var shortem = ['mediafire.com','lulzimg.com', 'msn.com', 'megaupload.com', 'rapidshare.com', 'yoursite.com', ];
</script>

Edit the var according to your setup

Finally, add this at the end of the document (adding at top won;t work)
PHP:
<script src="autoshorten.js" type="text/javascript"></script>

(Link to autoshorten.js)

This should work for lifetalk's code or any other script which can shorten links through $_GET
 
Really good info here, i will like to add if it´s possible to add Click N Load button somewhere (Or at a DLE Site), i read JD documents but i´m a bit confused:

http://jdownloader.org/knowledge/wiki/glossary/cnl2 (Fully Working Example)

49db7b8daf.png


You can press the button with JD open in background and add the links through ClickNLoad protocol of JD, using a secured way to transfer the links with javascript :)

Is this hard to implement? Thanks in advance
 
Status
Not open for further replies.

About the author

S
Active Member · Joined
327
Messages
39
Reactions
28
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom