Access Forbidden

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Access Forbidden

Postby rednek » 06. January 2015 02:27

Here is the error I get when I try to login to add events to my calendar.

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3

I have a script calendar that you have to login to add events to the calendar. When I click on login the popup shows I enter the user and password but get that error.

here is the function code for the login button

Code: Select all
function footprint($auth, $m, $y)
{
   global $lang;

   echo "
   <br><span class=\"footprint\">\n[ ";
   
   if ( $auth == 2 ) {
      echo "
      <a href=\"useradmin.php\">" . $lang['adminlnk'] . "</a> |
      <a href=\"login.php?action=logout&month=$m&year=$y\">"
      . $lang['logout'] . "</a>";
   } elseif ( $auth == 1 ) {
      echo "
      <a href=\"useradmin.php?flag=changepw\">" . $lang['changepw'] . "</a> |
      <a href=\"login.php?action=logout&month=$m&year=$y\">"
       . $lang['logout'] . " </a>";
   } else {
      echo "<a href=\"javascript:loginPop($m, $y)\">"
      . $lang['login'] . "</a>";
   }
   echo " ]</span>";


I'm guess I have to set some type of permissions but am new to XAMPP. Any help would be great. I use XAMPP or testing purpose's to make sure everything works right before putting online.

Thanks
Kevin
rednek
 
Posts: 3
Joined: 06. January 2015 02:17
Operating System: windows 8

Re: Access Forbidden

Postby rednek » 06. January 2015 02:48

Doing a little more checking I see this in view source.

<b>Notice</b>: Undefined variable: HTTP_SERVER_VARS in <b>C:\xampp\htdocs\login.php</b> on line <b>61</b><br />
?action=login&month=1&year=2015"

Now here is the login.php. Seems the HTTP_SERVER_VARS is where the problem must be.

Code: Select all
<?php
require("config.php");
require("./lang/lang.admin." . LANGUAGE_CODE . ".php");
require("functions.php");

$action = 'show_form';

# it a pain to have to check before using, but php complains when E_NOTICES on
if (isset($_GET['action'])) {
   $action   = $_GET['action'];
}

# get month and year to preserve state
$m       = (int) $_GET['month'];
$y       = (int) $_GET['year'];

# if login, and auth returns true, then refresh month view, and close window
if ($action == "login"
   && auth($_POST['username'], $_POST['password']) ) {
   echo "<script language=\"JavaScript\">";
   echo "opener.location = \"index.php?month=$m&year=$y\";";
   echo "window.setTimeout('window.close()', 500);";
   echo "</script>";
} elseif ($action == "logout") {
   session_start();
   session_destroy();
   header ("Location: index.php?month=$m&year=$y");
} else {
?>
   <html>
   <head>
   <script language="JavaScript">
   function firstFocus()
   {
      if (document.forms.length > 0) {
         var TForm = document.forms[0];
         for (i=0;i<TForm.length;i++) {
            if ((TForm.elements[i].type=="text")||
                (TForm.elements[i].type=="textarea")||
               (TForm.elements[i].type.toString().charAt(0)=="s")) {
               document.forms[0].elements[i].focus();
               break;
            }
         }
      }
   }
   </script>
   <title><?php echo $lang['logintitle']?></title>
   <link rel="stylesheet" type="text/css" href="css/adminpgs.css">
   </head>
   <body onLoad="firstFocus()">
<?php
   if( isset( $_POST['username'] ) ) {
      echo "<span class=\"login_auth_fail\">" . $lang['wronglogin'] . "</span><p>\n";
   }
?>
   <span class="login_header"><?php echo $lang['loginheader']?></span>
   <br><img src="images/clear.gif" width="1" height="5"><br>
   
   <table>
   <form action="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>?action=login&month=<?php echo $m ?>&year=<?php echo $y ?>" method="post">
         <tr>
            <td nowrap valign="top" align="right" nowrap>
            <span class="login_label"><?php echo $lang['username']?></span></td>
            <td><input type="text" name="username" size="29" maxlength="15"></td>
         </tr>
         <tr>
            <td nowrap valign="top" align="right" nowrap>
            <span class="login_label"><?php echo $lang['password']?></span></td>
            <td><input type="password" name="password" size="29" maxlength="15"></td>
         </tr>
         <tr><td colspan="2" align="right"><input type="submit" value="<?php echo $lang['login']?>"><td><tr>
   </form>
   </table>

   </body></html>
<?php
}
?>
rednek
 
Posts: 3
Joined: 06. January 2015 02:17
Operating System: windows 8

Re: Access Forbidden

Postby Altrea » 06. January 2015 03:37

We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Access Forbidden

Postby rednek » 06. January 2015 04:12

http://php.net/manual/en/reserved.variables.server.php


Thank You Altrea for the information. Changed HTTP_SERVER_VARS to _SERVER and everything worked fine.
rednek
 
Posts: 3
Joined: 06. January 2015 02:17
Operating System: windows 8


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 72 guests