access forbidden error 403

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

access forbidden error 403

Postby oracle_nic » 04. August 2011 18:36

I've created a new db with a new table which contains a blob field. my effort is to open/download the file who resides in the blob field. i'm using windows vista with xampp for windows. the user that connect to the databse successfuly is ROOT with [BLANK] password. the user is able to store all kind of files successfuly in the blob field but is unable to open/download the file. the php script which concerns this task returns the message " Access Forbidden Error 403 ... ".
Since i'm the oposit of a guru in web designing i'll appreciate any suggestions and help from the forum. thanks in advance.
by the way since i'm ignorant the above message conew from php/mysql or frpm xampp/apache environment?
Nic
oracle_nic
 
Posts: 8
Joined: 04. August 2011 18:23

Re: access forbidden error 403

Postby Nobbie » 04. August 2011 20:35

oracle_nic wrote:the php script which concerns this task returns the message " Access Forbidden Error 403 ... ".


Ok, change line 17 ... or line 29 ... oh no, change line 232. Or so.

What makes you believing, that we can help without any information (even not one Bit) about your PHP script?? Hm, my car does not accelerate well - thanks in advance for your help!
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: access forbidden error 403

Postby oracle_nic » 05. August 2011 07:41

Sorry dude here is the 1st script
===========================
<HTML>
<BODY text="#FFFFFF" bgcolor="#000000" >
<p align="center">
<font face="Verdana">
Nicholas 3a
</font>
</p>
<hr>
<?php
echo "Connecting to DB..."; echo "<br>";
$db = mysql_connect("localhost", "root", "");
mysql_select_db("alpha", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");
echo "Connected"; echo "<br>";
echo "<hr>";

echo "<table border = \"1\" width = \"100%\">";
echo "<header>> Contents of table MYTABLE in database ALPHA</header>";
echo "<td align=\"center\">"; echo "ID"; echo "</td>";
echo "<td align=\"center\">"; echo "MAME"; echo "</td>";
echo "<td align=\"center\">"; echo "TYPE"; echo "</td>";
echo "<td align=\"center\">"; echo "SIZE"; echo "</td>";
echo "<td align=\"center\">"; echo "GET FILE"; echo "</td>";


$qry = "select id, name, type, size, data from myfiles";
$result = @mysql_query($qry, $db);

while ($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>"; echo $row{0}; echo "</td>";
echo "<td>"; echo $row[1]; echo "</td>";
echo "<td>"; echo $row[2]; echo "</td>";
echo "<td>"; echo $row[3]; echo "</td>";
echo "<td>";
echo "<a href = \"add_04a.php->\"id\">";
echo "<img src=\"post.jpg\" />";
echo "</td>";
echo "</tr>";
}
echo "</table>";

mysql_free_result($result);
mysql_close($db);
?>
</BODY>
</HTML>
--------------------------------------------------------
and the second one:
================
<?php
$db = mysql_connect("localhost", "root", "");
mysql_select_db("alpha", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");

$id = $_GET['id'];

$sql = "SELECT id, name, size, type, data FROM myfiles WHERE id = $id";

$result = @mysql_query($sql, $db);
$data = @mysql_result($result, 0, "id");
$name = @mysql_result($result, 0, "name");
$size = @mysql_result($result, 0, "type");
$type = @mysql_result($result, 0, "size");
$data = @mysql_result($result, 0, "data");

//$data_mine = stripslashes($data);
$data_mine =$data;

header('Content-type: $type');
echo $data_mine;

exit;
?>

</BODY>
</HTML>
----------------------------------------------
sorry for the incovinience Nic
oracle_nic
 
Posts: 8
Joined: 04. August 2011 18:23

Re: access forbidden error 403

Postby Nobbie » 05. August 2011 13:49

Usually, a "Access Forbidden Error 403 ... " error is NOT issued by an PHP script (as well not in your case), but from the Apache Server.

The meaning of HTTP Error 403 varies: http://en.wikipedia.org/wiki/HTTP_403

Mostly, it means that Apache lacks of sufficient read access to the php script and/or the path, where the script ist stored:

a) what do you enter in the URL to access the script? Is this script loaded directly (by entering the URL into the browser), or is it executed (called, included, linked etc.) by another script?

b) what is the Full Pathname of the script?

