February 4, 201115 yr I've been learning PHP and MYSQL for 2 months now. MYSQL is no problem - easy to learn and easy to program. PHP is harder to program than doing 150 push-ups in one second. Okay, maybe I'm over exaggerating, but it's hard. I'm getting use to the operators, booleans, and all that stuff, but what really bugs me are those sessions. I don't know how to use sessions properly. I'm trying to create a login and then view your personal profile, but it ain't happening - in my life anyway. Can someone please help me out?
February 4, 201115 yr Sessions are one of the easiest parts of PHP... e.g <?php //start the session session_start(); //increment the 'hit' counter $_SESSION['counter']++; //display session vars echo "You have been here " .$_SESSION['counter'] . " times this session."; What specifically do you not understand about them? Post code if you already have something but are stuck on it.
February 4, 201115 yr Author Sessions are one of the easiest parts of PHP... e.g <?php //start the session session_start(); //increment the 'hit' counter $_SESSION['counter']++; //display session vars echo "You have been here " .$_SESSION['counter'] . " times this session."; What specifically do you not understand about them? Post code if you already have something but are stuck on it. I'm trying to create a script when you log in, you can customize your profile and have your profile shown to the public.
February 5, 201115 yr I'm trying to create a script when you log in, you can customize your profile and have your profile shown to the public. Perhaps you should practice simple counters like the above before jumping to the login, Heres what you have to face with a login system - Protection against session hyjacking - User Registration - MYSQL Protection Sessions are easy, Just imagen them as a database, to store a value: $_SESSION['my_session'] = 'my_value'; To retrieve a value: echo $_SESSION['my_session']; Remember to use session_start() at the top of the page.
February 13, 201115 yr Remember to include a test at the start of each script to make sure the user is logged in Example, in myprofile.php session_start(); if (!isset($_SESSION["userName"])){ header( "Location: http://www.blahblag/login" ); }
Create an account or sign in to comment