summaryrefslogtreecommitdiff
path: root/installer/installer.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-03-08 21:21:09 +0000
committerBharat Mediratta <bharat@menalto.com>2009-03-08 21:21:09 +0000
commit72c7fed975ce797da1f33ea82651c5a91ce3957e (patch)
tree4e84359029adcd40e31c3b20031c1096018e50aa /installer/installer.php
parent7cbc904be722b493a060e2ad69849344124fbe91 (diff)
Log the user in as admin after running the web installer, and give
them a nice "Welcome to Gallery 3" dialog. The text in there needs a little work but it's a start. In the process, re-build the install.sql using the scaffolding code.
Diffstat (limited to 'installer/installer.php')
-rw-r--r--installer/installer.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/installer/installer.php b/installer/installer.php
index 9ea551a8..ff727340 100644
--- a/installer/installer.php
+++ b/installer/installer.php
@@ -98,6 +98,25 @@ class installer {
return array("admin", $password);
}
+ static function create_admin_session($config) {
+ $session_id = md5(time() * rand());
+ $user_agent = $_SERVER["HTTP_USER_AGENT"];
+ $user_agent_len = strlen($user_agent);
+ $now = time();
+ $data = "session_id|s:32:\"$session_id\"";
+ $data .= ";user_agent|s:{$user_agent_len}:\"$user_agent\"";
+ $data .= ";user|i:2";
+ $data .= ";last_activity|i:$now";
+ $data = base64_encode($data);
+ $sql = "INSERT INTO {sessions} VALUES('$session_id', $now, '$data')";
+ $sql = self::prepend_prefix($config["prefix"], $sql);
+ if (mysql_query($sql)) {
+ setcookie("g3sid", $session_id, 0, "/", "", false, false);
+ } else {
+ throw new Exception(mysql_error());
+ }
+ }
+
static function create_private_key($config) {
$key = md5(uniqid(mt_rand(), true)) . md5(uniqid(mt_rand(), true));
$sql = self::prepend_prefix($config["prefix"],