Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-04-2006, 12:17 AM
Pip_X's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: Malaysia
Posts: 16
Rep Power: 0
Pip_X is on a distinguished road
Send a message via ICQ to Pip_X Send a message via MSN to Pip_X
Total newbie here >_<

Halo everybody rock your body happy go lucky dun worry be happy~!!!
Me just decided to start learn php and mysql 2day!

Read some book and the php manual for half hour already and found it to be very interesting. Had a web, php and mysql server since 2 years already, for host some stuff, but now me wanna write my own stuff.

But however, me need a quick urgent help from master here. Me wanna write a very simple link or website checker and return some value if it's valid, and other value if it's not.

Here's what me think the structure of the code (cincai code saja, syntax salah punya) should be:
Code:
<?php
&url = 'http://URL.com';

IF &url = valid/true;
     redirect to &url;
ELSE
     echo 'The website u trying to masuk sudah down kena tembak etc etc';
?>
How? Please tell me php can do this...
__________________
<hr>
Enjoy Life!!! Damnit!!!!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-04-2006, 11:19 AM
Pip_X's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: Malaysia
Posts: 16
Rep Power: 0
Pip_X is on a distinguished road
Send a message via ICQ to Pip_X Send a message via MSN to Pip_X
Ok, me found a solution on the web and modified my code to:
Code:
<?php
$up = @fsockopen("pipx.zapto.org/scripts/HScart-v2.0.1", 80, $errno, $errstr, 30);  
if($up) 
{  
   echo "<html><head><meta http-equiv=\"REFRESH\" content=\"0;URL=http://pipx.zapto.org/scripts/HScart-v2.0.1\"><title>LOADING...</title></head><body text=\"#FFFFFF\" bgcolor=\"#000000\"></body></html>";  
} 
else 
{
   echo "<html><head><meta http-equiv=\"REFRESH\" content=\"0;URL=http://www.pipx.net/personal/index.htm\"><title>LOADING...</title></head><body text=\"#FFFFFF\" bgcolor="\#000000\"></body></html>";
}
?>
And the output me saw on IE is
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
Why? Cannot jump jump website like this ka???
__________________
<hr>
Enjoy Life!!! Damnit!!!!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-04-2006, 01:12 PM
phantomic's Avatar
Novice Webmaster
 
Join Date: Jan 2003
Location: KL
Posts: 91
Rep Power: 70
phantomic is on a distinguished road
Send a message via AIM to phantomic Send a message via MSN to phantomic Send a message via Yahoo to phantomic Send a message via Skype™ to phantomic
Red face

I'm not sure what kind of URL comparison you're trying to do. Are you trying to do a refferer check? If so, you can try this code. I just made this, it might not work since i haven't tested it (but it should work!) . If it doesn't work let me know, i'll fix it.

Code:
<?  

/* declare your url */
$url = 'http://www.something.com';

/* http referer is to check where's the traffic is coming from and compare with the above url */

if ($_SERVER['HTTP_REFERER'] == $url ) {

/* this line redirect user to other site */
header('location: http://someotherwebsiteyouwant.com');

}

else {
 /* if the url doesnt match, it will echo out the line "website dah kene tembak etc */

 echo "website dah kene tembak etc";
}
?>
If somehow you get the error message "header already sent or something" ( ie : bcoz you set cookies at the beginning of the page etc,) you can replace the header('location...) line with this script

Code:
echo"<script>window.location='http://someotherwebsitethatyouwant.com';</script>";
Hope that helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie. (-_-) kingbar Member Introductions 2 29-12-2006 11:22 AM
Total form looping textfield koisempoi Website Design 2 09-05-2005 12:35 PM
Whois: total domain hosted Filuren Paid Hosting Discussion Forum 12 08-10-2004 01:54 AM
Count total of records jeb23 Website Programming 17 04-02-2004 07:15 PM
PHP FrameWork For TOTAL NEWBIE bazet Website Programming 13 02-12-2002 04:19 PM



All times are GMT +8. The time now is 11:12 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59