Jump to content

Forbidden 403 Error


DarkPrince2005

Recommended Posts

Ok guys and gals, hope somebody has a sollution for me.

 

I'm sending data via the url from one page to the next, it runs locally but as soon as i upload it and run it live it returns this error:

 

Forbidden

 

You don't have permission to access /vote_step_two.php on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

here is my code, it doesn't seem to like the url?

<?php
ini_alter("error_reporting", "E_ALL");
ini_alter("display_errors", "On");

require("inc/config.inc.php");
require("inc/lib.inc.php");

session_start();

$valid_list = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J");

foreach ($_POST as $key => $value) {
   list($button, $vote, $image) = explode("_", $key);
   if (in_array($image, $valid_list)) {
      header("Location:vote_step_two.php?image=$image");
      exit;
   }
}
?>
<html>
<head>
<title>n</title>

<link rel="STYLESHEET" type="text/css" href="css/div.css" />
<link rel="STYLESHEET" type="text/css" href="css/stylesheet.css" />
</head>
<body bgcolor="#0e0f1e" bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0">

<center><table cellpadding="0" cellspacing="0" border="0" height="100%" width="900">
<tr>
<td valign="center" align="center">
	<table cellpadding="0" cellspacing="0" border="0" height="640" width="900">
		<tr>
			<td height="640"><div class="main-body">
			<div class="bg"></div>

			<div class="border"></div>
			<div><? require("inc/nav.html");?></div>
			<div class="cstripe"></div>
<div class="content"><font color="#FFFFFF"><center><br />
<form name="form1" method="post" action="index2.php">
						    <table width="90%" border="0" cellpadding="0" cellspacing="0" class="finalist">
			                  <tr>
			                    <td align="left" valign="top">
								<img src="images/a.jpg" alt="Name" width="80"><br>
								<input type="submit" name="btn_vote_A" value="VOTE">                   
			                    </td>
			                    <td align="left" valign="top">
								<img src="images/b.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_B" value="VOTE">
								</td>
			                    <td align="left" valign="top">
								<img src="images/c.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_C" value="VOTE">
								</td>
			                    <td align="left" valign="top">
								<img src="images/d.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_D" value="VOTE">
								</td>									
								<td align="left" valign="top">
								<img src="images/e.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_E" value="VOTE">
								</td>
			                  </tr>
			                  <tr>									
			                    <td align="left" valign="top">
								<img src="images/f.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_F" value="VOTE">
								</td>
			                    <td align="left" valign="top"><img src="images/g.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_G" value="VOTE">
								</td>
			                    <td align="left" valign="top"><img src="images/h.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_H" value="VOTE">
								</td>

								<td align="left" valign="top"><img src="images/i.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_I" value="VOTE">
								</td>
								<td align="left" valign="top"><img src="images/j.jpg" alt="Name" width="80"><br>
			                    <input type="image" src="images/vote.png" width="85" name="btn_vote_J" value="VOTE">
								</td>
			                  </tr>

			                </table>
						</form>
						</center>
<br><br>
</font>
						</div>
			<div class="24logo"><img src="images/24logo.png" style="left:5px; top:10px; position:absolute;"></div>
			<div class="stripe"></div>
			<div class="man"></div>
			<div class="footer"></div>
			<div class="testimonials"><? randomQuote("testimonials.txt"); ?></div>
			<div class="copyright"></div>
			<div class="blinks" align="center"><? require("inc/bottom-nav.html");?></div>
			</div>			
			</td>
		</tr>
	</table>
</td>
</tr>
</table>
</body>
</html>

 

<?php
# Configuration files
#
ini_alter("error_reporting", "E_ALL");
ini_alter("display_errors", "On");
#-----------------------------------------------------------------------------#

require("inc/config.inc.php");
require("inc/lib.inc.php");
#-----------------------------------------------------------------------------#
session_start();
#-----------------------------------------------------------------------------#
function have_voted($cell_number) {
  
sys_open_db();
   $sql = "SELECT COUNT(*) as RCNT FROM votes WHERE cell=$cell_number AND YEAR(date) = " . date("Y") . " AND MONTH(date) = " . date("m") . " AND DAYOFMONTH(date) = " . date("d");
   $result = mysql_query($sql);
   if ($result) {
      if ($myrow = mysql_fetch_array($result)) {
         if ($myrow["RCNT"] == "0") {
            return false;
         } else {
            return true;            
         }//end if
      } else {
         return false;
      }//end if
   } else {
      return false;
   }//end if

}//end function
#-----------------------------------------------------------------------------#
$valid_list = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J");
#-----------------------------------------------------------------------------#
$image = preg_replace("/[^A-Z]/", "", $_REQUEST["image"]);
if (!in_array($image, $valid_list)) {
   header("Location: finalist.php");
   exit;
}//end if
#-----------------------------------------------------------------------------#
if (preg_replace("/[^A-Z]/", "", $_POST["image"]) <> "" && isset($_POST["Submit"])) {

   $err = "";
   $msg = "";

   $cell_number   = preg_replace("/[^0-9]/", "", $_POST["txt_cell_no"]);
   if (strlen($cell_number) == 10) {
      if (substr($cell_number, 0, 1) == "0") {
         $cell_number = "27" . substr($cell_number, 1);
      } else {
         $err++;
         $msg .= "Invalid Cellphone number<br>";
      }//end if
   } elseif (strlen($cell_number == 11)) {
      if (substr($cell_number, 0, 2) == "27") {
         $cell_number = "27" . substr($cell_number, 2);
      } else {
         $err++;
         $msg .= "Invalid Cellphone number<br>";
      }//end if
   } else {
      $err++;
      $msg .= "Invalid Cellphone number<br>";
   }//end if

   if ($_POST["chb_terms"] <> "on") {
      $err++;
      $msg .= "You need to read and agree to <br />the terms and conditions to vote.<br>";
   }//end if

   if ($err == 0) {

      sys_open_db();
  $image1= $_POST['image'];
  $cell_number1 = $_POST['txt_cell_no'];
      if (!have_voted($cell_number)) {
  
         $sql = "INSERT INTO votes VALUES ('', '$image', '$cell_number',now())";
         $result = mysql_query($sql);
         if ($result) {
            header("Location: vote_step_three.php");
            exit;
         } else {
            $msg = "Failed to create vote record.";
         }//end if
      } else {
         $msg = "You have already voted today. Please try again tomorrow.";
      }//end if

   }//end if

}//end if

