Funny thing about php code, it's server side so I can't view it from your url. If you want help troubleshooting the code, you will need to post it here.
Also, the link you provided me linked me to http://www.codingfor...ad.php?t=285068
27 Replies - 698 Views - Last Post: 31 December 2012 - 12:43 PM
#16
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 09:29 AM
#17
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 09:35 AM
Sorry for that
Here is the code:
And yes, its the correct url which you are seeing.
Now this url is http://taimoorsultan.com/url/n linking to our this thread.
Here is the code:
<?php
/*
Plugin Name: Redirection Ads
*/
// Hook our custom function into the 'pre_redirect' event
yourls_add_action( 'pre_redirect', 'warning_redirection' );
// Our custom function that will be triggered when the event occurs
function warning_redirection( $args ) {
$url = $args[0];
$code = $args[1];
// Output AdSense
?>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3096305097062678";
/* 125x125, created 1/21/11 */
google_ad_slot = "3050924195";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php
// Redirect in 10 seconds
header('Refresh:10;url=$url');
}
?>
And yes, its the correct url which you are seeing.
Now this url is http://taimoorsultan.com/url/n linking to our this thread.
#18
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 09:38 AM
Your using $url in your redirection. What value does it contain?
What output does the following provide?
What output does the following provide?
<?php
/*
Plugin Name: Redirection Ads
*/
// Hook our custom function into the 'pre_redirect' event
yourls_add_action( 'pre_redirect', 'warning_redirection' );
// Our custom function that will be triggered when the event occurs
function warning_redirection( $args ) {
$url = $args[0];
$code = $args[1];
// Output AdSense
?>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3096305097062678";
/* 125x125, created 1/21/11 */
google_ad_slot = "3050924195";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php
if(!isset($url)) {
echo "url was not set";
} else {
// Troubleshooting
echo "Redirecting to ".$url;
// Redirect in 10 seconds
header('Refresh:10;url=$url');
}
}
?>
#19
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 09:42 AM
$url contains the destination url for every shorten url.
This is the output of the url after placing the code you have given.
http://taimoorsultan.com/url/n
This is the output of the url after placing the code you have given.
http://taimoorsultan.com/url/n
#20
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 09:47 AM
taim, on 31 December 2012 - 11:42 AM, said:
$url contains the destination url for every shorten url.
I know what you want it to contain. I'm trying to get you to think about it more programmatically. There is a common issue with new developers known as "do what I want, not what I say". You can remove this confusion by outputting variables for visual verification.
#21
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 09:53 AM
If the following doesn't work, then I don't have an answer. My mockup works fine, but when you plug that into your yourls, there must be some sort of conflict. Without knowing more about the product, I couldn't tell you what the issue is.
** Edit **
Made a small edit to the url in the header line. Single quotes do not evaluate (or shouldn't) php strings. So either change that line to double quotes, or use it how I provided it. I dont' think that's the error, but it's more correct, imo.
<?php
/*
Plugin Name: Redirection Ads
*/
// Hook our custom function into the 'pre_redirect' event
yourls_add_action( 'pre_redirect', 'warning_redirection' );
// Our custom function that will be triggered when the event occurs
function warning_redirection( $args ) {
$url = $args[0];
$code = $args[1];
// Output Header information
if(!isset($url)) {
echo "url was not set";
} else {
// Troubleshooting
echo "Redirecting to ".$url;
// Redirect in 10 seconds
header('Refresh:10;url='.$url);
}
// Output AdSense
?>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3096305097062678";
/* 125x125, created 1/21/11 */
google_ad_slot = "3050924195";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php } ?>
** Edit **
Made a small edit to the url in the header line. Single quotes do not evaluate (or shouldn't) php strings. So either change that line to double quotes, or use it how I provided it. I dont' think that's the error, but it's more correct, imo.
#22
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 10:12 AM
ok, if I give your ftp and Yourls login details, can you check it then?
Thanks again!
#23
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 10:22 AM
Hrm, how about you show me where I ever suggested you use the following code :
Getting help from more than one place is fine, but it really wastes my time when someone else's suggestions are overstepping mine.
Quote
<script type="text/javascript">
window.location="http://www.dreamincode.net/forums/topic/305274-advertisement-plugin-for-yourls-shorten-url-script";
</script>
window.location="http://www.dreamincode.net/forums/topic/305274-advertisement-plugin-for-yourls-shorten-url-script";
</script>
Getting help from more than one place is fine, but it really wastes my time when someone else's suggestions are overstepping mine.
#24
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 10:30 AM
I have posted this question in lot of forums but still not a single reply from any of them. And I want to thank you for your time, as till now we have a long conversation.
Thanks
Thanks
#25
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 12:00 PM
Can you post your current code?
#26
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 12:22 PM
<?php
/*
Plugin Name: Ad Redirect
*/
// Hook our custom function into the 'pre_redirect' event
yourls_add_action( 'pre_redirect', 'warning_redirection' );
// Our custom function that will be triggered when the event occurs
function warning_redirection( $args ) {
$url = $args[0];
$code = $args[1];
// Print the message
header( "refresh:5;url=$url" );
echo 'You\'ll be redirected in about 5 secs.';
// Now die so the normal flow of event is interrupted
die();
}
Well, thanks to you.
As, this link http://taimoorsultan.com/url/o is going to twitter after 5 secs.
Oh, Happy New Year..
#27
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 12:27 PM
Somehow? It's because you passed refresh:5 to the header...
The above should give you what you need.
<?php
/*
Plugin Name: Ad Redirect
*/
// Hook our custom function into the 'pre_redirect' event
yourls_add_action( 'pre_redirect', 'warning_redirection' );
// Our custom function that will be triggered when the event occurs
function warning_redirection( $args ) {
$url = $args[0];
$code = $args[1];
// Redirect after 5 seconds
header( "refresh:5;url=$url" );
?>
<!-- Place HTML/Javascript for Google Ads here -->
<?php
// End Function warning_redirection
}
?>
The above should give you what you need.
#28
Re: Advertisement Plugin for Yourls Shorten Url Script?
Posted 31 December 2012 - 12:43 PM
Yes, its working after I play with it a little.
Now, this code is working exactly how I wish..
Thank you very much...
Now, this code is working exactly how I wish..
<?php
/*
Plugin Name: Ad Redirect
*/
// Hook our custom function into the 'pre_redirect' event
yourls_add_action( 'pre_redirect', 'warning_redirection' );
// Our custom function that will be triggered when the event occurs
function warning_redirection( $args ) {
$url = $args[0];
$code = $args[1];
// Print the message
header( "refresh:5;url=$url" );
echo 'You\'ll be redirected in about 5 secs.';
?>
<div style="margin:auto;">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3096305097062678";
/* 125x125, created 1/21/11 */
google_ad_slot = "3050924195";
google_ad_width = 125;
google_ad_height = 125;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<?php
// Now die so the normal flow of event is interrupted
die();
}
Thank you very much...
|
|

New Topic/Question
Reply




MultiQuote


|