Esempio n. 1
0
 }
 $check = mysql_query("SELECT * FROM users WHERE username = '******'username'] . "'") or die(mysql_error());
 //Gives error if user doesn't exist
 $check2 = mysql_num_rows($check);
 if ($check2 == 0) {
     echo $title;
     diehard();
 }
 while ($info = mysql_fetch_array($check)) {
     $_POST['pass'] = stripslashes($_POST['pass']);
     $info['password'] = stripslashes($info['password']);
     $_POST['pass'] = md5($_POST['pass']);
     //gives error if the password is wrong
     if ($_POST['pass'] != $info['password']) {
         echo $title;
         diehard();
         //die('Mot de passe incorrect, <a href=index0.php>réessayez</a>.');
     } else {
         // if login is ok then we add a cookie
         $_POST['username'] = stripslashes($_POST['username']);
         $hour = time() + 22000;
         setcookie("ID_my_site", $_POST['username'], $hour);
         setcookie("Key_my_site", $_POST['pass'], $hour);
         if (is_dir("TMP_cooc/" . $_POST['username'])) {
             rmdirr("TMP_cooc/" . $_POST['username']);
         }
         if (is_dir("TMP/" . $_POST['username'])) {
             rmdirr("TMP/" . $_POST['username']);
         }
         //then redirect them to the members area
         header("Location: " . $page_origine);
Esempio n. 2
0
 $htaccess .= "RewriteRule ^([^/.]*)/?([^/.]*)/?([^/.]*)\$ " . $dir . "index.php?page=\$1&category=\$2&post=\$3 [QSA,L]";
 $currentmodal = substr(sprintf('%o', fileperms($path)), -4);
 if ($currentmodal != "0755" && $currentmodal != "0777") {
     $result = @chmod($path, 0755);
 }
 $fp = @fopen('./.htaccess', 'a');
 if (!$fp) {
     diehard("Sorry, we couldn't write to ~/.htaccess");
 } else {
     fwrite($fp, $htaccess);
     fclose($fp);
 }
 #Include the file once we've created it!
 $configfinal = @(include 'core/config.php');
 if (!$configfinal) {
     diehard("Sorry, we couldn't create core/config.php properly.");
 }
 $dbh = new PDO(DB_DRIVER . ':dbname=' . DB_NAME . ';host=' . DB_HOST, DB_USERNAME, DB_PASSWORD);
 #Create the Options table if not exists
 $dbh->exec("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "options` (`id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), `option_key` varchar(256) NOT NULL, UNIQUE KEY (`option_key`), `option_value` varchar(256) NOT NULL)");
 #Set some defaults for the options table
 $options = array('site_title' => $_POST['title'], 'site_url' => $_POST['url'], 'theme' => 'default', 'homepage' => 'home', 'enabled_plugins' => '["Sitemap", "PagesWidget"]', 'colors' => '{"bg":"#EEEEEE","link":"#E64C4C","h1":"#E64C4C","nav":"#F2F2F2","hover":"#D9D9D9","active":"#E64C59"}', 'nav' => '[]');
 #Populate the Options table
 foreach ($options as $key => $value) {
     $dbh->exec("INSERT INTO `" . DB_PREFIX . "options` (option_key, option_value) VALUES ('{$key}', '{$value}')");
 }
 #Create the Pages table if not exists
 $dbh->exec("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "pages` (`page_id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`page_id`), `page_title` varchar(256) NOT NULL, `page_body` text NOT NULL, `page_template` varchar(256) NOT NULL, `rewrite` varchar(256) NOT NULL)");
 $sql = "INSERT INTO `" . DB_PREFIX . "pages` (`page_title`, `page_body`, `page_template`, `rewrite`) VALUES ('Home', 'Welcome to CandyCMS, this page can be changed in the admin dashboard.', 'onecol', 'home');";
 #Populate the Pages table with a default Page
 $dbh->exec($sql);