PHP problem
Posted by: aravona (---.range86-165.btcentralplus.com)
Date: June 13, 2009 04:55PM

I haven't used PHP in a couple of months and am working from some old work which was successful.

I'm trying to create a simple login, where if the username and password match that of the mySQL database you get redirected to once page, if not you'll go to an error page. I've done this before and am now tweaking a few things for this new site. However every time I try and test the log in the PHP file I'm posting to tries to download instead of giving any errors or sending me to the new pages... The old work I have isn't working anymore either and I know that they definately worked before.

Any help would be welcome,

Thanks, Aravona

Options: ReplyQuote
Re: PHP problem
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: June 13, 2009 07:31PM

How are you running your php scripts you should be going to [localhost]

make sure all your php scripts end in .php file extension.

You should also make sure the wamp tray icon is white (this indicates everything is working).

Options: ReplyQuote
Re: PHP problem
Posted by: aravona (---.range86-165.btcentralplus.com)
Date: June 13, 2009 07:37PM

WAMP tray is white... and its definately a .php extention.

To clarify further.. I'm using this form:

<form action= "Login.php" method="post">
Login:
<br />
<input name="txtusername" type="text" value="" />
<br />
<br />
<input name="txtpassword" type="password" value="" />
<br />
<br />
<input type="submit" value="Log In" />
</form>

To link to this file:

<?php

$link = mysql_connect('localhost','root','');
mysql_select_db('gametest',$link);
$sql = "SELECT * FROM userlogin WHERE username='";
$sql = $sql . $_POST[txtusername] . "' and password='" . $_POST[txtpassword] . "';";
$result = mysql_query($sql,$link);
echo "<head><meta HTTP-EQUIV='REFRESH' content='0; url=GameTestHome.html'></head>";
?>

This is mainly a mesh of what I've used before from other websites and I have a feeling I've done something simple wrong and I'm just too frustrated to pick it up.

Thanks again c2dan

Aravona

Options: ReplyQuote
Re: PHP problem
Posted by: toumimi (---.80.113-78.rev.gaoland.net)
Date: June 13, 2009 10:21PM

Hum..

This php login form is not secured at all !!
Just for fun, you will try this password (copy it into password field)
' or 1=1;--

You may have a look to this page (or other documentation talking about secure login form) [en.wikipedia.org]

Florian

WampServer Patch (Screenshots)
Topic EN : www.wampserver.com
Topic FR : www.wampserver.com



Edited 1 time(s). Last edit at 06/13/2009 10:24PM by toumimi.

Options: ReplyQuote
Re: PHP problem
Posted by: aravona (---.range86-165.btcentralplus.com)
Date: June 13, 2009 10:48PM

I know its not secure, its not working at all so securing it would be pointless don't u think toumimi?

Why dont you try helping with the actual problem instead?

once again: the problem is when you hit login on the form it trys to download the .php file instead of running the code.

This is a tester code, try reading what people write instead of trying to a smart arse? This is running on an intranet thats not open to any other computer. I know about sql injection thanks I'm not gonna bother messing about with it i'll put $dirtystuff in later. Could you try helping with the actual problem instead of jumping several steps in any OOP or other programming planning?



Edited 1 time(s). Last edit at 06/13/2009 10:57PM by aravona.

Options: ReplyQuote
Re: PHP problem
Posted by: toumimi (---.80.113-78.rev.gaoland.net)
Date: June 13, 2009 11:03PM

I know this does not help you for your "download" problem, but I still wanted to help you...
Quote

I'm trying to create a simple login

So, if someone read this post, please let me saying your form is not secured !
I don't know you or your skill and I can't presume anything about it.
For development plan, why don't you make it secured at the beginning ??

I'm sorry for your problem and I'm also searching for you.. never mind.
If I find an answer, I will put it here.

Thanks for your kind comment smiling smiley

Florian

WampServer Patch (Screenshots)
Topic EN : www.wampserver.com
Topic FR : www.wampserver.com

Options: ReplyQuote
Re: PHP problem
Posted by: aravona (---.range86-165.btcentralplus.com)
Date: June 13, 2009 11:09PM

Because after doing my degree and extensive OOP I was taught to take steps, and step 1 would be for it to work before worrying about it being secure. My tutors would kill me for trying to work on security first, it overcomplicated the process. Simple != secure.

Thanks anyway for looking it maybe by browser, my code or my WAMP. But it doesnt seem to exsist on google I've been looking all day and am jsut a little frustrated.

Aravona

Options: ReplyQuote
Re: PHP problem
Posted by: aravona (---.range86-165.btcentralplus.com)
Date: June 14, 2009 12:05AM

Sorted it myself so no worries smiling smiley

Options: ReplyQuote
Re: PHP problem
Posted by: RedMatrix (---.dsl.hrlntx.sbcglobal.net)
Date: June 23, 2009 10:13AM

Can you please tell me what you did to fix it? Thanks.

Options: ReplyQuote


Sorry, only registered users may post in this forum.