ERROR 403 1.7.3 [SOLVED]

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

ERROR 403 1.7.3 [SOLVED]

Postby Rankxerox1984 » 26. October 2010 10:30

Hello everybody:

I'm just starting to get introduced in PHP + MySQL, and I'm following a php tutorial to improve my skills, everything was going well until.. I tried to insert a record in mi DB with INSERT INTO, XAMPP replies me with:
¡Acceso prohibido!

Usted no tiene permiso de accesar al objeto solicitado. Existe la posibilidad de que este protegido contra lectura o que no haya podido ser leido por el servidor.

Por favor contacte con el webmaster en caso de que usted crea que existe un error en el servidor.
Error 403
localhost
26/10/2010 11:23:53
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_jk/1.2.28 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1


The code I used seems to be right

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
   <meta http-equiv="Content-Type"content=" text/html;charset=utf-8"/>
   <title>No more BloodyShopping</title>
</head>
<body>

<?php

if (!isset($_POST['submit'])) {
// form not submitted
?>

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
NOmbre: <input type="text" name="nombre">
Apellido1: <input type="text" name="apellido1">
Apellido2: <input type="text" name="apellido2">
<input type="submit" name="submit">
</form>

<?php
}
else {
// form submitted
// set server access variables
$host = "localhost";
$user = "root";
$pass = "antonio";
$db = "nmbs";

// get form input
// check to make sure it's all there
// escape input values for greater safety
$nombre = empty($_POST['nombre']) ? die ("ERROR: Pon un nombre") : mysql_escape_string($_POST['nombre']);
$apellido1 = empty($_POST['apellido1']) ? die ("ERROR: Pon un apellido") : mysql_escape_string($_POST['apellido1']);
$apellido2 = empty($_POST['apellido2']) ? die ("ERROR: Pon un apellido") : mysql_escape_string($_POST['apellido2']);
 
// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// create query
$query = "INSERT INTO personas (nombre, apellido1, apellido2) VALUES ('$nombre', '$apellido1', $apellido2)";
 
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
 
// print message with ID of inserted record
echo "New record inserted with ID ".mysql_insert_id();

// close connection
mysql_close($connection);
}
?>

</BODY>
</html>


Other functions works well. Please anybody knows where is the trouble, maybe some misconfiguration?

Many thanks for your patience and help,

J.
Rankxerox1984
 
Posts: 16
Joined: 25. October 2010 18:04
Operating System: MS Windows 7

Re: ERROR 403

Postby Altrea » 26. October 2010 18:42

Your form action uses PHP short_open_tags.
If you use XAMPP 1.7.3 be sure you have enabled them, if you want to use them.
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: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: ERROR 403

Postby Rankxerox1984 » 27. October 2010 10:15

Hi Altrea,

Thanks for your hint, where I can enable these short tags?

Again many thanks :P
Rankxerox1984
 
Posts: 16
Joined: 25. October 2010 18:04
Operating System: MS Windows 7

Re: ERROR 403

Postby Nobbie » 27. October 2010 10:32

Did you ever hear about a file called "php.ini"?
Nobbie
 
Posts: 8777
Joined: 09. March 2008 13:04

Re: ERROR 403

Postby Rankxerox1984 » 27. October 2010 14:25

...Again
Thanks for your help and your sense of humour. I'll try php.ini being sure not in other part of XAMPP universe I need to configure anything related with this issue.

Thanks
Rankxerox1984
 
Posts: 16
Joined: 25. October 2010 18:04
Operating System: MS Windows 7

Re: ERROR 403 (...Again)

Postby Rankxerox1984 » 28. October 2010 10:20

Hello:

I'm so sorry but I made teh modification indicated by Altrea (..and Nobbie too) and nothing happens the error 403 persist. Maybe is anything else wrong. Below the php.ini with the modification done the rest of the file remains as installed.

;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;

; Enable the PHP scripting language engine under Apache.
; http://php.net/engine
engine = On

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = On


Thanks for your help and lightening my way

J.
Rankxerox1984
 
Posts: 16
Joined: 25. October 2010 18:04
Operating System: MS Windows 7

Re: ERROR 403

Postby Nobbie » 28. October 2010 10:27

a) did you edit the right php.ini? Check via phpinfo() the location of php.ini AND check if your modification has been overtaken

b) did you restart Apache?

c) if you used Notepad for editing php.ini, be sure that you DID NOT create a copy of php.ini called php.ini.txt (this is a well known hassle of Notepad).

d) press F5 and/or clear the browser cache
Nobbie
 
Posts: 8777
Joined: 09. March 2008 13:04

Re: ERROR 403

Postby Rankxerox1984 » 02. November 2010 17:38

Hi Nobbie:

Thanks for your kind and precise indications I did them, and they works! :lol: :lol: :lol:

Thanks again,

J.
Rankxerox1984
 
Posts: 16
Joined: 25. October 2010 18:04
Operating System: MS Windows 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 62 guests