Jump to content

KingIsulgard

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

KingIsulgard's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I already made the static function and made the constructors protected, but that didn't work eather.
  2. Is there a way in PHP to protect certain classes to only be created via another class? So you can't access them directly, it should first pass another class before it gets created. So CLASSA->do(); will return an instance of CLASSB but CLASSB() shouldn't work to get an instance. Is something like this possible? I want to create something like packages in java.
  3. Well -1 day in the future means one day in the past, so it is already passed which means the cookie should get deleted. It's not like I have to substracted a month from the cookies time. I just set a NEW time in the past.
  4. I guess that the foodtype you specify is a string so it needs quotes <?php $query3= "SELECT r.restaurantname, r.image, f.name FROM restaurants r INNER JOIN foodtypes f ON r.restaurants_id = f.restaurants_id WHERE f.name = '" . $_GET['foodtype'] . "'"; ?>
  5. Yes it is unwise because it will give troubles when two people are updating the file at the same time.
  6. Can you please explain what the specific problem is?
  7. Hi there, I am writing an authentication script with an class Authentication who checks if a user is logged in or not. Everything works fine, logging in, checking if logged in, checking if there is a cookie TO log in when not yet logged in, and so on. Except one thing. When logging out, I can destroy the sessions and the user gets logged out. But he logs in immediately again because somehow the cookie survived the logout script. This is very weird since I actually destroy the cookie in the logout function. Can you please check it for me? Here is a snippet of the code: // Fucntion to log the user out public function logOut() { // Clear sessions unset($_SESSION["security"]); unset($_SESSION["loggedin"]); session_unset(); session_destroy(); // Set the user status to not logged in $this->loggedIn = false; // Destroy cookie setcookie("BusinessgameRemember", "", time() - 60*60*24); } // Function to create a new session public function createSession($securityCode) { session_start(); // Activate the use of sessions $_SESSION["loggedin"] = "true"; $_SESSION["security"] = $securityCode; } // Function to create a new cookie public function createCookie($securityCode) { // Set cookie setcookie("BusinessgameRemember", $securityCode, time() + 60*60*24*30); } You can see the code that creates the sessions and the script which creates a cookie (both works fine). The logout function DOES destroy the sessions but not the cookie. Any hints? :s
×
×
  • 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.