Status
Not open for further replies.

roadrunner

Active Member
600
2011
127
0
Or atleast i think thats what i need... :facepalm:

I have an Image Hosting website and at the moment if the thumbs are clicked it redirects via an ad.fly short code..

Its getting 1000+ UV's a day and only making me around $2

So what i want to do is get rid of the adf.ly link and have it so when an end user clicks the thumb in a forum or where ever its posted, it redirects to my site where a forced 5 second add is displayed then the link will display and off they go to the image.

Now im not very clever at code, but i can muddle through when needed, im not asking for someone to do it for me or being lazy ,I just need a pointer in the right direction.

Thanks all

RR
 
24 comments
Ok so i have found what i want BUT im unsure how to implement it.

URL:
http://tih.me/test.php <---- This does what i want

Im stuck on

1/ How to make it so it lands there from the thumb click
2/ Redirect to the correct image

Thanks
RR
 
yeah it redirects to what ever url i put in there, but what i want to do is make it redirect to the original path.

So for instance you click this image:

tih.me
[/URL][/IMG]

It would take you to the picture

What i want is for the test.html to show then goto http://tih.me/?pm=16J1 but the end picture ID changes per picture so is there a way that the test.html page can show then travel on to where its ment to, with out me having to make a page for every image upploaded.

If you test it again http://tih.me/test.html it will bring you right back here, but i have had to manually add the url..

Cheers
RR
 
ah, so you need test.php not html
and do something like the following code:
PHP:
<?php
if(isset($_GET['pm'])){ ?>

<html> 

<head> 

<title>Webcoding Easy Advertisment</title> 

<script type="text/ecmascript"> 

			// <![CDATA[

			

				function skip_page()

				{

					var attachform = document.getElementById("seconds");

					var form = document.createElement("form");

					form.setAttribute("method", "post");

					form.setAttribute("action", "");

					var inp = document.createElement("input");

					inp.setAttribute("type", "hidden");

					inp.setAttribute("value", "true");

					inp.setAttribute("name", "pop_under_skip");

					form.appendChild(inp);

					attachform.appendChild(form);

					form.submit();

				}

				var seconds = "5";

				function redirect()

				{

					window.location = "http://tih.me/?pm=<?php echo $_GET['pm']; ?>";

				}

				function update ()

				{

					if(seconds > 0)

					{

						seconds--;

						document.getElementById("seconds").innerHTML = seconds + " seconds left";

						setTimeout("update();", 1000);

					}

					else

					{

						document.getElementById("seconds").innerHTML = "Redirecting";

						setTimeout("redirect();", 1000);

					}

				}

				

				window.onload = function () 

				{

					setTimeout("update();", 1000);

				}			

			// ]]>

			</script> 

</head> 

<body> 

<table style='height:80px; width:100%; text-align: center; border: 0;'> 

<tr> 

	<td style='width: 70%'> 

		<h3>Webcoding Easy</h3> 

	</td> 

	<td style='width: 30%'> 

		<p id='seconds'>Waiting for page to load</p> 

		

	</td> 

</tr> 

</table> 

<iframe name='content' src='http://webcodingeasy.com' width='100%' height='100%'/> 

<noframes>

<p><a href='/my_classes/pop_under_class/example.php?id=1'>Continue to page</a></p>

</noframes>

</body>

</html>
<?php }
else {
//redirect to home or show an error or something
}
?>

don't forget to change the source frame too
 
Ok cool i understand that .....so now im in my config.php trying to make the output look right.

The original is this:
Code:
return (!is_null($linkaddress)?'[URL='.$linkaddress.']':'').'[IMG]'.$imageaddress.'[/IMG]'.(!is_null($linkaddress)?'[/URL]':'');

Mine is this:
Code:
return (!is_null($linkaddress)?'[URL=http://tih.me/advert.php'.']':'').'[IMG]'.$imageaddress.'[/IMG]'.(!is_null($linkaddress)?'[/URL]':'');

Now of coarse this isnt working because its not adding the (id) after the advert.php

Any ideas ?

Cheers
RR
 
Sorry my mistake mine reads:

Code:
return (!is_null($linkaddress)?'[URL=http://tih.me/advert.php]':'').'[IMG]'.$imageaddress.'[/IMG]'.(!is_null($linkaddress)?'[/URL]':'');

If you go here:
http://tih.me/?pm=Y655

You will see under "BBCode (Forums):" the output, its missing the "?pm=Y655"

And i cant figure out how to get it there

Thanks
RR
 
Great stuff thanks. !

I made it

Code:
http://tih.me/advert.php?pm='.$_GET["pm"]

And it worked great, now just need to figure out why all my pictures have just decided not to show :(

Thanks for your help

RR
 
Last bit im stuck on now is how do i make iframe content random between a list or URL's, at the moment the code is:

PHP:
iframe name='content' src='http://gamezscope.com' width='100%' height='100%'

What i need to is have it randomly pick a URL from a list

Cheers
RR
 
just make a txt file, lets say "url.txt" where you put every url in a new line, then go back to your php file:
PHP:
 $urls = file('url.txt');
$url = $urls[array_rand($urls)];
then put $url in the right place
 
Ok again i can see and understand exactly what that means and what it will do, and i think i have made a small mistake.

This is what i have done:

PHP:
<?php 
if(isset($_GET['pm'])){ 

 $urls = file('url.txt');
$url = $urls[array_rand($urls)];  

?> 

<html>  

<head>  

<title>Torrent Image Hosting</title>  

<script type="text/ecmascript">  

            // <![CDATA[ 

             

                function skip_page() 

                {

I have added the url.txt to the root and it looks like this:

Code:
http://ovhdirect.co.uk
http://gamezscope.com
http://bbc.co.uk
http://google.co.uk


And finaly i have added $url into advert.php like this:


PHP:
</table>  

<iframe name='content' src='$url' width='100%' height='100%'/>  

<noframes> 

<p><a href='/my_classes/pop_under_class/example.php?id=1'>Continue to page</a></p> 

</noframes>

But if you click here it dosn't quite work:



Thanks
RR
 
Last edited:
Works a treat THANKS

And just so i know i guess we had to use the <?php echo $url; ?> because futher up the page we used ?> which i prusume sort of said " we have finished with the php now onto html" so the <?php CODE ?> re-opended php then shut it again ?

Do you have a website or URL i can add to the url.txt you have helped loads here m8

Cheers
RR
 
And just so i know i guess we had to use the <?php echo $url; ?> because futher up the page we used ?> which i prusume sort of said " we have finished with the php now onto html" so the <?php CODE ?> re-opended php then shut it again ?
yes, that's it

Do you have a website or URL i can add to the url.txt you have helped loads here m8

no, that's cool :)
 
Ive come across a slight error

When you browse and upload a new image, it does its thing and displays the output code for BB html etc etc

The problem is the code looks like this:
PHP:
tp://tih.me/advert.php?pm=][IMG]http://tih.me/?dt=3EC2[/I

As opposed to what it should look like:
PHP:
tp://tih.me/advert.php?pm=3EC2][IMG]http://tih.me/?dt=3EC2[/I

Notice the
PHP:
advert.php?pm=3EC2
in the second one.
BUT if after uploading you goto gallery and click your picture, it will display the correct output, but i cant reall expect useres to do that, they would just use the first output they are given, which takes them to a 404

Thanks
RR
 
Status
Not open for further replies.
Back
Top