Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><body background="background4.png"><center>
- <?php
- session_start();
- if(!isset($_SESSION['user_id']))
- {
- $message = 'You must be logged in to access this page';
- header("location:index.php");
- }
- else
- {
- try
- {
- $user_id = $_SESSION['user_id'];
- $mysql_hostname = 'localhost';
- $mysql_username = 'root';
- $mysql_password = 'mydatabase-password';
- $mysql_dbname = 'my-db';
- $dbh = new PDO("mysql:host=$mysql_hostname;dbname=$mysql_dbname", $mysql_username, $mysql_password);
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $stmt = $dbh->prepare("SELECT * FROM users WHERE user_id = :user_id");
- $stmt->bindParam(':user_id', $_SESSION['user_id'], PDO::PARAM_INT);
- $stmt->execute();
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- }
- catch (Exception $e)
- {
- $message = 'We are unable to process your request. Please try again later"';
- }
- }
- ?>
- <table width="398" border="0" align="center" cellpadding="0">
- <tr>
- <td height="26" colspan="2">Testing Data Information </td>
- <td><div align="right"><a href="profile.php">Update Data</a></div></td>
- </tr>
- <tr>
- <td width="129" rowspan="5"><img src="<?php echo $row['picture']; ?>" width="129" height="129" alt="no image found"/></td>
- <td width="82" valign="top"><div align="left">User ID:</div></td>
- <td width="165" valign="top"><?php echo $row['user_id']; ?></td>
- </tr>
- <tr>
- <td valign="top"><div align="left">User Name:</div></td>
- <td valign="top"><?php echo $row['username']; ?></td>
- </tr>
- <tr>
- <td valign="top"><div align="left">E-mail:</div></td>
- <td valign="top"><?php echo $row['email']; ?></td>
- </tr>
- <tr>
- <td valign="top"><div align="left">Address: </div></td>
- <td valign="top"><?php echo $row['address']; ?></td>
- </tr>
- <tr>
- <td valign="top"><div align="left">Phone Number: </div></td>
- <td valign="top"><?php echo $row['phone']; ?></td>
- </tr>
- </table>
- <p align="center"><a href="profile.php"></a></p>
- </html></body></center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement