Results 1 to 3 of 3

Thread: Total newbie here >_<

  1. #1
    Join Date
    Jul 2003
    Location
    Malaysia
    Posts
    16
    Rep Power
    0

    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!!!!!!!

  2. #2
    Join Date
    Jul 2003
    Location
    Malaysia
    Posts
    16
    Rep Power
    0
    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!!!!!!!

  3. #3
    Join Date
    Jan 2003
    Location
    KL
    Posts
    95
    Rep Power
    203

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Website total revamp
    By imz76 in forum Looking To Hire
    Replies: 1
    Last Post: 18-06-2009, 10:59 AM
  2. A total noob
    By kenx76 in forum Member Introductions
    Replies: 3
    Last Post: 07-11-2007, 08:40 AM
  3. Total newbie here
    By putratrg in forum Member Introductions
    Replies: 3
    Last Post: 18-06-2007, 10:17 AM
  4. Count total of records
    By jeb23 in forum Website Programming
    Replies: 17
    Last Post: 04-02-2004, 07:15 PM
  5. PHP FrameWork For TOTAL NEWBIE
    By bazet in forum Website Programming
    Replies: 13
    Last Post: 02-12-2002, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112