Advertisement

05.26.2008 at 07:56PM PDT, ID: 23433795
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

error in registering session variables

Asked by maslam in PHP and Databases

Tags: ,

Hi experts,

Please see the code below, working fine on mysql 4.1.22 but not on mysql 5.0
displaying the following error for all session variables.
Please note register_globals is Off and want to keep it Off.

Notice: Use of undefined constant first_name - assumed 'first_name' in calllog.php on line 38
--------------------------
 <?
      2 /* Check User Script */
      3 session_start();  // Start Session
      4
      5 include 'db.php';
      6 // Conver to simple variables
      7 $username = $_POST['username'];
      8 $password = $_POST['password'];
      9
     10 if((!$username) || (!$password)){
     11         $msg2 =  "Please enter ALL of the information! <br />";
     12         include 'left.html';
     13         exit();
     14 }
     15
     16 // Convert password to md5 hash
     17 $password = md5($password);
     18
     19 // check if the user info validates the db
     20 $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
     21 $login_check = mysql_num_rows($sql);
     22
     23 if($login_check > 0){
     24         while($row = mysql_fetch_array($sql)){
     25
     26         foreach( $row AS $key => $val ){
     27                 $key = stripslashes($val);
     28         }
     29                 // Register some session variables!
     30                 session_is_registered('first_name');
     31                 $_SESSION['first_name'] = $row[first_name];
     32                 session_register('last_name');
     33                 $_SESSION['last_name'] = $row[last_name];
     34                 session_register('email_address');
     35                 $_SESSION['email_address'] = $row[email_address];
     36                 session_register("user_level");
     37                 $_SESSION['user_level'] = $row[user_level];
     38                 session_register('username');
     39                 $_SESSION['username'] = $row[username];
     40                
     41                 mysql_query("UPDATE users SET last_login=now() WHERE userid='$row[userid]'");
     42                 $msg1 = "";
     43                 $msg2 = "";
     44                 $msg3 = "";
     45                
     46     if($user_level==0) {
     47         include 'indexlevel0.html';
     48         }
--------------------------------------------------Start Free Trial
[+][-]05.27.2008 at 06:17AM PDT, ID: 21651581

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.27.2008 at 07:57AM PDT, ID: 21652378

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP and Databases
Tags: php, firefox
Sign Up Now!
Solution Provided By: maslam
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628