a little PHP coding help please

Discussion in 'Programming' started by KinetiX, Jul 3, 2009.

  1. #1
    hey
    i have a script here.. it uses a lang.core.php file in wich it stores a code and the message it shows for that code
    so i got something like this:

    
    $LANG['core'] = array (
    "no_access" =>
    "You cannot access this page." ,
    );
    
    Code (markup):
    so on the site where that no_access thing shows up it will show the "You cannot access this page" message

    what i want to obtain is instead of showing that message to redirect the users to a URL i want them to go to..

    is there a way to obtain this from this lang.core.php file so i won`t have to go through all the languages files (there are alot of them) and try to make it work from there

    thanks
     
    KinetiX, Jul 3, 2009 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    Replace
    "You cannot access this page."
    Code (markup):
    With
    "<script type='text/javascript'>window.location='http://www.google.com';</script>"
    Code (markup):
    That's my best suggestion. Another option would be PHP's redirect, but I assume the headers are long sent by then.
     
    crath, Jul 3, 2009 IP
  3. KinetiX

    KinetiX Member

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    nah :(
    all site goes blank if i put that in :(
     
    KinetiX, Jul 3, 2009 IP
  4. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #4
    Can you link me to a page that is "blank" when using that code?
     
    crath, Jul 3, 2009 IP
  5. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #5
    @KinetiX: If you view source and see nothing in it, maybe there's some error in parsing your php file.
     
    thuankkk, Jul 4, 2009 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    Try changing it too


    "\<script type\=\'text/javascript\'\>window.location\=\'http://www.google.com\'\;\<\/script\>"
    Code (markup):
     
    Bohra, Jul 4, 2009 IP
  7. jhbalaji

    jhbalaji Well-Known Member

    Messages:
    1,474
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    140
    #7
    Yeah this will work in php mate...
     
    jhbalaji, Jul 5, 2009 IP
  8. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #8
    I helped him out over IM, the script I posted actually worked out for him. Thanks though
     
    crath, Jul 5, 2009 IP