The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I don't know where that spurious '<' is coming from. Try doing View Source on the form page in your browser and see what the <form> tag looks like when PHP generates the action URL. That might give you a clue.

403 Forbidden ...

when i push the send button of this form i will be directed to http://localhost/ost/HTML_Seiten/<?php%20echo%20$_SERVER['PHP_SELF'];%20?> with the above mentioned error message 403 "Forbidden...".

As far as I know, the $php_self variable should take me to the same form with the form variables forwarded to the form again, right? So i guess it should look like somewhat similar to http://localhost/ost/HTML_Seiten/.....username=somename&password=somepassword,

when $username and $ password are the form variables.

Seems to like there is some problem with the php interpreter, which does not detect the php open tag <?php.

You say you're processing .html files as PHP scripts, but are you sure you're parsing .shtm files as PHP scripts? To my knowledge, a single file can't be processed both as a PHP script and for Server-Side Includes without some fairly heavy customization of Apache 2.0 (I don't think it's possible at all in Apache 1.x).

$PHP_SELF should work fine everywhere, and the symptoms you have described indicate a general failure of the PHP interpreter on the file, not just of $PHP_SELF.

In that second code I think, note that you mustn't use SESSION after you display html code, at least you can't write session after you send out html code. I am not sure if you can read session though, does anyone know? (please reply)
But that is at least a problem I saw with your code, there may be others...

I found the solution

Kevin,

I finally found the solution for my problem. The form I was working with was originally an XHTML-form. I changed this XHTML-form to a php form, but did not delete the xml script definition and the link to the DTD.

When I deleted those two lines the form and $self_php worked properly.

database occurred

Hiya all

with this arcticle using the code provided , two thing's have happend to
i get and error message saying (database is down ) or after i fill out the form and sumit it go to a pop and say a database error occurred in the processing of you submission.If persists contact etc....

one part of the code i',m not clear on is for the .db file
function dbConnect($db="")

and the other part is with .signup

// Process signup submission
dbConnect('sessions); what must I place instead of sessions can it just be a name of a current db on the server example: members
and does this need to be changed in other file for accesscontrol?

also i do not have access to my php.ini because it on my webhost server

You need to change the dbConnect('sessions') line so that it contains the name of the database you want to use on your MySQL server. So if you store all the tables related to access control on your site in a database called 'members', then change the line to say dbConnect('members').

Since accesscontrol.php is the only file that calls dbConnect(), that's the only place you need to make this change.

I doubt you'll need to change the include() calls, as long as the files are in the same directory as accesscontrol.php on your server. If they were causing problems, you'd be seeing error messages about them.

about the dbConnect('sessions') line

can this line be but this way
example:from the accesscontrol.php
dbConnect('members_mysite_jp') since it's with my webhost
thats how they tell me to right the path

also would i need to do this
for the .db
example: function dbConnect($db="members_mysite_jp") {

here the example from my host
Creating a database
You can create a maximum of 2 databases if you own a SILVER or higher package. This option allows you to create an entirely new, empty database.

To create a database, click on the Databases tab from the "Database Manager" page. Select the "Create" option from the "Select" list and choose Database from the second list. Enter the name of the database you want to create and click the "Build SQL Query" button. The detail of SQL query will be displayed at the bottom of the page. After reviewing the detail of SQL query click the "Run SQL Query" button to complete the operation. The results of operation will be displayed at the bottom of the page.

Your user name is appended to the end of every database name. The Total maximum length is 64 characters long and any "." (dot) or "-" (dash) in the database name is automatically converted to "_" (underscore).

For example if you choose "customers" as your database name and your domain is mycar.com, the complete database name will be:

customers_mycar_com

example 2 from host
Connecting to your database
In order to connect to the database you have created, you need the following arguments to include in your application/script:

MySQL server name (hostname): megasqlservers.com

Database user name: dbm.yourdomain

example: dbm.mycar.com

Password: The password will be the same as your Database Manager password.

Database name: It will be the complete name of database as outlined in

man kevin thanks for the first reply sorry for the long thread i'm a new but working hard haahah which new book of your would you recomend ?

can this line be but this way
example:from the accesscontrol.php
dbConnect('members_mysite_jp') since it's with my webhost
thats how they tell me to right the path

That will work just fine, yes.

also would i need to do this
for the .db
example: function dbConnect($db="members_mysite_jp") {

NO! The whole point of providing the database name when you call dbConnect() is so that you don't need to specify it in the db.php file! The code:

Code:

function dbConnect($db="") {

means "create a function named dbConnect that takes a single parameter and stores it in the variable $db. If no value is given for the parameter when the function is called, give it a value of "" (the empty string). You do need to provide your database server's hostname, username and password at the top of db.php, but that's it!

man kevin thanks for the first reply sorry for the long thread i'm a new but working hard haahah which new book of your would you recomend ?

I just finished explaining why you should not put your database name in the dbConnect function declaration, but if you insist, you can do it that way. Just make sure to call dbConnect without any parameters in accesscontrol.php.

Ok i got it so it send the e-mail and passwass but still when i go to the signin.php i get wrong user/name and passwords why is this

which file would correct this?

I would modify accesscontrol.php to print out the database query it is sending to check the username and password against the user table. It may be that the username and password are not being inserted into this query correctly.

If that is the case, the prime suspect would be that register_globals is disabled on your server. Please see my article, "Write Secure Scripts in PHP 4.2" to learn how to adapt the script to work with this setting.

How can i add more feilds to the signup.php

hello i looking for help to adding about 8 more sign-up feilds
how can i do so ,some are required others will not be required,just so the new feild put the text in the databasei have tried many time but no luck but i do have the oringal code working fine,just when i add the new feilds no luck,does the database table must be in the same order as the form feild?after the orginal items starting with id and so on?

No. Do as I did in my example; That means having single quotes around the PHP variables and separate the different entries with a comma ( , ).
Note: if the PHP variable is of type integer you should NOT have single quotes around it.

-----------------------------------------
<?php include("accesscontrol2.php"); ?>
<?php include("header.php"); ?>
-----------------------------------------
When I try to link from the file 'header.php' to another protected page, it seems to loose the username and password (although I've put the
-----------------------------------------
<?php include("accesscontrol2.php"); ?>
-----------------------------------------
on the first line. It only works, when I put a normal HTML-page under that famous first line.
Why doesn't the 'include'-method work?
Or have I done something wrong????

Does anyone know why when i add the new felids why this won't work
i got the feilds made already in mysql,but it's the php page that won't show up in the browser ,but display fine in dreamweaver preveiw ahhhh

You need to get the grasp on the syntax. Look at the example I gave you. Examine: Where are the single quotes, double quotes and semicolon?
You need to have the same syntax in your code.
The order of the MySQL columns aren't important.