3 users from 3 different tables.(table1, table2 and table3)
I want them to use one single login.
table1 = goes to mencp.php
table2 = goes to womencp.php
table3 = goes to fotografercp.php
My login work only with user´s from table1. I don´t know what I am doing worrong...
Help please!
login.php OBS! is uppdated
Code: Select all
<?php
session_start();
error_reporting(E_ALL);
ini_set("display_errors", 1);
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
//int $i;boolean $resultat=false;
$trouve=false;$i=0;
while(!$trouve && $i<3){
switch($i){
case 0:$type="table1"; $query = "SELECT * FROM table1 WHERE username='$postuser'";break;
case 1: $type="table2";$query = "SELECT * FROM table2 WHERE username='$postuser'";break;
case 2: $type="table3";$query = "SELECT * FROM table3 WHERE username='$postuser'";break;
}
...........
Code: Select all
<?php
if($_SESSION['userlogin']==true){?>
<table width="270" height="70" border="0" align="left">
<tbody>
<tr>
<td align="right"><font style="font-size:16px; font-weight:bold; font-family:Verdana, Arial, sans-serif; color:#D9EEF2"> <?php echo "WELLCOME $_SESSION[name]";?> </font></td>
</tr>
<tr>
<td align="right"><a href="logout.php"><font style="font-size:11px; font-weight:bold; font-family:Verdana, Arial, sans-serif; color:#ffffff">LOG OUT</font></a></td>
</tr>
<tr>
<td align="right"></td>
</tr>
</tbody>
</table>
<?php }else{ ?>
<form action="login.php" method="post">
<input type="text" name="user" class="itext" size="25" />Lösenord:
<table width="270" height="90" border="0" align="left">
<tbody>
<tr>
<td width="130" valign="top" height="15" align="right">Användarnamn:</td>
<td valign="top" class="texta"> </td>
</tr>
<tr>
<td width="130" valign="top" height="15" align="right"> </td>
<td valign="top" style="width:125; height:12;background-repeat:no-repeat" class="texta"><input type="password" name="pass" class="itext" /></td>
</tr>
<tr>
<td height="15"> </td>
<td valign="top" align="left"><input type="submit" value="Login" class="form-button" /></td>
</tr>
</tbody>
</table>
</form>
..............
config.php
Code: Select all
<?php
$host="localhost";
$user="xxxxxxxxxxxxx";
$password="xxxxxxxxxxxxxx";
$db="xxxxxxxxxxx";
?>
?>
[/syntax]