Jump to content

TheEddy

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Everything posted by TheEddy

  1. The code I have set up doesn't work. If I change the edit profile code from: $_SESSION['userID'] = $row['userID']; to: $_SESSION['userID'] = 1; It works for the user with the userID of 1. I think that there is nothing in $row['userID'] or $_SESSION['userID'] is not working correctly. Edit: Yup, the problem is with $row['userID']
  2. Oh, and this is what I have for my editprofile.php so far. Nothing much in the content part, just trying to get it to work. <?php if(!isset($_SESSION)) { session_start(); } $_SESSION['userID'] = $row["userID"]; ?> <?php if ($_SESSION['authorized'] != true) { header("Location: login.php"); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/xml; charset=utf-8" /> <title>Edit Profile</title> <style type = "text/css"> table { margin: 0 auto; </style> </head> <body> <?php require_once ("dbconn.php"); ?> <?php if(isset($_SESSION['userID'])){ $result = mysql_query("SELECT * FROM `users` WHERE `userID` = '".mysql_real_escape_string($_SESSION['userID'])."' LIMIT 1") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $userName = $_SESSION['userID']; print ("Testing. Your ID is $userID <br /><a href=\"http://localhost/mgnml/logout.php\">Log Out</a>"); } } ?> </body> </html>
  3. <?php session_start(); require_once ("dbconn.php"); $select_user = mysql_query("SELECT * FROM `users` WHERE `userName` = '".mysql_real_escape_string($_POST['username'])."' AND `password` = '".mysql_real_escape_string(md5($_POST['password']))."'"); if (mysql_num_rows($select_user) != 0) { $_SESSION['authorized'] = true; $_SESSION['userID'] = $row["userID"]; header("Location: editprofile.php"); exit; } else { header("Location: login.php"); exit; } ?> That's what I have set up for the login form. Do I have "userID" part right?
  4. Is that how scripts such as forums normally do it?
  5. That's what I want to know lol. $_SESSION['userID'] = "1"; That's currently what I have for testing purposes. But I want it to have a variable that will equal the userID of whoever is logged in.
  6. Well, I have been able to create a registration and login page. Now I am trying to make an "Edit Profile" page but I can't seem to be able to pull up their primary key field which is called "userID" and I need help doing this. How would I get it from the MySQL database?
  7. I want it to work with: <script> var $J = jQuery.noConflict(); </script> What exactly do I have to change in the jQuery code?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.