jd2007 Posted July 15, 2007 Share Posted July 15, 2007 profile.php <?php session_start(); header("Cache-control: private"); if (!$_SESSION['username']) { echo "You aren't logged in."; include("login.php"); exit(); } echo "<img src='' alt=''><br><br> <img class='a' src='photoframe.png' alt=''> <b>Name:</b> $_SESSION[name]<br><br> <b>Age:</b> $_SESSION[age] <br><br> <b>Location:</b> $_SESSION[location]<br><br> <b>Personality:</b> $_SESSION[personality]<br><br> <b>Hobbies & Interests:</b> $_SESSION[hobbies]<br><br> <b>E-mail:</b> $_SESSION[email]<br><br> <b>Favorite Books:</b> $_SESSION[books]<br><br> <b>Favorite Shows:</b> $_SESSION[shows]<br><br> <b>Favorite Music:</b> $_SESSION[music]<br><br> <b>Occupation:</b> $_SESSION[occupation]<br><br> <b>About Me:</b> $_SESSION[aboutme]<br><br> "; echo ; ?> the link to profile.php is here: <?php //echo "Hi"; /*Use of Sessions*/ //if(!session_id()) //session_start(); //header("Cache-control: private"); //avoid an IE6 bug (keep this line on top of the page) if (isset($_POST["username"]) && isset($_POST["password"])) { /*Connection to database logindb using your login name and password*/ $db=mysql_connect('localhost','root') or die(mysql_error()); mysql_select_db('UserProfile'); $user_info = "SELECT * FROM users WHERE username='$username' AND password='$password'"; $result_name_check = mysql_query($user_info); $usersfound = mysql_num_rows($result_name_check); // if user not found, note that and end if ($usersfound < 1) { $error = "User $user not found."; // if user does exist, continue with processing } else { $_SESSION['Logged In'] = "true"; $_SESSION['username'] = $_POST['username']; $_SESSION['encryptpass'] = $user_info['cpass']; $_SESSION['email'] = $user_info['email']; $_SESSION['name'] = $user_info['name']; $_SESSION['age'] = $user_info['age']; $_SESSION['location'] = $user_info['location']; $_SESSION['personality'] = $user_info['personality']; $_SESSION['hobbies'] = $user_info['hobbies']; $_SESSION['email'] = $user_info['email']; $_SESSION['books'] = $user_info['books']; $_SESSION['shows'] = $user_info['shows']; $_SESSION['music'] = $user_info['music']; $_SESSION['occupation'] = $user_info['occupation']; $_SESSION['aboutme'] = $user_info['aboutme']; $_SESSION['photo'] = $user_info['photo']; echo "Welcome"; echo "<a href='profile.php'>My Profile</a>"; exit; } } else if (!isset($_POST["username"]) && isset($_POST["password"])) { echo "Please enter your username."; echo "<form method='post' action='login.php'> Username: <input type='text' name='username'><br> Password: <input type='text' name='password'><br> <input type='submit' value='Login'> </form>"; exit; } else if (isset($_POST["username"]) && !isset($_POST["password"])) { echo "Please enter your password."; echo "<form method='post' action='login.php'> Username: <input type='text' value=$_POST[username] name='username'><br> Password: <input type='text' name='password'><br> <input type='submit' value='Login'> </form>"; exit; } else if (!isset($_POST["username"]) && !isset($_POST["password"])) { echo "Please enter your username and password."; echo "<form method='post' action='login.php'> Username: <input type='text' name='username'><br> Password: <input type='text' name='password'><br> <input type='submit' value='Login'> </form>"; exit; } else {echo "Error";} echo $error; ?> pls help me...tq... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.