Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //includes
- include('connect.php');
- //get cookie value & display username if cookie set.
- If(isset($_COOKIE['username'])) {
- echo "Welcome" . $_COOKIE['user'] . "!<br />";
- //retrieve user ID for accessing user profile.
- $username = $_COOKIE['username'];
- //search for user with username stored in cookie in database, then obtain their profile ID.
- $sql = "SELECT user_id FROM users WHERE username='$username'";
- $id = mysql_query($sql);
- } else {
- echo "Welcome, Guest! <br/>";
- }
- ?>
- <html>
- <head>
- <center><b>
- Home
- </b></center>
- <style type="text/css">
- a:link {color:blue;text-decoration:none;}
- a:visited {color:purple;text-decoration:none;}
- a:hover {color:black;text-decoration:none;}
- </style>
- </head>
- <title> Home </title>
- <br />
- <hr />
- <br />
- <br />
- <? php 'a href=profile.php?id=."$id".' ?>
Advertisement
Add Comment
Please, Sign In to add comment