Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

login bar and tab searsh

Skilled Illusionist
Joined
Jan 14, 2005
Messages
395
Reaction score
2
uhm i have problem with i did include bar.php to
index.php of tab searsh but now when i hit login nothing did happen



id : test
pw : test

bar.php
Code:
<?php session_start();
 if(isset($_COOKIE['uname'])&&isset($_COOKIE['upass'])) {
  $_SESSION['user_name']=$_COOKIE['uname'];
  $_SESSION['user_pass']=$_COOKIE['upass'];
 }
 if (!isset($_SESSION['user_name']) || !isset($_SESSION['user_pass'])) {
  $logged_in=0;
 } else {
 $link=mysql_connect('host','username','password');
 if(!$link) die('MySQL connection failure');
 mysql_select_db('database');
 $query=sprintf("select Id,Password from user where Id='%s' and password='%s'",
  mysql_real_escape_string($_SESSION['user_name']),
  mysql_real_escape_string($_SESSION['user_pass']));
 $result=mysql_query($query);
 $row=mysql_fetch_row($result);
 if($row) {
  $logged_in=1;
  $_SESSION['user_name']=$row[0];
  $_SESSION['user_pass']=$row[1];
 } else {
  unset($_SESSION['username']);
  unset($_SESSION['password']);
  $logged_in=0;
 }
}
if(!$logged_in) {
?><form action="login.php" onClick="return handlelink(this)" method=post>
  <input type=submit value="Login"><input type=text name=uid size=16 maxlen=16 accesskey=u value="Username"><input type=password name=pass size=16 maxlen=128 accesskey=p value="Password"></form>
<p>
  <?php } else { ?>
hallo <b><?php echo $_SESSION['user_name'] ?></b> </p>
<p>:: <a href="logout.php" onClick="return handlelink(this)">Logout</a></p>
<p>:: <a href="gb.php" onClick="return handlelink(this)">GastenBoek</a>  
  <?php } ?>
</p>
</td></table></div>

index.php
Code:
<html>
<head>

<title> 
</title>
<link rel=stylesheet type="text/css" href="css/main.css"> </style>


<script src="js/javascript-tab1.js"> </script>

</head>

<body>

<?php require("bar.php"); ?>


<ul id="tablist">
<li><a class="current" href="index2.html" onClick="return handlelink(this)">Home</a></li>
<li><a href="about.html" onClick="return handlelink(this)">About</a></li>
</ul>
<iframe id="tabiframe" src="index2.html" width="100%" height="91%"></iframe>


</body>
</html>

thank you if you can fix it.
no need comment username1
 
---
Member
Joined
Aug 18, 2004
Messages
641
Reaction score
3
Hmm.. Weird, whenever I clicked on the login/password box it will show on your frame.
 
---
Member
Joined
Aug 18, 2004
Messages
641
Reaction score
3
Hmm.. Now I could see your site, but I couldn't find the login box.
 
Custom Title Activated
Member
Joined
Aug 8, 2004
Messages
3,892
Reaction score
20
Erm, same here.. :eh:

By the way, your session won't work. FIRST you output HTML, THEN you include the session start - that means there's already output there before the PHP. You could work around it using ob_start and ob_flush etc, but its MUCH better practice to fix the source of the problem: your crappy mix of logic and code.

I strongly advice you to have a look at and learn how to use a template manager.
 
Back
Top