?
Solved

div parent page load

Posted on 2011-03-08
6
Medium Priority
?
217 Views
Last Modified: 2012-05-11
I have the following code that logs the user in, the only issue is the script is in a div, so when it loads the contents needed, it loads it within that same div instead of loading it on the parent level.  
Help Please!

This is the login page that holds the div
<body>

<table  border="0" cellpadding="0" cellspacing="0" hspace="0">
<tr>
  <td><table  border="0" cellpadding="0" cellspacing="0" hspace="0">
    <tr>
      <td><img src="images/login.png" border="0" usemap="#Map"></td>
    </tr>
  </table></td>
</tr>
</table>

<div class="login" style="left:757px; top:190px; overflow:no;">
<object data="scripts/login_field.html" type="text/html" name="foo" width="460" height="195" id="foo" style="width:460px; height:150px;"></object>
</div>
</body>

Open in new window



Here is the actual form
</head>

<body>
<table width="300" border="0" align="left" cellpadding="0" cellspacing="1">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78" align="right">Email</td>
<td width="6">:</td>
<td width="294"><input name="email1" type="text" id="email1"></td>
</tr>
<tr>
<td align="right">Password</td>
<td>:</td>
<td><input name="password1" type="password" id="password1"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>

Open in new window

0
Comment
Question by:MsKrissy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 35076532
This javascript will push the PHP page to the parent frame but you can see it move.  I assume you have more code on those pages or you wouldn't be doing this this way.  I don't know how to make it open first in the parent window.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>checklogin.php</title>
<script type="text/javascript">
<!--
function breakout_of_frame()
{
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}
// -->
</script>
</head>
<body onload="breakout_of_frame()">
<h1>checklogin.php</h1>
</body>
</html>

Open in new window

0
 

Author Comment

by:MsKrissy
ID: 35076977
I do have other code on these pages.  I have added the code you offered, here is how I have it implemented.  Let me know if this is correct, because I am still getting the same results:

<?php
include_once "connections/connect_to_mysql.php";
		 
		$id = 'id';
		$username = 'username';
		$email1 = 'email1';

// username and password sent from form
   		$email1 = $_POST['email1'];
        $password1 = $_POST['password1'];


// To protect MySQL injection
         $email1=strip_tags($email1);
		 $email1=mysql_real_escape_string($email1);
		 $email1=eregi_replace("'","",$email1);
		 
         $password1=strip_tags($password1);
         $password1=mysql_real_escape_string($password1);
         $password1=eregi_replace("'","",$password1);
         $password1=md5($password1);


$sql = mysql_query("SELECT * FROM userreg WHERE email1='$email1' AND password1='$password1'"); 
         $login_check=mysql_num_rows($sql);
       
        if ($login_check != 0){
while($row = mysql_fetch_array($sql)){
		// Set a session variable for their ID
		$id = $row["id"]; 
		session_register('id'); // Register the session variable's id
		$_SESSION['id'] = $id; // Put the value you want in that session variable

		// Set a session variable for their username
		$username = $row["username"]; 
		session_register('username'); // Register the session variable's username
		$_SESSION['username'] = $username; // Put the value you want in that session variable

		// Set a session variable for their name
		$email1 = $row["email1"]; 
		session_register('email1'); // Register the session variable's email
		$_SESSION['email1'] = $email1; // Put the value you want in that session variable
		
        mysql_query("UPDATE userreg SET last_log_date=now() WHERE username='$username'"); 
    } // close while
	
header("location:../main.php");
}
else {
echo "Wrong Username or Password";
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>checklogin.php</title>
<script type="text/javascript">
<!--
function breakout_of_frame()
{
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}
// -->
</script>
</head>
<body onload="breakout_of_frame()">
<h1>checklogin.php</h1>
</body>
</html>

Open in new window



The login.html calls the form from the login_field.html file, and the checklogin.php is the logic.
0
 

Author Comment

by:MsKrissy
ID: 35077047
Okay,
I misspoke, it does work if the user puts in the incorrect username or password.  But it doesn't work if they put in the correct information.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 35077067
Yep, that's the way it works.  I did prototype it with those file names.
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1600 total points
ID: 35077072
Then you would need to add that code to 'main.php'.
0
 

Author Closing Comment

by:MsKrissy
ID: 35077549
Thank you for the help, I will research how to get the page to load without loading the frame first.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question