Menu ▾ ▴

help - edit backend.php for new input field

Help
Mark Silva
2001-05-16
2001-06-07
  • Mark Silva

    Mark Silva - 2001-05-16

    Hello,
        Your script is the best i've seen so far for user auth.
    Although I am new to PHP <3 months ... I have come a long way.
        My problem is that I am having a hard time making a new input in the backend.php file ... I want to make an ICQ# input .. i've made the proper adjustments in mysql and the register.html form but i keep getting erors.
    Can you help?

     
    • Jae Jones

      Jae Jones - 2001-06-07

      Okay, I haven't done this yet since I am still having problems getting authlib to work on my localhost, but I'm going to give it a try.

      Go to the top of your backend.php to the 'function register'. There you should insert the var $icq into the proper places like in ($username, $password, $password2, etc) and if(!$username || !$password || !$password2 etc). I believe you can model the 'if' error return after the one for age:

      if (ereg("[^0-9]",$icq)){
         return $this->error[24];
      }

      I don't have my php notes in front of me, but this should return the error message if the person enters anything but a number. I said return error 24 because that's what it should be if you add a line at the end of the error array. (the array counts 0, 1, 2, 3.... [yeah some of you learned that a while ago, but I found that out last month] )

      You also want to go to the section right above the mail confirmation where it says $is_success. I believe you also want to add $icq into that area where it says to insert into authlib_confirm values. Of course, the field also has to be there in your table.

      Next you want to go to function confirm().
      Enter $icq into the 'list($hd,$username,$password,$name etc)=mysql_fetch_row

      Then go down and add the variable to the $is_success_second where it inserts into authlib_data. make sure the field is also in the authlib_data table.

      That should get you through the first part. There's more with the function edit and function edit_retrieve, but I'm sure you can figure out what to do with those.

      Oh, in the function confirm() where it says $hd, I think that might be a typo and should be $id since I don't see $hd anywhere else.

      I have to get my own functioning properly (if you know anything about line 211  :)  ) to go through the rest. If this works out for you, I'm glad I could help, if it doesn't....sorry. Though I'll be trying out the same thing and will post my results here if they work.

      Jae

       
    • Jae Jones

      Jae Jones - 2001-06-07

      I tried everything out on a f2s site. It works for the most part, but as expected there's a couple of things to work out with the editing section (won't update anything, but I've only worked on it for half an hour so maybe I can fix everything soon enough).

      I created 'icq' in the authlib_confirm and authlib_data tables. Just so I know they would take correctly I just made them text. The icq number can now be entered when registering and the value will be passed into the database. The number will also show up in the edit form, but currently cannot be updated for some reason. There's a icq message error for you to modify as well.

      One other thing I noticed was the cookie. I found that when I logged out I could easily go back to the admin page and it still said I was logged in. I remember reading that an easy way to destory a cookie is to send another one of the exact same name, but with an empty value to the computer. In backend the function logout only had setcookie("hello");, but I changed it to setcookie ("hello", "");. The value of the cookie set on login was "$username:$hash:$id" and now it's "", empty. I didn't bother to put the time() in there since I didn't want the cookie anymore anyway.

      Duh, almost forgot. I put the files in the Support area under 'modified files for icq'.

      If you happen to fix the whole edit thing before I do let me know.

      Thanks,
      Jae

       

Log in to post a comment.