golden hour
/home/phakp/public_html/formtools/global/code
⬆️ Go Up
Upload
File/Folder
Size
Actions
Accounts.class.php
14.56 KB
Del
OK
Administrator.class.php
32.41 KB
Del
OK
Clients.class.php
19.25 KB
Del
OK
Constants.class.php
51 B
Del
OK
Core.class.php
23.23 KB
Del
OK
CoreFieldTypes.class.php
11.16 KB
Del
OK
Database.class.php
6.34 KB
Del
OK
DatabaseSessions.class.php
3.09 KB
Del
OK
Emails.class.php
60.66 KB
Del
OK
Errors.class.php
4.78 KB
Del
OK
FieldOptions.class.php
1.1 KB
Del
OK
FieldSettings.class.php
1.25 KB
Del
OK
FieldSizes.class.php
2.9 KB
Del
OK
FieldTypes.class.php
61.04 KB
Del
OK
FieldValidation.class.php
11.7 KB
Del
OK
Fields.class.php
57.75 KB
Del
OK
Files.class.php
18.61 KB
Del
OK
Forms.class.php
63.07 KB
Del
OK
General.class.php
47.2 KB
Del
OK
Hooks.class.php
21.66 KB
Del
OK
Installation.class.php
57.45 KB
Del
OK
ListGroups.class.php
2.35 KB
Del
OK
Menus.class.php
36.83 KB
Del
OK
Module.abstract.class.php
8.29 KB
Del
OK
ModuleMenu.class.php
3.84 KB
Del
OK
Modules.class.php
30.52 KB
Del
OK
OmitLists.class.php
2.4 KB
Del
OK
OptionLists.class.php
28.04 KB
Del
OK
Pages.class.php
8.61 KB
Del
OK
Schemas.class.php
814 B
Del
OK
SecureSmarty.class.php
403 B
Del
OK
Sessions.class.php
4.01 KB
Del
OK
Settings.class.php
23.12 KB
Del
OK
Submissions.class.php
70.8 KB
Del
OK
Templates.class.php
6.64 KB
Del
OK
Themes.class.php
14.04 KB
Del
OK
Translations.class.php
3.54 KB
Del
OK
Upgrade.class.php
6.81 KB
Del
OK
User.class.php
14.47 KB
Del
OK
ViewColumns.class.php
3.06 KB
Del
OK
ViewFields.class.php
19.39 KB
Del
OK
ViewFilters.class.php
15.07 KB
Del
OK
ViewTabs.class.php
3.46 KB
Del
OK
Views.class.php
47.25 KB
Del
OK
actions.php
17.92 KB
Del
OK
field_types
-
Del
OK
index.php
35 B
Del
OK
polyfills.php
5.07 KB
Del
OK
validation.php
15.79 KB
Del
OK
Edit: DatabaseSessions.class.php
<?php /** * Handles database sessions. By default Form Tools uses PHP sessions, not database sessions. To enable this * usage, just add a $g_session_type = "database"; value to the global/config.php file. */ // ------------------------------------------------------------------------------------------------- namespace FormTools; use Exception; /** * Overrides the default PHP (file-based) sessions with database sessions, allowing using Form Tools being hosted * on multiple servers. */ class DatabaseSessions { private $sessionSavePath; private $db; function __construct($db, $session_save_path) { $this->db = $db; $this->sessionSavePath = $session_save_path; // register the various session handler functions session_set_save_handler( array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc") ); register_shutdown_function('session_write_close'); } public function open() { return true; } public function close() { return true; } public function read($session_id) { // fetch session data from the selected database $this->db->query(" SELECT session_data FROM {PREFIX}sessions WHERE session_id = :session_id AND expires > :expiry_time "); try { $this->db->bindAll(array( "session_id" => $session_id, "expiry_time" => time() )); $this->db->execute(); } catch (Exception $e) { Errors::queryError(__CLASS__, __FILE__, __LINE__, $e->getMessage()); exit; } $results = $this->db->fetchAll(); $a = count($results); $data = ""; if ($a > 0) { $row = $results[0]; $data = $row["session_data"]; } return $data; } // this is only executed until after the output stream has been closed public function write($session_id, $data) { $db = $this->db; if (Sessions::exists("account.sessions_timeout")) { $lifeTime = Sessions::get("account.sessions_timeout") * 60; } else { $lifeTime = Core::getApiSessionsTimeout(); } $db->query(" REPLACE {PREFIX}sessions (session_id, session_data, expires) VALUES (:session_id, :session_data, :expiry_time) "); try { $db->bindAll(array( "session_id" => $session_id, "session_data" => $data, "expiry_time" => time() + $lifeTime )); $db->execute(); } catch (Exception $e) { Errors::queryError(__CLASS__, __FILE__, __LINE__, $e->getMessage()); return false; } return true; } public function destroy($id) { $db = $this->db; $db->query("DELETE FROM {PREFIX}sessions WHERE session_id = :id"); $db->bind("id", $id); $db->execute(); return true; } // delete all records who have passed the expiration time public function gc() { $this->db->query("DELETE FROM {PREFIX}sessions WHERE expires < UNIX_TIMESTAMP()"); return true; } }
Save