Jump to content

[SOLVED] INTERGRATING A PHP LOGIN SYSTEM


mcdof001

Recommended Posts

Hi,

 

I am having a little trouble intergrating a login / user management script with my html pages. I have used the div tag put in my php in there and put the rest of the php where it is originally placed in the script. Here is my problem. I would like my user to stay on the same main page while the login part changes (goes to the members area). I have tried using i-frames but if there is a link in one, the main page does not change the i-frame does. Can this be solved with more php. I do not want my user to have to go back to the index page as soon as they login. If anybody understands what I'm saying please can you help me out.  ??? :-\ ???

 

P.S If you would like to see my source code just ask. It's probably something simple, and I'm being an idiot. Sorry for my lack of PHP knowledge. I'm learning. lol  ;D

Link to comment
Share on other sites

There you are. Thanks a lot. Some of the text there is not my actual content. I just wrote it as an example lol. mcdof001

 

<?php
require_once('common.php');

$error = '0';

if (isset($_POST['submitBtn'])){
// Get user input
$username = isset($_POST['username']) ? $_POST['username'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
        
// Try to login the user
$error = loginUser($username,$password);
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CRAP TV</title>
<style type="text/css">
<!--
body {
background-color: #000000;
}
.style1 {
color: #FFFFFF;
font-family: "Trebuchet MS";
}
.style2 {color: #FFFFFF}
-->
</style>
<link rel="icon" href="favicon.ico" /></head>

<body>
<div align="center"><img src="logo.gif" width="400" height="150" /></div>
<p align="center">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="635" height="50">
    <param name="movie" value="navbar.swf" />
    <param name="quality" value="high" />
    <embed src="navbar.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="635" height="50"></embed>
  </object>
</p>
<h1 align="center" class="style1">HOME</h1>

<table width="963" height="47" border="0" align="center">
  <tr>
    <th width="261" scope="col"><p><div id="main">
<?php if ($error != '') {?>
      <div class="caption">Site login</div>
      <div id="icon"> </div>
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="loginform">
        <table width="100%">
          <tr><td><span class="style2">Username:</span></td>
          <td> <input class="text" name="username" type="text"  /></td></tr>
          <tr><td><span class="style2">Password:</span></td>
          <td> <input class="text" name="password" type="password" /></td></tr>
          <tr><td colspan="2" align="center"><input class="text" type="submit" name="submitBtn" value="Login" /></td></tr>
        </table>  
      </form>
      
       <a href="register.php">Register</a>
      
<?php 
}   
    if (isset($_POST['submitBtn'])){

?>
      <div class="caption">Login result:</div>
      <div id="icon2"> </div>
      <div id="result">
        <table width="100%"><tr><td><br/>
<?php
if ($error == '') {
	echo "Welcome $username! <br/>You are logged in!<br/><br/>";
	echo '<a href="main.php">Click here to enter!</a>';
}
else echo $error;

?>
	<br/><br/><br/></td></tr></table>
</div>
<?php            
    }
?>
<div id="source">CRAP TV</div>
    </div></th>
    <th width="513" scope="col"><table width="513" height="227" border="2" align="left" bordercolor="#FFFFFF">
  <tr>
    <th width="246" scope="col"><div align="center" class="style1">
      <p>NO DRUGS! VIDEO </p>
      <p>Hello and welcome to the brand new Crap TV and why not kick off your Crap life by watching our very first ever video <a href="http://craptv.ohcrap.org/videos/" target="_self">"NO DRUGS" </a></p>
    </div></th>
    <th width="249" scope="col"><img src="nodrugssnapshot.jpg" alt="Pic" width="221" height="185" /></th>
  </tr>
    </table></th>
    <th width="261" scope="col"><p>
      <iframe src="login.htm" width="175" height="250"><a href="login.htm" target="_self">Your browser doesn't support iFrames, please click on this link to see the content you're missing.</a></iframe>
    </p>    </th>
  </tr>
</table>
<p> </p>
<table width="513" height="227" border="2" align="center" bordercolor="#FFFFFF">
  <tr>
    <th width="246" scope="col"><div align="center" class="style1">
      <p>MORE PICS COMING SOON! </p>
      <p>We are frequently updated our pics service. Why not <a href="http://blah/pics/">check it</a> today, who knows there may already be some crap there </p>
    </div></th>
    <th width="249" scope="col"><img src="snap1.jpg" width="143" height="174" /></th>
  </tr>
</table>
<p align="center" class="style1"> </p>
<p align="center" class="style1"> </p>
<p align="right" class="style1"> </p>
<p align="right" class="style1"> </p>
  </p>
</body>
</html>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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