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 10 of 10

Thread: Few questions

  1. #1
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    1. How do I make users be able to change their password?
    I'm using a MySQL
    2. How do I express the time? I've already got the date but I don't know how to do the time. Thanks!

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    6,373
    Member #
    5580
    Liked
    393 times
    The question is too broad.

    Not enough information to know how you currently have the users registered and logged-in.
    They have to be logged-in to change their password. So you must already have the login?

    And no way to show you a script because my script examples will be for a totally different
    MySQL setup, and my scripts will be nothing like what you currently have for your site.

    Date and time ...
    You have to define a timezone, because a guy in Australia will be viewing your site one
    day ahead of you.

    Start here:
    http://php.net/manual/en/function.da...mezone-set.php
    then:
    http://php.net/manual/en/timezones.php

    Now, determine if you want to use MySQL date/time column types, or do you want to use UNIX time?

    Again ... not enough information to answer this.


  4. #3
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    Alright, let's tackle the password change first. I'm using a MySQL databse with PHP. They register with their email and username, and it emails them a randomly generated password. I want them to be able to change it (currently they can't).

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    6,373
    Member #
    5580
    Liked
    393 times
    This free script (PHP/MySQL) will give you a lot of examples on what to do.
    http://php-login-script.com/

    It allows users to register, confirm it by email (which you have now), and then login.
    When they login, they have a "profile" page where they can change information about
    themselves, as well as password.

    An "admin" person can also view and change all users information.

    I think you'll see a lot there by downloading and looking at the scripts.
    Perhaps you'll want to implement that script. Customize the HTML/CSS so it
    looks the way you want on your website.


  6. #5
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    Funny, I was going to use that script yesterday but I found one that looked much eaier and only required two files. Instead of like 10. I mean, since there's gonna be hundreds of files a few won't make a difference... however, on the other hand, I want to keep it as simple as possible.
    Can I stick with the one I'm using?
    Isn't there just some PHP code I can use to interact with the database to change the password?
    Thank you!

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    6,373
    Member #
    5580
    Liked
    393 times
    Sure there is, but you have to write it all.

    You have to make a form that displays so the user enters their current password,
    and then enters the new password twice. If the two new passwords don't match,
    you go back and tell them to try again. Then, you process it and update their row
    in the database table ... then you email them letting them know the password changed.
    You also need to allow the admin login to change the users' profile. There are different
    levels of users 1-9 ... where 9 would be the admin person that can do everything.

    That's a lot of scripting ... but go for it if you want.


  8. #7
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    F*** it, I just used the Php-Login-Script

  9. #8
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    Alright so I read the timezone thing; but it doesn't make sense. How do I even show the time (I don't care about timezone, I can add that later)

  10. #9
    Senior Member Ganners's Avatar
    Join Date
    Feb 2011
    Location
    United Kingdom
    Posts
    415
    Member #
    27007
    Liked
    91 times
    You'll use PHP's date function. It can grab the current time down to the microsecond!

    So looking at the documentation, if I wanted to have the date to show as 17:32 which is the time looking at the clock now, I'd use G (24-hour format of the hour) and i which is the minutes with leading zeros. So <?php echo date("G:i"); ?>
    Mark Gannaway Software Developer

    Recent Experiments
    - Backpropogation Neural Network language solving (http://ann.ganners.co.uk/)
    - Animated image to ASCII (http://google.ganners.co.uk/)
    - 3D Paper Characters (http://cybergame.ganners.co.uk/)
    - Anagram solving (http://roflol.co.uk/)

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    6,373
    Member #
    5580
    Liked
    393 times
    PHP Code:

    <?php

    // set the server timezone to be your time (in California).
    date_default_timezone_set('America/Los_Angeles');

    echo  
    date("m-d-Y H:i:s");

    ?>



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 07:23 AM.
Powered by vBulletin® Version 4.2.0
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com