Forum Moderators: coopster

Message Too Old, No Replies

php login

         

ayushchd

2:23 am on Aug 19, 2007 (gmt 0)

10+ Year Member



hi all...i m facing two problems:

1. i want to make this a case-sesnsitive query :
select * from users where username = '$username' and password='$password' and status = '1';

The password part is okay. I want to make the username part a case-sensitive one.

And now yet again, I m stuck at INTERNET EXPLORER!

if( (!isset($_COOKIE['user'])) && (!session_is_registered("password")) )
if($Login){
wteva
}
This works fine.

else if( (isset($_COOKIE['user'])) && (!session_is_registered("password")) ) {
if($Login){
wteva
}
In this case, it works fine in FF and Opera. In internet explorer, the page refreshes and nothing happens.

This is how i have declared the button :

<input name="Login" type="submit" id="Login" value="Login" class="button"/>

And at the beginning of the code i have this :
$Login=$_POST['Login'];

Also, the form has been declared this way :
<form id="form1" name="form1" method="post" action="">

I hope we get a solution.

Habtom

5:10 am on Aug 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can make it case sensitive:
SELECT BINARY fieldname . . . .

Or while initially creating the table:
CREATE TABLE this_table(. . .) CHARACTER SET latin1 COLLATE latin1_bin;

In internet explorer, the page refreshes and nothing happens.

Could it be because you have your Cookies disabled? PHP is a server side script, and shouldn't really depend on the browser for anything it executes on the server side.

Habtom

ayushchd

6:56 am on Aug 19, 2007 (gmt 0)

10+ Year Member



I am so sorry i forgot to mention..

In Internet Explorer when I press enter, nothing happens. But when i click on the login button, the script is executed :()

Habtom

7:01 am on Aug 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am not sure if it is because of this, but if you are submitting your form to the same page, instead of leaving the action empty use the following:

. . . action="<?php echo $_SERVER['PHP_SELF'];?>"

Habtom

[edited by: Habtom at 7:04 am (utc) on Aug. 19, 2007]

ayushchd

9:15 am on Aug 19, 2007 (gmt 0)

10+ Year Member



No...It didn't work.

ayushchd

8:09 pm on Aug 19, 2007 (gmt 0)

10+ Year Member



What could be the possible reason? Its juss driving me crazy

cameraman

9:02 pm on Aug 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like a text input is 'swallowing' the enter keypress - you could attach a bit of javascript to them to capture the enter key and submit the form.

ayushchd

12:34 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



hey...juss came to noe one thing :

When the cookie is set and i display the form in the following way, then it works perfectly :

<form id="form1" name="form1" method="post" action="">
<center>Username :
<input class="index" name="username" type="text" id="username" />
<p>Password : <input class="index" name="password" width="12px" type="password" id="password" />
</p>
<input name="Login" type="submit" id="Login" value="Login" />
</form>

But when I make a slight change and display it in the way i want it doesnt work...

<form name='form1' method='post' action=''>
<center>Username : ". $_COOKIE['user'] . "
<p>Password : <input class='index' name='password' type='password' id='password'>
</p>
<input name='Login' type='submit' id='Login' value='Login'>
</form>

I hope it wud now be easy to detect the problem. Please help. Its urgent.

Habtom

12:40 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Shouldn't you printing this:

<center>Username : ". $_COOKIE['user'] . "

as follows:

<center>Username : <?php echo $_COOKIE['user'];?>

Habtom

ayushchd

12:47 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



It didnt work. I guess the problem is with the form. Is there something wrong i m doing in displaying the form when the cookie is set? Why is this happening only in Internet Explorer?

ayushchd

2:05 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



Anyone? Please Help..

jatar_k

5:08 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you shouldn't have a blank action

ever tried to have no width and height on an image in IE, doesn't work, but it does in other browsers

I am guessing this is the same type of thing

what did it show in your form tag when you used Habtom's code

action="<?php echo $_SERVER['PHP_SELF'];?>"

?

Demaestro

5:18 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just an FYI...

blank form action on a mac when submitted will take you to the root of the site without posting anything.

ayushchd

5:48 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



it showed,

<form....action="/ index.php">

jatar_k

5:54 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



did it actually show / index.php, with the space in between?

if that is the right url, without the space, then that will work and you can move on to other possibilities. If that is not correct, with the space gone, then try putting the proper action in there manually.

ayushchd

6:13 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



it showed only /index.php with no space.

jatar_k

6:34 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



have you tried validating the actual html to see if it is just an html error causing the form not to submit?
[validator.w3.org...]

always a good step

so you said it works one way but when you change it then it doesn't. taking into account Habtom's change and adding my own. If you need to actually send the username with the form your second example wouldn't work without a hidden field for password

<form name='form1' method='post' action=''>
<center>Username : <?php echo $_COOKIE['user'];?>
<input type="hidden" name="username" value="<?php echo $_COOKIE['user'];?>" />
<p>Password : <input class='index' name='password' type='password' id='password'>
</p>
<input name='Login' type='submit' id='Login' value='Login'>
</form>

maybe something like that

ayushchd

7:14 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



the same old problem exists :( internet explorer//

jatar_k

7:41 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



can you explain the problem again in detail? what exactly happens in IE?

ayushchd

7:56 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



When the cookie is set, the username is displayed and the user has to only enter the password.

When I enter the password and press enter (in IE), nothing happens. But instead of pressing enter, If i click the login button, then i m redirect to wteva page i shud be to.

No such problems occur in mozilla or opera.

jatar_k

8:34 pm on Aug 20, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



so everything works except hitting enter?

ayushchd

8:36 pm on Aug 20, 2007 (gmt 0)

10+ Year Member



Yes.

ayushchd

9:10 am on Aug 21, 2007 (gmt 0)

10+ Year Member



Please Help.

Habtom

9:18 am on Aug 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is here:

<input name='Login' type='submit' id='Login' value='Login'>

Try the following one at a time:

<input name='Login' type='submit'>
OR
<input name='Login' type='Submit'>

Habtom

ayushchd

1:18 pm on Aug 21, 2007 (gmt 0)

10+ Year Member



None worked.

Habtom

1:25 pm on Aug 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Two questions:

> What is the code you are running when you submit the form?
> Did you get any differnece when you changed it to the one I mentioned before?

Habtom

> And yes how does your current form look like?

[edited by: Habtom at 1:32 pm (utc) on Aug. 21, 2007]