...

View Full Version : Need help :(



gazaweb
12-08-2010, 01:07 PM
Hey all!

i came here last time for help and i though i got good service :D

so i haz a new problem :D

ok

i have a script called 'redirect.php' and its linked to my forum, now, when some one clicks a 'external link' they will be taken to the redirect script in the following fashion

Example Link: http://google.co.uk

transforms to

http://bouncy-soundz.info/redirect.php?http://google.co.uk

simples really, BUT i want to BAN some links redirecting out!

so say i wanted google banned, i want them to be taken to a 'THIS PAGE IS BANZORD' or summint :P

the code!

redirect.php


<?php
/*
Example Useage:

<script src="/public/js/hide.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
protected_links = "url.com, url2.com";
auto_anonymize();
//--></script>



________ _____ __________ _____
/ _____/ / _ \ \____ / / _ \
/ \ ___ / /_\ \ / / / /_\ \
\ \_\ \/ | \/ /_/ | \
\______ /\____|__ /_______ \____|__ /
\/ \/ \/ \/
_____ ____________________ _________
/ _ \\______ \______ \/ _____/
/ /_\ \| ___/| ___/\_____ \
/ | \ | | | / \
\____|__ /____| |____| /_______ /
\/ \/
*/
/************************************************************************/
/* Redirector Script codded by Gaza for Bouncy Soundz Radio */
/************************************************************************/
/* redirect.php */
/************************************************************************/

define( 'IPB_THIS_SCRIPT', 'public' );
require_once( './initdata.php' );

require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );

?>
<?

//**********************************************************//

function tpl ($template)
{
if (file_exists ('public/redirect/templates/' . $template . '.html'))
{
include 'public/redirect/templates/' . $template . '.html';
}

}

