Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by gristoi

  1. you could use the directory iterator class (part of php5+):

     

    $path = 'images/'; // whatever your top level folder is
    $images = array();
    
    $dir = new DirectoryIterator($path);
    // loop through the chosen directory ( and all sub directories within and choose images)
    foreach( $dir as $entry ){
    if( $entry->isFile() ){
    if( preg_match('#^(.+?)(_t)?\.(jpg|gif|png)#i', $entry->getFilename(), $matches) ){ // check it is an image
    array_push($images, $entry->getPathName());
    
     }
    }
    }
    
    

  2. $usersEmailAddress = test@test.com;
    $usersPassword = '123456';
    $salt = 'wibbleotter'; // this is secret to you.
    $token = md5($usersEmailAddress.$usersPassword.$salt);
    $query = "INSERT INTO User_table .... "; // insert your users details and the token.
    $url = "http://mysite.com/confirm.php?q=$token";
    // email the above to the user and when they cliick on it to log in
    check with a query like this
    $query = "SELECT id FROM User_table where username =$username AND password = $password AND token = $token";
    

     

    hope that help explain it a bit better

  3. sorry, im afraid i might not have explained properly. the email will contain a link with the hash in it|:

    example:

    thank you for registering with............

    please click on the link below to confirm your registration:

     

    http://somesitesomewhere.com/confirm.php?q=2df352fd23fd62fd72fd72fd72ff387d736251fdeez

     

    where q is the md5 of their name and email address.

     

    this hash will be unque to their account. you done md5 the email at all

  4. my suggestion is:

    • user enters username / password and email address into form.
    • data gets saved into user table, along with an md5 hash of the username, email and a salt word
    • the user is emailed a link with the md5hash as a variable in the link
    • this redirects the user to the login page, with a couple of flags to show they are confirming,
    • when they hi t submit you check the md5 matches the one in the db and activate the account

  5. your problem is due to the fact that the posted data is actually a string. so even though you have put in something like 2.55 it will actually be '2.55' which is a string. you can check it is numeric using

    is_numeric()

    . you can also check using a regular expression. Or type cast the value into a float :

    (float)$_POST['prod_price']

  6. like i said in my previous comment, you are not posting username over to the changepasswordDb. you have two hidden fields with the name set to grade, not username and password. so you are in effect telling the query to

    $query="UPDATE administrator SET password='$newpassword' where username=''";
    

     

    so it will never update. change the input names from grade to username and password accordingly

×
×
  • 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.