GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   Script/Code/HTML for redirecting (https://gfy.com/showthread.php?t=1114224)

lbazso 07-02-2013 08:24 AM

Script/Code/HTML for redirecting
 
Hey Guys,

I am redirecting traffic to an url and from there I would like to create/copy a code/script/html (whatever works) so when the traffic comes in, it could not just redirect to 1 url but to randomly use one from a list of url's each time or every 5th time for example.

I hope I wrote it clearly. I am trying to explain it the best I can!

I would really appreciate some help or advise!

Thanks so much! :thumbsup

Laszlo

Best-In-BC 07-02-2013 08:32 AM

I use to have a php script that just picked a random url out of a text file to go to. Is this what your talking about ?

lbazso 07-02-2013 09:13 AM

Quote:

Originally Posted by Best-In-BC (Post 19698616)
I use to have a php script that just picked a random url out of a text file to go to. Is this what your talking about ?

That sounds about right! :)

Does it redirect too?

Thanks in advance! :thumbsup

lbazso 07-06-2013 05:42 AM

I am still looking for a script. If anyone can help, it would be greatly appreciated. Thanks! :)

lbazso 07-06-2013 07:19 AM

Quote:

Originally Posted by lbazso (Post 19705086)
I am still looking for a script. If anyone can help, it would be greatly appreciated. Thanks! :)

Never mind. I have found one and it works:

Code:

<script type="text/javascript">

var urls = new Array("http://www.url1.com/", "http://www.url2.com/");

function redirect()
{
window.location = urls[Math.floor(urls.length*Math.random())];
}

var temp = setInterval("redirect()", 1000);

</script>


Nevet 07-06-2013 07:29 AM

That won't work for users without Javascript, of course.

lbazso 07-06-2013 07:30 AM

Quote:

Originally Posted by Nevet (Post 19705159)
That won't work for users without Javascript, of course.

Thanks! :thumbsup

alcstrategy 07-06-2013 11:52 AM

here is a very simple example in php

<?php
$urls = file('urls.txt');
$rand = array_rand($urls);
header("Location: {$urls[$rand]}");
?>

in urls.txt make each line a url

this is just a simple example and should be put before output otherwise you technically could put ob_start() at the beginning and supress output

Zeiss 07-06-2013 12:28 PM

Better go the php way as above. :winkwink:

RaunchyRepublic 07-07-2013 12:15 AM

This is SEO suicide too, you know that right?

lbazso 07-07-2013 01:50 AM

Quote:

Originally Posted by RaunchyRepublic (Post 19706117)
This is SEO suicide too, you know that right?

Yeah, I am aware of that. It has a different purpose. :)

lbazso 07-07-2013 01:51 AM

Quote:

Originally Posted by Zealotry (Post 19705591)
Better go the php way as above. :winkwink:

Thanks for your input! :)

lbazso 07-07-2013 01:52 AM

Quote:

Originally Posted by alcstrategy (Post 19705517)
here is a very simple example in php

<?php
$urls = file('urls.txt');
$rand = array_rand($urls);
header("Location: {$urls[$rand]}");
?>

in urls.txt make each line a url

this is just a simple example and should be put before output otherwise you technically could put ob_start() at the beginning and supress output

Thanks so much! Appreciate it! :)

alcstrategy 07-07-2013 11:50 AM

no problem. It's very simple but if you need any more help with it just let me know

lbazso 07-08-2013 07:25 AM

Quote:

Originally Posted by alcstrategy (Post 19706650)
no problem. It's very simple but if you need any more help with it just let me know

Thanks again and I will contact you! :thumbsup

lbazso 07-10-2013 11:52 AM

Quote:

Originally Posted by alcstrategy (Post 19706650)
no problem. It's very simple but if you need any more help with it just let me know

Hi again,

I just would like to let you know that I have made my first sale since I have started using your php code! Thank you so much!!!! :thumbsup

Laszlo

alcstrategy 07-10-2013 11:58 AM

ha no problem glad I could help :)

lbazso 07-10-2013 12:06 PM

Quote:

Originally Posted by alcstrategy (Post 19711158)
ha no problem glad I could help :)

It's fantastic!!!! :D


All times are GMT -7. The time now is 11:50 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123