?>
<html>
<head>
<title></title>
<link rel="STYLESHEET" type="text/css" href="css/div.css" />
<link rel="STYLESHEET" type="text/css" href="css/stylesheet.css" />
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body bgcolor="#0e0f1e" bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0">

<center><table cellpadding="0" cellspacing="0" border="0" height="100%" width="900">
<tr>
<td valign="center" align="center">
	<table cellpadding="0" cellspacing="0" border="0" height="640" width="900">
		<tr>
			<td height="640"><div class="main-body">
			<div class="bg"></div>

			<div class="border"></div>
			<div><? require("inc/nav.html");?></div>
			<div class="content-window"><a href="http://www.revlon24seven.co.za/prizes.php" title="Revlon 24 Seven Prizes"><img src="images/middlewin.png" alt="Revlon 24 Seven Prizes" align="left" height="180" border="0" style="top:80px; left:20px; position:absolute;"></a></div><div class="cstripe"></div>
<div class="content1"><font color="#FFFFFF"><center><br />


               <table align="center" cellpadding="0" cellspacing="3" class="vote-popup">
                <tr>
                   <td align="center" valign="top" bordercolor="#FFFFFF">
                  <form name="form1" method="post" action="<? echo $PHP_SELF; ?>"><input type="hidden" name="image" value="<? echo $_GET['image']; ?>">
                  <table width="180" border="0" align="center" cellpadding="0" cellspacing="0">
                     <tr>
                   <td height="41" align="left" valign="top">Please complete the following details to vote:</td>
                 </tr>
			 <tr>
				<td><p><? echo $msg; ?></p></td>
			</tr>
				 <tr>
                       <td align="left" valign="top"><p>Your cell number:<br>        
                         <label>
                         <input type="text" name="txt_cell_no" class="vote-textfield" value="<? echo $_POST["txt_cell_no"]; ?>">
                         </label></p></td>
                     </tr>
                     <tr>
                       <td align="left" valign="middle"><p><label><input type="checkbox" name="chb_terms"></label><a href="#" onClick="MM_openBrWindow('terms.html','Terms','scrollbars=yes,resizable=yes,width=600,height=400')">I agree to the terms & conditions</a>
                         </p><br>
                         </td>
                     </tr>
                   </table>
                 <input type="image" value="submit" name="Submit" src="images/submit.png" id="submit">
                  </form></td>
                 </tr>
               </table>
               <br>
						</center>
<br><br>
</font>
						</div>
			<div class="24logo"><img src="images/24logo.png" style="left:5px; top:10px; position:absolute;"></div>
			<div class="stripe"></div>
			<div class="man"></div>
			<div class="footer"></div>
			<div class="testimonials"><? randomQuote("testimonials.txt"); ?></div>
			<div class="copyright"></div>
			<div class="blinks" align="center"><? require("inc/bottom-nav.html");?></div>
			</div>			
			</td>
		</tr>
	</table>
</td>
</tr>
</table>
</body>
</html>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/175899-forbidden-403-error/
Share on other sites

some times it the root folders there set differently...

 

(( only if this is a new host your using....

 

 

/redarrow

/redarrow/

 

get me try?

 

 

the only thing i see is session_start() position wrongly <?php session_start();

?>

 

but that it...

Link to comment
https://forums.phpfreaks.com/topic/175899-forbidden-403-error/#findComment-926890
Share on other sites

some times it the root folders there set differently...

 

(( only if this is a new host your using....

 

 

/redarrow

/redarrow/

 

get me try?

 

 

the only thing i see is session_start() position wrongly <?php session_start();

?>

 

but that it...

 

You do know that that does not matter, right? The position of session_start(); only needs to be before any sessions are handled and before anything is outputed, otherwise it's inconsequential

Link to comment
https://forums.phpfreaks.com/topic/175899-forbidden-403-error/#findComment-926924
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.