Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    I am having problems with a little user modify script i have, i won't bore you with too much detail.

    Basically what i am doing is firstly checking if the password box is set, if it is then a variable contains a part of the sql query. Then if the password and confirm boxes are the same i encrypt the password and finally the SQ changes the password field. I need to know where i am going wrong.

    Here is the php
    PHP Code:
    if (isset($getpassword)) {
        
    $changepass "`password`='$upassword',";
    } else {
        
    $changepass '' ;
    }

    if (
    $getpassword == $confirmpassword) {
        
    $encryptpw md5($getpassword);
        
    $upassword $encryptpw
    and then part of the SQ
    Code:
    "UPDATE `users` 
    		SET
    			`name`='$getname', 
    			`username`='$getusername',
    			$changepass
    			`email`='$getemail',
    Can anybody spot anything wrong with this, i think either the $changepass variable or how i put it into the SQL is wrong, but i don't know what . It was working until i moved the bit of SQL into a variable and put the extra IF isset statement in.

    Thanks
    JR

  2.  

  3. #2
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    Try doing the encryption before your initialize the $changepass variable. The obvious reason is that you are setting it to a string and a variable which has not yet been initialized, namely $upassword. Since $upassword does not have any value at the time of assignment, the result is most likely `password` = '',

    Try doing this.

    PHP Code:
    if (isset($getpassword) and $getpassword == $confirmpassword
    {
        
    $encryptpw md5($getpassword);
        
    $upassword $encryptpw;
        
    $changepass "`password` = '$upassword',";
    }
    else
    {
       
    $changepass '';

    There and Back Again :Ogre:

  4. #3
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    thanks I totally forgot things had to be in order
    JR


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:42 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com