Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

403 Forbidden Error

General discussions related to php

Moderators: macek, egami, gesf

403 Forbidden Error

Postby strydom » Sat Nov 03, 2012 1:05 am

Hi there i am new to php and have got this script from who knows where but i am having some trouble with it. It has worked before but now that there is a new version on php out it doesn't seem to be working and it keeps giving me this error...

Tab: 403 Forbidden
URL: http://localhost/<?=$_SERVER['PHP_SELF'] .
Body:
Forbidden

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

I'm Pretty sure it has something to do with this line...

<a href="<?=$_SERVER['PHP_SELF'] . "?action=on" ?>">ON</a>

but i don't know whats wrong with it :(
strydom
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sat Nov 03, 2012 12:59 am

Re: 403 Forbidden Error

Postby MeroD » Sun Nov 04, 2012 1:35 am

<a href="<?php echo $_SERVER['PHP_SELF'] . '?action=on' ?>">ON</a>

OR:

<a href="<?php printf( '%s?action=on', $_SERVER['PHP_SELF'] ); ?>">ON</a>
MeroD
New php-forum User
New php-forum User
 
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Re: 403 Forbidden Error

Postby MeroD » Sun Nov 04, 2012 1:46 am

Oh, and try to avoid using PHP short tags ( <?= )

They aren't supported on all servers...
MeroD
New php-forum User
New php-forum User
 
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Re: 403 Forbidden Error

Postby strydom » Wed Nov 07, 2012 2:08 pm

Thanks allot! That seems to have fixed that problem but now i cant seem to get my lights to light up on my Arduino Uno board :(

This is my code on the server...

$serial->deviceOpen();

if ($_GET['action'] == "on") {
$serial->sendMessage("N\r\n");
$file = fopen("testFile.txt","w");
fwrite($file, "1");
fclose($file);

} else if ($_GET['action'] == "off") {
$serial->sendMessage("0\r\n");
$file = fopen("testFile.txt","w");
fwrite($file, "0");
fclose($file);
}

And my code on the Arduino is listening to the serial port and is waiting for N. I know this is correct as i can test it by manually sending it an N...
strydom
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sat Nov 03, 2012 12:59 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.