Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $host="localhost"; // Host name
- $username="something"; // Mysql username
- $password="something else"; // Mysql password
- $db_name="users"; // Database name
- $tbl_name="members"; // Table name
- // Connect to server and select database.
- mysql_connect("$host", "$username", "$password")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- // Define $myusername and $mypassword
- if(!isset($_POST['myusername']) || !isset($_POST['mypassword']))
- {
- // Remove one of the following 2 lines.
- die("You are not logged in"); //display simple message
- header('Location: /login.php'); // or redirect to loginpage
- exit();
- }
- $myusername=mysql_real_escape_string($_POST['myusername']);
- $mypassword=mysql_real_escape_string($_POST['mypassword']);
- // Select table
- $result=mysql_query("SELECT * FROM members WHERE myusername='$myusername' AND mypassword='$mypassword'")
- or die(mysql_error());
- if(mysql_num_rows($result)!=1)
- {
- die('Bad username/password');
- }
- $row=mysql_fetch_array($result);
- ?>
- <html>
- <head>
- <title>Portals</title>
- </head>
- <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
- <tr>
- <td>
- <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
- <tr>
- <td colspan="3"><strong>Portals</strong></td>
- </tr>
- <tr>
- <td width="22">1.</td>
- <td width="219">
- <?php
- PRINT " <a href=".$row['portal1']."> ".$row['portal1']."</a>";
- ?>
- </td>
- <td width="35">edit</td>
- </tr>
- <tr>
- <td width="22">2.</td>
- <td width="219">
- <?php
- PRINT " <a href=".$row['portal2']."> ".$row['portal2']."</a>";
- ?>
- </td>
- <td width="35">edit</td>
- </tr>
- <tr>
- <td width="22">3.</td>
- <td width="219">
- <?php
- PRINT " <a href=".$row['portal3']."> ".$row['portal3']."</a>";
- ?>
- </td>
- <td width="35">edit</td>
- </tr>
- <tr>
- <td colspan="3" align="right">
- <?php
- PRINT "$myusername";
- ?>
- </td>
- </tr>
- <tr>
- <td colspan="3" align="right"><a href='logout.php'>logout</a></td>
- </tr>
- </table>
- </table>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement