Jump to content

cluce

Members
  • Posts

    354
  • Joined

  • Last visited

    Never

Posts posted by cluce

  1. I have a forgot password form that allows a user to submit their email then a link to a page to reset their password is sent to that email. On this page I have them submit their email and enter in a new password which works fine. But is there any way I could disable this page so the user cant get access to change their password again unless they submit another request to change their password. In other words, I want them to use that link only once and thats it. 

     

    If so can someone give me some ideas on how to do this? 

  2. can I use php and apache to host my website on a windows client for others to view?  If so, can someone tell me how to publish this for others to view through their internet browser?  We are all on the same network. I dont have to publish it publicly just host it for other users on the same domain as me will work for now.  I am trying to get my manager to look at on his machine instead of mine.

  3. I just need some input from some php experts. I was using the @ symbol in my code and when I posted my code on here. Someone told me it was bad programming but when I did a google search on adding security to you php website. It was suggested to use @ to prevent the hacker from seeing your potential error in your website in the browser window.  can someone give me your opinon on this? or any ideas/tips on how to secure php wen pages?

  4. I am using IIS to host my website. I have a logon page that asks for the user's username and password. My website works when I use Apache and run it on my local machine but when I host it over the web through IIS I receive an error when I try to logon which is connected to mySQL. Error...Fatal error: Call to undefined function mysqli_connect() in C:\Inetpub\wwwroot\userlogin.php on line 14.

     

    Can someone tell me how I can configure my settings so the user can log on via web and connect to the database. I would greatly appreciate it.

  5. thanks for the reply. I think my code is right too. ;D  For some reason the mail server doesn't wont to relay the message externally.

     

    It does send email just not to my external accounts(ex. gmail, yahoo,etc.).  It only sends  the messges to my company email accounts.

     

  6. ok here is the code......

    <?php
    //initialize the session
    if (!isset($_SESSION)) {
      session_start();
    }
    
    //connects to database
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    
    //check to see if email exists in database/table
    $usercheck = strip_tags(trim($_POST['email']));
    $check = mysqli_query($mysqli,"SELECT email FROM auth_users WHERE email = '$usercheck' LIMIT 1"); 
    $check2= mysqli_num_rows($check);
    
    //if the email does not exist, it gives an error
    if ($check2 != 0) {
    
    
        //create and issue the query
        $sql = "SELECT username, password FROM auth_users WHERE email = '".$_POST["email"]."' LIMIT 1";
        $res = mysqli_query($mysqli, $sql); 
    $bodyArr = mysqli_fetch_array($res);
        	
    //send query through email	
        $to = $_POST["email"];
    $subject = "Account Information";
        $body = "Username: " . $bodyArr['username'] . "\nPassword: " . $bodyArr['password'];
    
    mail ($to, $subject, $body);
    
    header("Location: http://localhost/Account_information.html");
    
    }else{
        $_SESSION['emailExists'] = "<font color='red'>The email"." ".$_POST['email']." "."does not exist in our database.<br>You may register for free by filling out the online registration form.</font>";	
    header ("Location: forgot_password.php");
    }
    mysqli_close($mysqli);
    ?>

  7. my situation: I am in an internal network that is using our company's SMTP. I am working on a forgot password page for our website.  When I type in an email and submit it it verifies that the email is in the database and sends that email account the username and password. 

     

    This only works with the company's email accounts such as me@company.com but when I use me@yahoo.com it does not send the username and password. I receive these errors....

     

     

    Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for me@yahoo.com in C:\wamp\www\email_info.php on line 28

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\email_info.php:28) in C:\wamp\www\email_info.php on line 30

     

     

    can someone tell me what the problem may be????

     

     

  8. my code works great. The little problem I have is its not returning the password only the hash form of it. Can someone show me where to insert the md5 function. I tried everywhere I can think of...

     

        //create and issue the query
        $sql = "SELECT username, password FROM auth_users WHERE email = '".$_POST["email"]."' LIMIT 1";
        $res = mysqli_query($mysqli, $sql); 
    $bodyArr = mysqli_fetch_array($res);
        	
        $to = $_POST["email"];
    $subject = "Account Information";
        $body = "Username: " . $bodyArr['username'] . "\nPassword: " . $bodyArr['password'];
    
    mail ($to, $subject, $body);
    

  9. OK I added those lines but now I get these......

     

    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in C:\wamp\www\email_info.php on line 22

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\email_info.php:22) in C:\wamp\www\email_info.php on line 30

    <?php
    //initialize the session
    if (!isset($_SESSION)) {
      session_start();
    }
    
    //connects to database
    $mysqli = @mysqli_connect("localhost", "root", "", "test");
    
    //check to see if email exists in database/table
    $usercheck = @strip_tags(trim($_POST['email']));
    $check = @mysqli_query($mysqli,"SELECT email FROM auth_users WHERE email = '$usercheck' LIMIT 1"); 
    $check2= @mysqli_num_rows($check);
    
    //if the email does not exist, it gives an error
    if ($check2 != 0) {
        //echo ("email exists");
    
        //create and issue the query
        $sql = "SELECT username, password FROM auth_users WHERE email = '".$_POST["email"]."' LIMIT 1";
        $res = mysqli_query($mysqli, $sql); 
    $bodyArr = mysqli_fetch_array($mysqli, $sql);
        	
        $to = $_POST["email"];
    $subject = "Account Information";
        $body = "Username: " . $bodyArr['username'] . "\nPassword: " . $bodyArr['password'];
    
    mail ($to, $subject, $body);
    
    header("Location: http:company.com/Account_information.html");
    
    }else{
        $_SESSION['emailExists'] = "<font color='red'>The email"." ".$_POST['email']." "."does not exist in our database.<br>You may register for free by filling out the online registration form.</font>";	
    header ("Location: forgot_password.php");
    }
    mysqli_close($mysqli);
    ?>

  10. I am trying to do a forgot password page that will email the person his username and password based on the email submitted. Here is the errors I am getting...

    Warning: mail() expects parameter 3 to be string, object given in C:\wamp\www\email_info.php on line 26

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\email_info.php:26) in C:\wamp\www\email_info.php on line 28

     

    I think it something to do with converting the $res - $body but I am not sure?

     

    Can someone tell me whats wrong?

     

    here is the code I am use......

    <?php
    //initialize the session
    if (!isset($_SESSION)) {
      session_start();
    }
    
    //connects to database
    $mysqli = @mysqli_connect("localhost", "root", "", "test");
    
    //check to see if email exists in database/table
    $usercheck = @strip_tags(trim($_POST['email']));
    $check = @mysqli_query($mysqli,"SELECT email FROM auth_users WHERE email = '$usercheck' LIMIT 1"); 
    $check2= @mysqli_num_rows($check);
    
    //if the email does not exist, it gives an error
    if ($check2 != 0) {
        //echo ("email exists");
    
        //create and issue the query
        $sql = "SELECT username, password FROM auth_users WHERE email = '".$_POST["email"]."' LIMIT 1";
        $res = @mysqli_query($mysqli, $sql);
        	
        $to = $_POST["email"];
    $subject = "Account Information";
    $body = $res;
    mail ($to, $subject, $body);
    
    header("Location: http:mydomain.com/Account_information.html");
    
    }else{
        $_SESSION['emailExists'] = "<font color='red'>The email"." ".$_POST['email']." "."does not exist in our database.<br>You may register for free by filling out the online registration form.</font>";	
    header ("Location: forgot_password.php");
    }
    mysqli_close($mysqli);
    ?>

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