c) where is your Xampp installation (Path)?

d) what is your DocumentRoot?

e) look into the error_log for more detailed information and provide us the fully qualified error message.
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: access forbidden error 403

Postby oracle_nic » 06. August 2011 08:39

I'm very sorry, since it seems that I'm completely in the dark! I do not know if the complete returning message is more claryfying the situation.
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
6/8/2011 10:36:38 ðì
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1

all scripts are ln the c:\xampp\httdocs\my_test\ directory

the xampp has been installed on c:\xampp according to the relative suggestestion concerning vista installation

thank you for your time
oracle_nic
 
Posts: 8
Joined: 04. August 2011 18:23

Re: access forbidden error 403

Postby oracle_nic » 09. August 2011 18:55

The lunatic is in the forum

i changed fom vista to 7 and i have still the same problem.

Pls help gonna be crazy...

After a complete debuggin my source code for those two scripts now is as follows:
Script #1 display the contents of table
---------------------------------------------
<HTML>
<BODY text="#FFFFFF" bgcolor="#000000" >
<p align="center">
<font face="Verdana">
Nicholas 3a
</font>
</p>
<hr>
<?php
echo "Connecting to DB..."; echo "<br>";
$db = mysql_connect("localhost", "root", "");
mysql_select_db("alpha", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");
echo "Connected"; echo "<br>";
echo "<hr>";
echo "<table border = \"1\" width = \"100%\">";
echo "<header> Contents of table MYTABLE in database ALPHA</header>";
echo "<td align=\"center\" bgcolor=\"#00FF00\" >"; echo "ID"; echo "</td>";
echo "<td align=\"center\" bgcolor=\"#0000FF\" >"; echo "NAME"; echo "</td>";
echo "<td align=\"center\" bgcolor=\"#0000FF\" >"; echo "TYPE"; echo "</td>";
echo "<td align=\"center\" bgcolor=\"#0000FF\" >"; echo "SIZE"; echo "</td>";
echo "<td align=\"center\" bgcolor=\"#FF0000\" >"; echo "GET FILE"; echo "</td>";

$qry = "select id, name, type, size, data from myfiles";
$result = @mysql_query($qry, $db);

while ($row = mysql_fetch_array($result))
{
$id = $row[0];
$name = $row[1];
$type = $row[2];
$size = $row[3];
$data = $row[4];
echo "<tr>";
echo "<td align=\"right\">"; echo $id; echo "</td>";
echo "<td>"; echo $name; echo "</td>";
echo "<td>"; echo $type; echo "</td>";
echo "<td align=\"right\">"; echo $size; echo "</td>";
echo "<td align=\"center\" bgcolor=\"WHEAT\">";
echo "<a href = \"add_04a.php->\"id = $id\">";
echo "<img src=\"post.jpg\" />";
echo "</td>";
echo "</tr>";
}
echo "</table>";

mysql_free_result($result);
mysql_close($db);
?>
</BODY>
</HTML>
==================================================
script #2 open or download file from the blob field
-----------------------------------------------------------
<?php
$db = mysql_connect("localhost", "root", "");
mysql_select_db("alpha", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");

$my_id = $_GET['id'};

$qry = "SELECT id, name, size, type, data FROM myfiles WHERE id = $my_id";

$result = @mysql_query($qry, $db);

$row = mysql_fetch_array($result);

//$id = $row[0];
$name = $row[1];
$type = $row[2];
$size = $row[3];
$data = $row[4];

//echo $data;

//$data = stripslashes($data);

header("Content-type: $type\n");
header("Content-length: $size\n");
header("Content-Disposition: attachment; name=$name\n");
header("Content-Description: PHP Generated Data\n");

echo $data;

?>
=========================================================
Anyone out there to help me ?
oracle_nic
 
Posts: 8
Joined: 04. August 2011 18:23


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 180 guests