Jump to content

[SOLVED] Checking if user info has changed


Kemik

Recommended Posts

Hello,

 

I'm making a useredit.php script but I'm finding a certain area difficult. I want the user to be able to edit their email address and "SU" (Steam Username). However, both fields must be unique. E.g. If they're changing their email from the one in their profile they must change it to something that isn't already in the database. My current script brings up that the email is not unique as it finds the email attached to the user's account.

 

At the moment the useredit.php pulls the users info from the database via class variables in session.php. I tried making an IF statement: if  ($session->userinfo['email'] != $subemail) { $database->updateUserField($this->username,"email",$subemail); }

 

However, because all of the error checking (and the above IF statement) takes place in session.php I cannot use $session->userinfo['email'] to check against the submitted password. Is there any other way to do this?

Link to comment
Share on other sites

I cannot use $session->user info['email'] to check against the submitted password.

 

Why? The whole point of sessions is that they are global. If this session class your using is limiting that capability I would suggest you not use it.

Link to comment
Share on other sites

I'll give you a bit of info of how much form is submitted.

 

1. Form on useredit.php

2. process.php - sends all submitted forms to the correct functions, manages errors send back

3. session.php via $session->editAccount() - Verifies form data and forwards data to database.php

4. database.php via $database->updateUserField() - Updates the table and tells process.php if it was successful.

 

As you can see, all the major processing of the form takes place in session.php. I thought $session->userinfo wouldn't work if it was being executed in session.php. Would I have to just use userinfo['email']?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.