public function backup() { $data['title'] = '数据库备份'; $data['table_list'] = $this->db->list_tables(); $data['act'] = $this->uri->segment(3); if ($_POST) { $tables = $this->input->post(); for ($i = 0; $i <= 12; $i++) { $new_tables[] = $tables[$i]; } //echo var_export($new_tables); $prefs = array('tables' => $new_tables, 'ignore' => array(), 'format' => 'txt', 'filename' => 'mybackup.sql', 'add_drop' => TRUE, 'add_insert' => TRUE, 'newline' => "\n"); $this->load->dbutil(); $backup = $this->dbutil->backup($prefs); //$file='mysql'.time().'.sql'; $lenth = rand(10, 20); $file = randkey($lenth) . '.sql'; if (write_file(FCPATH . 'data/db/' . $file, $backup)) { $this->session->set_flashdata('error', '备份数据库' . $file . '成功!'); redirect('admin/db_admin/backup'); } } $data['csrf_name'] = $this->security->get_csrf_token_name(); $data['csrf_token'] = $this->security->get_csrf_hash(); $this->load->view('db_admin', $data); }
if (!isset($_POST['d']) || $_POST['d'] == "") { $error[] = "Please enter a Dogecoin address."; } if (!Dogecoin::checkAddress($_POST['d'])) { $error[] = "The entered Dogecoin address is not valid."; } if ($s->query("select address from users where address='" . $s->real_escape_string($_POST['d']) . "'")->num_rows != 0) { $error[] = "Someone has already registered with that Dogecoin address."; } // -- checked ALL the things! -- if ($error == array()) { // no errors, let's go! $p = new PasswordHash(8, false); $id = randkey(); while ($s->query("select key from users where key='" . $s->real_escape_string($id) . "'")->num_rows != 0) { $id = randkey(); } $s->query("insert into users (username,password,email,address,webkey,verified) values ('" . $s->real_escape_string($_POST['u']) . "','" . $s->real_escape_string($p->HashPassword($_POST['p'])) . "','" . $s->real_escape_string($_POST['e']) . "','" . $s->real_escape_string($_POST['d']) . "','" . $s->real_escape_string($id) . "',0)"); $vu = "http://" . $_SERVER['HTTP_HOST'] . "/?a=v&v=" . urlencode($s->insert_id . "|" . sha1('dogec0inisthebestwaterbowlever!' . $_POST['u'] . $_POST['e'] . $_POST['d'])); doMail($_POST['u'] . " <" . $_POST['e'] . ">", "[dogec0in] Account Verification", $_POST['u'] . ",\n\nYou have (or someone using your email address has) just registered at dogec0in.\nTo verify your registration and start earning free Dogecoins by chatting, visit this link: " . $vu . "\nIf you did not intend to receive this email, just ignore it and nothing will happen.\nEnjoy dogec0in!"); $error[] = "You have received an account verification email. Please check your emails at " . $_POST['e'] . ". Remember to also check your spam folder!"; } else { $_POST['a'] = ''; $_GET['a'] = 'r'; } } elseif ($_REQUEST['a'] == 'f') { if (isset($_GET['v']) && $_GET['v'] != "") { session_start(); if (array_key_exists("v", $_SESSION) && $_SESSION['v'] != "") { $s = new mysqli($sql[0], $sql[1], $sql[2], $sql[3]); $hasdb = true;