Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hello, a great forum and many thanks for the help .... thus far..! I have a new issue - I am trying to create a basic login page and have got so far and now am stuck. Please look at the following: http://lightfootelectrical.co.uk/login.html the username is myuser the password is mypass but I get an error in line 47 message, but cannot see the error? Can someone please help? Many thanks |
||||
|
The following message is shown. Parse error: syntax error, unexpected '[' in /homepages/10/d373707115/htdocs/secure/dologin.php on line 47 |
||||
|
yes I am aware that is the issue but unsure how to solve? Can you view the source and check and offer advice/ Thanks |
||||
|
It's a .php site, we cannot look at the source from our browser. That can only done with .html pages. You need to paste it in here, or send it per mail to me (see Support -> Contact, there is a mail adress on there) |
||||
|
ok here is the code, I have placed it in a php code box. $u = ""; $p = ""; if(isset($_POST['u'])) { $u = $_POST['u']; } if (isset($_POST['p'])) { $p = S_POST['p']; } if($u =='myuser' && $p =='mypass') { header("location: logged_in.html'); } else { header("location: login.html"); } many thanks |
||||
|
sorry a quick update... I have made some duh changes... and the code is now: $u = ""; $p = ""; if(isset($_POST['u'])) { $u = $_POST['u']; } if (isset($_POST['p'])) { $p = $_POST['p']; } if($u =='myuser' && $p == 'mypass') { header("location: logged_in.html"); } else { header("location: login.html"); } however I get a new error??? Warning: Cannot modify header information - headers already sent by (output started at /homepages/10/d373707115/htdocs/secure/dologin.php:7) in /homepages/10/d373707115/htdocs/secure/dologin.php on line 51 |
||||
|
Sorry forgot to add that I cannot change the code at line 7 as it is locked?? With regard to the error message ignore all text up to the '/secure/' folder the bit I am unsure of is after that.. Thanks again |
||||
|
Just to explain what I am trying to achieve.. All I want is a single user and password login page that will give access to pages not available to other users. I though it would be simple...???? Many thanks again for any help. |
||||
|
Well, those are really PHP specific questions, this forum is not the right place to ask this, I think you would get better help in a PHP forum. But from what I think you are doing is that you cannot call header() in your code after the headers are already sent. Meaning that the <?PHP section in your code needs to be the top element of your document. In WebsitePainter, you can do this by using the "View -> HTML Code of page" command and choose the 'additional code before the header'. Paste your PHP code into there (enclosing it into <?PHP and ?> and delete it from all other places. It should work then. |
||||
|
Niko, You are a genius - I have been frustrated with this for HOURS. Many many thanks |
|