SarumanTheWhite's Profile User Rating: -----

Reputation: 69 Whiz
Active Members
Active Posts:
346 (0.17 per day)
04-November 08
Profile Views:
Last Active:
User is offline Apr 02 2014 05:50 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Your Car:
Dream Kudos:

Latest Visitors

Icon   SarumanTheWhite has not set their status

Posts I've Made

  1. In Topic: Custom Session Wrapper: Read() function issues

    Posted 24 Aug 2013

    Yea, I'm far from finished with these classes. I was juggling all sorts of ideas in my head as far as what to do. I'll likely keep making more improvements to the design of all this.

    I wanted to use the database for more of a learning experience. And also that larger applications that're spread out across different servers tend to use one centralized location for storing sessions and all that. Not that it'll ever get that large I just wanted to see how it could be done.

    I think I've ran across memcached when I was searching for this stuff but I've yet to use it. If it can serve the same purpose then that might be something I can look into
  2. In Topic: Custom Session Wrapper: Read() function issues

    Posted 23 Aug 2013

    Ok, after trudging through the errors some more and giving myself a break from wracking my brain on this issue. I just realized something I hadn't before.

    Every time I ran through these tests I started with an empty table. So there was nothing in it initially and because of this there seemed to be a problem with the order in which my SQL statements were being performed. I realized from the order of the queries in the error log that the one used to search for an existing session (read() I presume) was being launched BEFORE the query that was supposed to actually WRITE the session into the database (the write() function of the wrapper). But all that was supposed to be handled by the session_set_save_handler function.

    Then I was thinking perhaps I accidentally swapped these functions in the parameter list of that function but that doesn't appear to be the case. Now I'm wondering if it's because of the order in which I listed the functions within the Session class itself... however that can't be right. It shouldn't matter, should it?

    I'll post a section of code where I'm utilizing these Sessions to see if anyone can spot what I'm doing wrong here:

    public function login()
    			$username = $_POST['txt_username'];
    			$password = $_POST['pwd_username'];
    			if($this->model->auth_user($username, $password));
    				//TO-DO: Need to pass in the ID of the user being authenticated.
    				//To do this though will need a new function in the DB class that retrieves this
    				$session = new SessionEngine($session_config);
    						array($session, 'open'),
    						array($session, 'close'),
    						array($session, 'read'),
    						array($session, 'write'),
    						array($session, 'destroy'),
    						array($session, 'gc'));
    				$_SESSION['auth'] = true;
    				$_SESSION['username'] = $username;
    					error_log("******** Session data: ".var_export($_SESSION), 0);
    				$this->Add('username', $username);			
    				//header("Location: /");
  3. In Topic: Custom Session Wrapper: Read() function issues

    Posted 21 Aug 2013

    Well there wasn't any special reason for me writing it like that. If it's more benefitial that I extend that class then I could make those changes at some point in the future.

    The reason is because in the get_column function where I'm var_exporting the contents of $row and $results to the log to inspect them, when I go look in the log nothing is being shown for both calls. Which led me to believe the result set is blank. That should indicate something is wrong with the query itself however I cannot place my finger on exactly what that is! Because as I've said I already ran it straight from the client and it worked.

    Here is the structure of the Session table:
    CREATE TABLE `sessions` (
      `session_id` varchar(32) NOT NULL,
      `contents` blob NOT NULL,
      `ip_address` varchar(16) DEFAULT NULL,
      `user_agent` tinytext,
      `users_id` int(11) NOT NULL,
      PRIMARY KEY (`session_id`,`users_id`),
      UNIQUE KEY `session_id_UNIQUE` (`session_id`),
      KEY `fk_sessions_users_idx` (`users_id`),
      CONSTRAINT `fk_sessions_users` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Holds all session data'$$
  4. In Topic: Computer Science Book Suggestions

    Posted 21 Aug 2013

    As far as Algorithms go I really learned alot from Skiena's Algorithm Design Manual
  5. In Topic: Syntax Issue for resetting MySql root password?

    Posted 27 Jun 2013

    By typing "exit"

My Information

Member Title:
D.I.C Regular
27 years old
April 30, 1986
Computers, books, Amateur Radio, learning
Years Programming:
Programming Languages:
C++, C#, VB, PHP, Java, Python, ASP.NET

Contact Information

Click here to e-mail me
Website URL:
Website URL  http://
Yahoo  Saruman_W



SarumanTheWhite has no profile comments yet. Why not say hello?