/    Sign up×
Community /Pin to ProfileBookmark

Check that user details are correct

I have a cancel membership section which is only available to users who are logged in.

In order to cancel your membership, users must fill in the form which consists of their username and password.

This then checks the username and password that they entered in the form against the session variables username and password (username and password of the person logged in). It seems to work fine if the username and password are the exact same but if they are different it doesn’t work

e.g i’ve set up two accounts using the details below

username: [B]peter [/B] password: [B]peter[/B] works fine
username: [B]john[/B] password: [B]simon[/B] doesn’t work

So i have:

[code=php]$username = $_POST[‘username’]; // gets username from the form
$password = $_POST[‘password’]; // gets username from the form
$susername = $_SESSION[‘my_array’][0]; // username of person logged in
$spassword = $_SESSION[‘my_array’][10]; // password of person logged in[/code]

Here is the code i have:

[code=php]if ($username == $susername & $password == $spassword)

{[/code]

Can anyone see why this is not working

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@oo7mlauthorJun 17.2007 — anyone any idea...
Copy linkTweet thisAlerts:
@aussie_girlJun 17.2007 — deleted...
Copy linkTweet thisAlerts:
@oo7mlauthorJun 17.2007 — deleted...[/QUOTE]
sorry... what do you mean
Copy linkTweet thisAlerts:
@oo7mlauthorJun 17.2007 — Sorry, i got it working. The script is case sensitive because of the code:

[code=php]$username = $_POST['username']; // gets username from the form
$password = $_POST['password']; // gets username from the form
$susername = $_SESSION['my_array'][0]; // username of person logged in
$spassword = $_SESSION['my_array'][10]; // password of person logged in [/code]



[code=php]if ($username == $susername & $password == $spassword)

{[/code]


However the log in page or any other part of the site is not case sensitive. The only reason it is case sensitive here is because, it checks the username and password from the form, against the username and password of the user logged in (through a session variable). So they have to be exact for that matter, ie - case sensitive. does anyone know another way i could design this section, thanks
×

Success!

Help @oo7ml spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...