function logfile ()
{
global $link_url;
global $config;
if ($config['log'] == 1)
{
$fp = fopen ('public/redirect/logs/index.html', 'a');
fwrite ($fp, 'Forwarded to: <B>' . $link_url . '</b> - IP of User: <b>' . $_SERVER['REMOTE_ADDR'] . '</b> - Referrer: <b>' . $_SERVER['HTTP_REFERER'] . '</b> - User Agent: <b>' . $_SERVER['HTTP_USER_AGENT'] . '</b> Timestamp: <b>' . date("l jS \of F g:i A.", time()) . '</b><br /><br />
');
fclose ($fp);
}

}

$config['prcl'] = '';
$config['time'] = 7;
$config['log'] = 1;
$link_url = $_SERVER['QUERY_STRING'];
if ($link_url != '')
{
if (substr ($link_url, 0, 7) != '')
{
$link_url = $link_url;
}

$link_head = $link_url;
$link_time = $config['time'];
logfile ();
tpl ('page_redirect');
exit ();
}

tpl ('page');
exit ();
?>


page_redirect.html

<?
global $link_head;
global $link_time;

//BANNZORD SITES =D
$banned_sites = array('google', 'youtube', 'facebook');

$site = $link_head;
$get_banned = $banned_sites;
$pos = strpos($site, $get_banned);

//CODEY BITS =P
if ($pos === true) {
echo "This site is in our ban list and you are NOT allowed to redirect through our site!";
} else {

?>

<html>
<!--
________ _____ __________ _____
/ _____/ / _ \ \____ / / _ \
/ \ ___ / /_\ \ / / / /_\ \
\ \_\ \/ | \/ /_/ | \
\______ /\____|__ /_______ \____|__ /
\/ \/ \/ \/
_____ ____________________ _________
/ _ \\______ \______ \/ _____/
/ /_\ \| ___/| ___/\_____ \
/ | \ | | | / \
\____|__ /____| |____| /_______ /
\/ \/
-->
<head>
<title>You are now leaving Bouncy Soundz and going to <?=$link_head?> in <?=$link_time?> seconds</title>
<meta http-equiv="refresh" content="<?=$link_time?>; URL=<?=$link_head?>">
<link rel="shortcut icon" href='http://bouncy-soundz.info/favicon.ico' />
<LINK REL='StyleSheet' HREF="/public/style_css/css_6/ipb_styles.css" TYPE="text/css" MEDIA='screen'>
<LINK REL='StyleSheet' HREF="/public/style_css/css_6/ipb_common.css" TYPE="text/css" MEDIA='screen'>

<script type="text/javascript">
window.onload = function() {
startCountDown(7, 1000, myFunction);
var finishedmsg = "Redirecting...";
}
function startCountDown(i, p, f) {
var pause = p;
var fn = f;
var countDownObj = document.getElementById("countDown");
if (countDownObj == null) {
alert("Countdown Dissabled");
return;
}
countDownObj.count = function(i) {
countDownObj.innerHTML = i;
if (i == 0) {
fn();
return;
}
setTimeout(function() {
countDownObj.count(i - 1);
},
pause
);
}
countDownObj.count(i);
}
function myFunction() {
}
</script>

</head>
<body id="ipboard_body">

<div id='ipbwrapper'>

<div id="header">
<!-- Logo -->
<div id="feature_logo">
<a href='/' rel="home" accesskey='1'><img src='http://bouncy-soundz.info/uploads/images/BOUNCY-SOUNDZ-1290979587-U1.png' alt='Bouncy Soundz Logo' /></a>
</div>
</div><br />
<!-- [END]Logo -->
<div id='content' class='clear'>
<h3 class='maintitle' />You are now leaving Bouncy Soundz</h3><br />
<center>
You are now leaving Bouncy Soundz and going to:<br /><br />
<h2><a href='<?=$link_head?>' /><?=$link_head?></a></h2><br />
Time Left: <div id="countDown">Loading...</div>

<p><span class="bbc_right"><span style="font-size: 9px;">Powered by <a href='http://bouncy-soundz.info' />Bouncy Soundz</a></span></span></p>
</div>
<div id='content' class='clear'>
<center>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-0867181130243716";
/* BS LEAVING 2 */
google_ad_slot = "7473953677";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
</div>
<center><small><font color='#ffffff' />&copy; <a href='http://bouncy-soundz.info/index.php/user/1-dj-gaza/' />Gaza Apps</a> 2010 | Coded by <a href='http://bouncy-soundz.info/index.php/user/1-dj-gaza/' />DJ Gaza</a> | <a href='http://bouncy-soundz.info' />Bouncy Soundz</a></font></small></center>
</body>
</html>
<?
}
?>


now if you can help and come up with a soloution to where im going wrong, it would be GREAT!!!

mlseim
12-08-2010, 05:15 PM
This might get you closer ...



<?php
global $link_head;
global $link_time;

//BANNZORD SITES =D
$banned_sites = array('google', 'youtube', 'facebook');

$site = $link_head;

//CODEY BITS =P
if(in_array_like($site,$banned_sites)){
echo "This site is in our ban list and you are NOT allowed to redirect through our site!";
} else {

echo "ok";
}


function in_array_like($reference,$array){
foreach($array as $ref){
if (strstr(strtolower($reference),strtolower($ref))){
return true;
}
}
return false;
}

?>

gazaweb
12-08-2010, 10:04 PM
where do i add the html about on it ?

coz i also need the html!

coz i want it to only redirect if the site aint in the ban list!

mlseim
12-08-2010, 11:16 PM
In this example, if google is found, it displays a message on a blank white screen and halts. If everything is OK, it just drops through to the HTML.

I'm not sure if that's what you want to do or not.
If you want to redirect to another page (for a failure), you can do that too.
But, your intentions are not clear.

DROP DOWN TO HTML IF THE LINK IS OK ...


<?php
global $link_head;
global $link_time;

//BANNZORD SITES =D
$banned_sites = array('google', 'youtube', 'facebook');

$site = $link_head;

//CODEY BITS =P
$flag=0;
if(in_array_like($site,$banned_sites)){
echo "This site is in our ban list and you are NOT allowed to redirect through our site!";
exit;
} else {
// user is OK ... so do nothing.
}


function in_array_like($reference,$array){
foreach($array as $ref){
if (strstr(strtolower($reference),strtolower($ref))){
return true;
}
}
return false;
}

?>

<html>
<body>
your website here
</body>
</html>





REDIRECT TO ANOTHER PAGE IF THE LINK IS OK ...


<?php
global $link_head;
global $link_time;

//BANNZORD SITES =D
$banned_sites = array('google', 'youtube', 'facebook');

$site = $link_head;

//CODEY BITS =P
$flag=0;
if(in_array_like($site,$banned_sites)){
echo "This site is in our ban list and you are NOT allowed to redirect through our site!";
exit;
} else {
// user is OK ... so redirect to "otherpage.php" ...
header ("location: otherpage.php");
}


function in_array_like($reference,$array){
foreach($array as $ref){
if (strstr(strtolower($reference),strtolower($ref))){
return true;
}
}
return false;
}

?>

gazaweb
12-08-2010, 11:54 PM
ok thanks, its the one where it displays the page if everything is ok :)

once again, thanks for your help, ill let you know if it works when my server is back up and running lol

gazaweb
12-09-2010, 06:46 PM
ok, turns out this is a 'malware' script

so both the php scriitps are infecting the sevrer

is this true, is there any way you can find out ?

mlseim
12-10-2010, 12:35 AM
You're talking about Gaza Apps?

Interesting. I've never use scripts like that before.
Maybe others know something.

gazaweb
12-10-2010, 12:02 PM
i coded this myself lol

i am gaza haha

problem is, the server owner says the script is infected in some shape or form :(

mlseim
12-10-2010, 01:49 PM
The redirecting process might be seen as suspicious to the server?

gazaweb
12-10-2010, 03:24 PM
so from wat u can see, its definetly not calling anywhere outside the server!

so it cant be malicouse :(
^ big word :O



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum