# Can someone check my code please?

**URL:** <https://www.phphelp.com/t/can-someone-check-my-code-please/10330>\
**Category:** Beginners - Learning PHP\
**Created:** [September 14, 2007, 8:12am UTC](https://www.phphelp.com/t/can-someone-check-my-code-please/10330 "2007-09-14T08:12:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KainRacure](https://www.phphelp.com/letter_avatar_proxy/v4/letter/k/d9b06d/32.png) [@KainRacure](https://www.phphelp.com/u/KainRacure)\
**Post date:** [September 14, 2007, 8:12am UTC](https://www.phphelp.com/t/can-someone-check-my-code-please/10330/1 "2007-09-14T08:12:30Z")

</div>

I am really new to php and i am editing a website set up that I downloaded and there is something wrong with a redirect function, it is used when you log into the site to redirect you to the main page after logging in.

what it does is it sits on a page sayign in plain text “redirecting you to URL-HERE” and fails to redirect.

here is the code:

```auto
function redirect($linkto,$type=0,$wait_sec=0){
    if($linkto){
        if($type==0){
            global $redirect;
            $redirect = '<meta http-equiv="refresh" content="'.$wait_sec.';url='.$linkto.'" >';
        }else{
            header("location:".$linkto);
            exit('redirecting to: '.$linkto);
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![Q1712](https://www.phphelp.com/letter_avatar_proxy/v4/letter/q/a183cd/32.png) [@Q1712](https://www.phphelp.com/u/Q1712)\
**Post date:** [September 14, 2007, 8:44am UTC](https://www.phphelp.com/t/can-someone-check-my-code-please/10330/2 "2007-09-14T08:44:43Z")

</div>

u have to define $linkto, currently it is set to “URL-HERE”;

search for a line:  
[php]$linkto = “URL-HERE”;[/php]

and replace the URL-HERE with the real url.

---

<div class="post-metadata">

**Author:** ![KainRacure](https://www.phphelp.com/letter_avatar_proxy/v4/letter/k/d9b06d/32.png) [@KainRacure](https://www.phphelp.com/u/KainRacure)\
**Post date:** [September 14, 2007, 9:28am UTC](https://www.phphelp.com/t/can-someone-check-my-code-please/10330/3 "2007-09-14T09:28:56Z")

</div>

the $linkto is fine it shows the url of my site.

---

<div class="post-metadata">

**Author:** ![Q1712](https://www.phphelp.com/letter_avatar_proxy/v4/letter/q/a183cd/32.png) [@Q1712](https://www.phphelp.com/u/Q1712)\
**Post date:** [September 14, 2007, 9:43am UTC](https://www.phphelp.com/t/can-someone-check-my-code-please/10330/4 "2007-09-14T09:43:10Z")

</div>

have u turns on error\_reporting(E\_ALL)
