Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > WebsitePainter
Login Page - php issue?

andyz99
Registered User
Quote
2011-07-14 19:13:52

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


mrfix
Registered User
Quote
2011-07-14 20:15:55

The following message is shown.

Parse error: syntax error, unexpected '[' in /homepages/10/d373707115/htdocs/secure/dologin.php on line 47


andyz99
Registered User
Quote
2011-07-14 23:41:30

yes I am aware that is the issue but unsure how to solve?
Can you view the source and check and offer advice/
Thanks


niko
Moderator
Quote
2011-07-15 07:17:38

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)


andyz99
Registered User
Quote
2011-07-15 08:47:24

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


andyz99
Registered User
Quote
2011-07-15 08:58:38

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


andyz99
Registered User
Quote
2011-07-15 09:34:35

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


andyz99
Registered User
Quote
2011-07-15 11:39:42

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.


niko
Moderator
Quote
2011-07-15 13:25:01

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.


andyz99
Registered User
Quote
2011-07-15 14:45:26

Niko,

You are a genius - I have been frustrated with this for HOURS.

Many many thanks


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inter?ational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact