Jump to content

Recommended Posts

On my script on the main page which is login.php

 

say the domain was www.test.com/login.php

 

if some one changes that url to:

www.test.com/login.php/css

 

The script crashes and i have no idea how that happens?

This is the error i get when a user changes the url to that:

 

 

Notice: A session had already been started - ignoring session_start() in session.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at session.php:2) in session.php on line 4

 

surely login.php/css is an invalid url ? But it seems to not give a "cannot find url" error that i was hoping it would =/

Link to comment
https://forums.phpfreaks.com/topic/132962-script-crashes-with-url-alteration/
Share on other sites

Doing that causes several server variables to contain the /css at the end -

    [REQUEST_URI] => /login.php/css

    [PATH_INFO] => /css

    [PATH_TRANSLATED] => your_path\htdocs\css

    [php_SELF] => /login.php/css

 

Is your login.php code using any of those or are you doing any URL rewriting?

 

Argh it is checking to see if such a url exists and if it does do not load a session as one is already set.

 

But then, if the url changes the if statement would fail and then two session start's are set... which is what must be causing the error.

How can i prevent the crash though?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.