Jump to content

cluce

Members
  • Posts

    354
  • Joined

  • Last visited

    Never

Posts posted by cluce

  1. I am trying to send an email through a web form but I am getting an error......

    I am trying to use windows xp on my local machine.

     

    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\sendmail.php on line 19

     

    Can someone tell me how to fix this.

    Here are my config settings for the mail server.....

     

    [mail function]

    ; For Win32 only.

    SMTP = localhost

    smtp_port = 25

     

    ; For Win32 only.

    ;sendmail_from = me@localhost.com

     

     

  2. I have three pages a user_logon.html, userlogin.php, and a logon(if successful). I am trying to greet the user but my php is not on the same page as logon.php.  Is their any way I can greet the user this way?? If so I can't get it to work.                                          here is the userlogon.html code........

     <form method="post" action="userlogin.php">
    <p> </p>
    <p><strong>Username:</strong>
      <input name="username" type="text" size="25"/>
    </p>
    <p><strong>Password:</strong>
      <input name="password" type="password" size="25"/>
    </p>
    <blockquote>
      <blockquote>
        <p align="right">
          <input name="submit" type="submit" onclick="MM_validateForm('username','','R','password','','R');return document.MM_returnValue" value=" Login "/>
          <input name="Reset" type="reset" id="Reset" value="Cancel" />
        

     

    here is the userlogin.php code........

    <?php
    
    //check for required fields from the form
    if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {
    header("Location: user_logon.html");
    exit;
    }
    
    //connect to server and select database
    $mysqli = mysqli_connect("localhost", "root", "", "test");
    
    //create and issue the query
    $sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
    
    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
    
    //get the number of rows in the result set; should be 1 if a match
    if (mysqli_num_rows($result) == 1) {
    
    //if authorized, get the values of f_name l_name
    while ($info = mysqli_fetch_array($result)) {
    	$f_name = stripslashes($info['f_name']);
    	$l_name = stripslashes($info['l_name']);
    }
    
    //set authorization cookie
    setcookie("auth", "1", 0, "/", "yourdomain.com", 0);
    
    //directs authorized user
    header("Location: logon.php");
    
    } else {
    //redirect back to login form if not authorized
    header("Location: registration.html");
    exit;
    }
    
    ?>
    
    

     

    here is the logon.php page code......

            <p>
    <?php  echo("<p>Welcome <b>".$_POST['f_name']."</b>!</p>") ?>	
     </p>
    

     

     

    Can someone suggest how I can get this accomplished??

     

  3. Can someone tell me how to add an onclick behavior and tell it to do this ...

     

    if (($_POST["password"]) !== ($_POST["confirmpassword"])){

    echo ("passwords must be identical");

     

    }else{

     

    Instead of putting this on a second page and having duplicate pages to display the error message, I am trying to confirm the passwords before submitting or inserting a new record in the database and if they dont match have it display a message on the same page. Anybody have any ideas? I am using Dreamweaver 8 and PHP and mySQL.

  4. I am not sure wants going on here. Both of my fields are varchar(50). Can someone tell me what I am missing?

     

    here is the code I am using.........

     

    <?php

    $mysqli = mysqli_connect("localhost", "root", "", "test");

     

    if (mysqli_connect_errno()) {

    printf("Connect failed: %s\n", mysqli_connect_error());

    exit();

    } else {

    $sql = "INSERT INTO testTable (testField) VALUES ('".$_POST['testfield']."','".$_POST['testfield2']."')";

    $res = mysqli_query($mysqli, $sql);

     

    if ($res === TRUE) {

      echo "A record has been inserted.";

    } else {

    printf("Could not insert record: %s\n", mysqli_error($mysqli));

    }

     

    mysqli_close($mysqli);

    }

    ?>

     

  5. this is all I use...

     

     

    //connect to server and select database

    $mysqli = mysqli_connect("localhost", "username", "password", "database");

     

     

    //create and issue the query

    $sql = "SELECT......................FROM..............

     

    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

  6. here is the code I am using .......can someone tell me how to modify this on how I can do this.....

     

    <?php

    //check for required fields from the form

    if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {

    header("Location: userlogin.html");

    exit;

    }

     

    //connect to server and select database

    $mysqli = mysqli_connect("localhost", "root", "", "test");

     

    //create and issue the query

    $sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";

    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

     

    //get the number of rows in the result set; should be 1 if a match

    if (mysqli_num_rows($result) == 1) {

     

    //if authorized, get the values of f_name l_name

    while ($info = mysqli_fetch_array($result)) {

    $f_name = stripslashes($info['f_name']);

    $l_name = stripslashes($info['l_name']);

    }

     

    //set authorization cookie

    setcookie("auth", "1", 0, "/", "yourdomain.com", 0);

     

    //directs authorized user

    header("Location: logon.php");

     

    //prevents cache of logon info

      header("Cache-Control: no-cache, must-revalidate");

          header("Expires: Mon, 01 Jan 1900 00:00:00 GMT");

     

    } else {

    //redirect back to login form if not authorized

    header("Location: registration.html");

    exit;

    }

    ?>

    <html>

  7. I was talking about on the internet browsers.........I am trying to prevent the user from logging on with the next and previous buttons on the browser. Even after they log out.  can someone me any suggestions on how to disable this?? What code or functions could I use??

     

    thanks for your replies. I will check it out.

  8. <form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">

                            <input name="username" type="text" id="username" />

                          </div></td></tr>

                    <tr>

                      <td><div align="left">Password:</div></td>

                      <td>

                        <div align="center">

                          <input name="password" type="text" id="password" />

                          </div></td></tr>

                  </table>                <p>

                    <input type="submit" name="Submit" value="Logon" />

                    <input name="Cancel" type="reset" id="Cancel" value="Cancel" />

            </form>

     

    page 2 code.......

                  <?php  echo( "Welcome ,$_POST[username]!" );  ?> </p>

     

    OK, I can pass the data when I uses apache 1.2 version but when I use WAMP and apache 2 it won't pass the data from one page to another. I am puzzled.

     

    Can someone see why I can't display the username upon them logon on?

    Thanks

  9. can someone tell me how to reconfigure this correctly so i can get rid of these errors....

     

    Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\user_logon.php on line 5

     

    Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

     

    Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

     

    thanks

  10. 04/27/2007 07:00:41 PM  

     

    here is the code I am using..

    <?php require_once('Connections/COnn2.php'); ?>

    <?php

    // *** Validate request to login to this site.

     

    $loginFormAction = $_SERVER['PHP_SELF'];

    if (isset($_GET['accesscheck'])) {

    $_SESSION['PrevUrl'] = $_GET['accesscheck'];

    }

     

    if (isset($_POST['firstname'])) {

    $loginUsername=$_POST['firstname'];

    $password=$_POST['lastname'];

    $MM_fldUserAuthorization = "";

    $MM_redirectLoginSuccess = "User_login.html";

    $MM_redirectLoginFailed = "registration.html";

    $MM_redirecttoReferrer = false;

    mysql_select_db($database_COnn2, $COnn2);

     

    $LoginRS__query=sprintf("SELECT id, f_name FROM auth_users WHERE id='%s' AND f_name='%s'",

    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

     

    $LoginRS = mysql_query($LoginRS__query, $COnn2) or die(mysql_error());

    $loginFoundUser = mysql_num_rows($LoginRS);

    if ($loginFoundUser) {

    $loginStrGroup = "";

     

    //declare two session variables and assign them

    $_SESSION['MM_Username'] = $loginUsername;

    $_SESSION['MM_UserGroup'] = $loginStrGroup;

     

    if (isset($_SESSION['PrevUrl']) && false) {

    $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];

    }

    header("Location: " . $MM_redirectLoginSuccess );

    }

    else {

    header("Location: ". $MM_redirectLoginFailed );

    }

    }

    ?>

     

    logon on with user name and password still brings me to the registration page. can someone give me any suggestions.

     

    I did delete this code at the top because I was recieving crazy messages.........

    if (!isset($_SESSION)) {

     session_start();

    }

    ....the error messages I was getting was .....

    Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\user_logon.php on line 5

     

    Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

     

    Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

     

    when I deleted those two lines I can atleast get to the registration page but it does the same thing when I use a logon and password. its like its not retrieving and storing the data to access that page. can someone help me with this? I would really appreciate it.

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