Loading ...
Sorry, an error occurred while loading the content.

passing php generated error messages to overlib

Expand Messages
  • docdudeus
    Hi, I m looking to pass any error messages generated in our php login script to an overlib popup at the time of submitting the html form data to that same
    Message 1 of 1 , Jan 3, 2006
    • 0 Attachment
      I'm looking to pass any error messages generated in our php login
      script to an overlib popup at the time of submitting the html form
      data to that same script. Presently a separate page will open that
      lists the errors generated by the login script. I would like to have a
      bubble popup or image popup open, anchor it to an absolute area on the
      screen where the login process (i.e. username entry, etc.) occurs, and
      inform the user of any error encountered in the login process. The
      present scripts work but generate error messages on a separate page.

      This is the test script I've used which includes the form that passes
      the username and password to the login verification script.


      <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
      <meta name="ProgId" content="FrontPage.Editor.Document">
      <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      <script type="text/javascript" src="overlibmws.js"></script>
      <script type="text/javascript" src="overlibmws_bubble.js"></script>
      <script type="text/javascript" src="overlibmws_filter.js"></script>
      <script type="text/javascript" src="iframecontentmws.js"></script>
      <script type="text/javascript" src="overlibmws_iframe.js"></script>
      <script type="text/javascript" src="overlibmws_overtwo.js"></script>
      <script type="text/javascript" src="overlibmws_scroll.js"></script>
      <script type="text/javascript" src="overlibmws_draggable.js"></script>
      <form action="logintest.php" onsubmit="return overlib('php error
      value', TEXTCOLOR, '#000000', TEXTSIZE, 2, WIDTH, 170, HEIGHT, 120,
      BACKGROUND,'images/bubble.gif',PADX, 60, 20, PADY, 20, 20);"
      onmouseout="nd();" method="post">
      <div style="margin-left: 100px; padding-bottom: 10px;">
      <input type="Text" name="username" value="USERNAME" size="15"><br>
      <input type="password" name="password" value="PASSWORD"
      <input type="image" src="images/b_go.jpg" value="submit" width="23"
      <!--<bubble test>-->
      <a href="javascript:void(0);" onclick="return overlib('This is an
      <b>oval</b> bubble popup.', BUBBLE,BUBBLETYPE, 'oval',
      FILTERSHADOW,1,FILTERSHADOWCOLOR,'purple');" onmouseout="nd();"><input
      type="image" src="images/b_go.jpg" value="submit" alt="submit"
      hspace="10" align="absbottom" border="0" width="23" height="24"></a></div>

      <!--<iframe test>-->
      <a href=javascript:void(0);
      onclick="return overlib(
      OLiframeContent('logintest.php', 510, 145, 'if1', 1),
      MIDX,0, RELY,90,STATUS);"
      onmouseout="nd();"><input type="image" src="images/b_go.jpg"
      value="submit" alt="submit" width="23" height="27"></a>
      <p> </p>

      This is the php login verification script:

      // Declare loginError so a value is always available
      $loginError = "";
      // Enable sessions
      include_once "session.php";
      require ("getipnew.php");
      // Turn on magic quotes to prevent SQL injection attacks
      // Connect to database
      $eg_objConn2 = mysql_connect("hostname", "dbname", "password");
      mysql_select_db("dbname", $eg_objConn2);
      //Set login variables

      $t = time();
      $datetime = date("m-d-Y h:i A", $t);
      $lastlogin = date("m-d-Y");
      $lasttime = date("h:i A");
      $ip_address = getip();
      $http_user = $_SERVER['HTTP_USER_AGENT'];

      // Validate users input
      // Check username has a value
      if(empty($_POST['username'])) $eg_error['username'] = "Please enter a
      user name!";
      // Check password has a value
      if(empty($_POST['password'])) $eg_error['password'] = "Please enter a
      // Check if any errors were returned and run relevant code
      // Get allusers Record Set
      $eg_recResult1 = mysql_query("SELECT
      `allusers`.`egnID`,`allusers`.`username` FROM `allusers` WHERE
      `allusers`.`username` = '".@$_POST['username']."' AND
      `allusers`.`passwrd` = '".@$_POST['password']."'", $eg_objConn2);
      $eg_Result1 = @mysql_fetch_array($eg_recResult1, MYSQL_ASSOC);
      // Get online_regs Record Set
      $eg_recResult2 = mysql_query("SELECT
      `online_regs`.`egnID`,`online_regs`.`username` FROM `online_regs`
      WHERE `online_regs`.`username` = '".@$_POST['username']."' AND
      `online_regs`.`passwrd` = '".@$_POST['password']."'", $eg_objConn2);
      $eg_Result2 = @mysql_fetch_array($eg_recResult2, MYSQL_ASSOC);
      // Conditional statement
      // Set Session Value
      $_SESSION['loggedInUserID'] = @$eg_Result1['egnID'];

      $_SESSION['loggedInUsername'] = @$eg_Result1['username'];
      // adds 1 to the users "logincount" in the users table. that way
      you see how many times a person has logged in
      mysql_query("UPDATE allusers SET logincount = logincount+1 , online
      = 'yes' , lastlogin = '$lastlogin' , lasttimelogin = '$lasttime' ,
      Remote_computer_name = '$ip_address' , Browser_type = '$http_user' ,
      Timestamp = '$datetime' WHERE (username = '".@$_POST['username']."')")
      or die("Bad query: ".mysql_error());
      // inserting login information, 1 = correct login
      $insert = "INSERT INTO logins(timestamp, ip_address, username,
      password, correct, incorrect) ".
      "VALUES('$datetime', '$ip_address', '".@$_POST['username']."',
      '".@$_POST['password']."', '1', '0')"
      or die("Bad query: ".mysql_error());
      $mysql_insert = mysql_query($insert)
      or die("Bad query: ".mysql_error());
      // Go to page
      header("Location: membersmain.php?login=successful");
      // Set Session Value
      $_SESSION['loggedInUserID'] = @$eg_Result2['egnID'];

      $_SESSION['loggedInUsername'] = @$eg_Result2['username'];
      // Go to page
      header("Location: newuserinfo.php");

      $loginError = "Your user name and password do not match any in our
      // inserting login information, 0 = incorrect login
      $insert = "INSERT INTO logins (timestamp, ip_address, username,
      password, correct, incorrect) ".
      "VALUES ('$datetime', '$ip_address', '".@$_POST['username']."',
      '".@$_POST['password']."', '0', '1') "
      or die("Bad query: ".mysql_error());
      $mysql_insert = mysql_query($insert)
      or die("Please notify the admin that the script is connecting to
      the database, but not inserting the information<br><br>


      // Loop through all errors
      foreach($eg_error as $eg_message)
      <li id="validationError"><?= @$eg_message ?></li>

      <strong><font color="red"><p id="loginError" align="center"><?=
      $loginError ?></p></font></strong>
      <p class="bot" style="margin-bottom: -5px; margin-left: 40px;">
      // Tidy up used objects
      // Close Main recordset
      if(isset($eg_recResult1)) @mysql_free_result($eg_recResult1);
      // Close Online Registration recordset
      if(isset($eg_recResult2)) @mysql_free_result($eg_recResult2);

      // Close database connection
      if(isset($eg_objConn2)) @mysql_close($eg_objConn2);


      The variables I'd like to pass to overlib are $loginError and

      Any input would be appreciated!
    Your message has been successfully submitted and would be delivered to recipients shortly.