Jump to content
Larry Ullman's Book Forums

Problem With Passing Variables In Url - Ch16


Recommended Posts

Hello!

 

I've got a problem with loading the activate.php file for chapter 16.

 

My browser will load a page such as 'localhost/htdocs/index.php

 

However it will not load a page such as 'localhost/htdocs/register.php%3Fx=austintest1%2540localhost&y=2866cbd29d8e0c66386cae06baa82310' and instead shows the following error:

 

 

 

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
.

 

Error 403

06/09/2011 01:18:18

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

 

I am assuming this is because of some security setting in Apache, but am not sure.

 

I am running XAMPP 1.7.4

 

Please help!

Austin
Link to comment
Share on other sites

Hi HartleySan and Larry, thanks for your replies.

 

HartleySan: I copied the web address wrongly, it doesn't have 'htdocs' in it, so that can't be the problem.

 

Larry: Chrome put the %3F in instead of a question mark. When I rectify this and load it in IE I get the same error.

 

Out of desperation I've completely uninstalled Xampp, then reinstalled it, tested it etc, created my database again. I still get the same error. However all the other pages work fine though and I can register a new user and receive the email via Mercury.

 

Very strange and annoying!

 

Austin

Link to comment
Share on other sites

Okay, for starters, I would definitely NOT uninstall and reinstall XAMPP every time you have a problem.

 

The %3F is the entity version of the question mark. You need the actual question mark there. Chrome did not put the %3F there, but something did. Try using that same URL with a question mark instead of %3F. That should work. Then either the PHP code or your mail client is causing the problem.

Link to comment
Share on other sites

Okay, I've found the problems after a lot of debugging!

 

Firstly, the reg expression in the book, ^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$, doesn't work with the email I had set up to test this (austintest1@localhost) as it's expecting 1 or more . after the @ symbol. Changing the +\. to *\. should rectify this, although I haven't tested it yet. However when I include a . (ie. austintest1@local.host, with the dot encoded as %2E) it works.

 

Secondly, there was a problem with my BASE_URL set up in the config.inc.php file, so when the script judged my email to be no good it was redirecting via a very dodgy URL.

 

Everything is now working, phew!

Thanks HartleySan and Larry for your assistance.

Austin

Link to comment
Share on other sites

 Share

×
×
  • Create New...