![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 2 Pomógł: 0 Dołączył: 1.10.2009 Ostrzeżenie: (0%) ![]() ![]() |
Witam serdecznie forumowiczów.
Mam problem z skryptem php. mam własną strone na której mam userów. I tak sie sklada że chciałbym usunąć choćby jednego znich. I oczywiście wyskakuje mi okienko czy jestm pewnien. Naciskam Tak. No i tutaj zaczynają sie problemy. skrypt zamiast odsierzyć strone i pokazać jednego usera mniej to pokazuje mi taki tekst: **** Error: E_NOTICE URL: http://mysite.com/admin/users_results.php?delete=3 File: =O x=O Đ=O $>O x>O Line: 251 Message: Undefined variable: g **** Oczywiście mail z wiadomoscia o usunietym konice dochodzi do usera, lecz jak ja powracam do strony s userami , to on dalej tam widnieje. Nie wiem, czy to wina skryptu php czy moze bazy danych? pozwoliłem sobie umieścić tekst php poniżej by może któryś z was znalazł by jakis błąd. podkreslam ze jestem zielony w php. Zaczynam dopiero pierwsze kroki. Oto ten skrypt: CODE <?php include("../_include/core/admin_start.php"); class CUsers extends CHtmlList { function action() { global $g; $del = get_param("delete", 0); if ($del != 0) { DB::query("SELECT * FROM user WHERE user_id=" . to_sql($del, "Number") . ""); $row = DB::fetch_row(); $subject = DB::result("SELECT subject FROM email_auto WHERE note='admin_delete'"); $text = DB::result("SELECT text FROM email_auto WHERE note='admin_delete'"); $subject = str_replace("{title}", $g['main']['title'], $subject); $text = str_replace("{title}", $g['main']['title'], $text); $text = str_replace("{name}", $row['name'], $text); $text = str_replace("{password}", $row['password'], $text); send_mail( $row['mail'], $g['main']['info_mail'], $subject, $text ); delete_user($del); redirect(); } } function init() { global $g; $this->m_on_page = 20; $this->m_on_bar = 10; $this->m_sql_count = "SELECT COUNT(u.user_id) FROM user AS u " . $this->m_sql_from_add . ""; $this->m_sql = " SELECT u.user_id, u.mail, u.type, u.orientation, u.password, u.gold_days, u.name, (YEAR('" . date('Y-m-d H:i:s') . "')-YEAR(birth)) - (RIGHT('" . date('Y-m-d H:i:s') . "',5)<RIGHT(birth,5)) AS age, u.last_visit, u.is_photo, u.city_id, u.state_id, u.country_id FROM user AS u " . $this->m_sql_from_add . " "; $this->m_field['user_id'] = array("user_id", null); $this->m_field['name'] = array("name", null); $this->m_field['age'] = array("age", null); $this->m_field['last_visit'] = array("last_visit", null); $this->m_field['city_title'] = array("city", null); $this->m_field['state_title'] = array("state", null); $this->m_field['country_title'] = array("country", null); $this->m_field['mail'] = array("mail", null); $this->m_field['type'] = array("type", null); $this->m_field['gold_days'] = array("gold_days", null); $this->m_field['password'] = array("password", null); $this->m_field['orientation'] = array("orientation", null); $where = ""; #$this->m_debug = "Y"; $user["p_orientation"] = (int) get_checks_param("p_orientation"); if ($user["p_orientation"] != "0") { $where .= " AND " . $user["p_orientation"] . " & (1 << (orientation - 1))"; } $user["p_relation"] = (int) get_checks_param("p_relation"); if ($user["p_relation"] != "0") { $where .= " AND " . $user["p_relation"] . " & (1 << (relation - 1))"; } $user['name'] = get_param("name", ""); if ($user['name'] != "") { $where .= " AND name LIKE '%" . to_sql($user['name'], "Plain") . "%'"; } $user['mail'] = get_param("mail", ""); if ($user['mail'] != "") { $where .= " AND mail LIKE '%" . to_sql($user['mail'], "Plain") . "%'"; } if (get_param("gold", "") == "1") { $where .= " AND gold_days>0"; } if (get_param("gold", "") == "0") { $where .= " AND gold_days=0"; } $r_from = get_param("r_from", "0000-00-00"); $r_to = get_param("r_to", "0000-00-00"); if ($r_from != "0000-00-00" or $r_to != "0000-00-00") { #$from = explode("-", $r_from); #$to = explode("-", $r_to); #$r_from = mktime(0, 0, 0, $from[1], $from[2], $from[0] == "0000" ? "2000" : $from[0]); #$r_to = mktime(0, 0, 0, $to[1], $to[2], $to[0] == "0000" ? "2000" : $to[0]); #if ($r_from < $r_to) { $where .= " AND register>" . to_sql($r_from) . " AND register<" . to_sql($r_to) . ""; } } $user['p_age_from'] = (int) get_param("p_age_from", 0); $user['p_age_to'] = (int) get_param("p_age_to", 0); if ($user['p_age_from'] != 0) { $where .= " AND (floor((TO_DAYS('" . date('Y-m-d H:i:s') . "')-TO_DAYS(birth))/365)>=" . $user['p_age_from'] . " AND floor((TO_DAYS('" . date('Y-m-d H:i:s') . "')-TO_DAYS(birth))/365)<=" . $user['p_age_to'] . ") "; } $user['country'] = (int) get_param("country", 0); if ($user['country'] != 0 and $user['country'] != "") { $where .= " AND u.country_id=" . $user['country'] . ""; } $user['state'] = (int) get_param("state", 0); if ($user['state'] != 0 and $user['state'] != "") { $where .= " AND u.state_id=" . $user['state'] . ""; } $user['city'] = (int) get_param("city", 0); if ($user['city'] != 0 and $user['city'] != "") { $where .= " AND u.city_id=" . $user['city'] . ""; } if (get_param("photo", "") == "1") { $where .= " AND u.is_photo='Y'"; } if (get_param("status", "") == "online") { $where .= " AND last_visit>" . (time() - $g['options']['online_time'] * 60) . ""; } elseif (get_param("status", "") == "new") { $where .= " AND register>" . (time() - $g['options']['new_days'] * 3600 * 24) . ""; } elseif (get_param("status", "") == "birthday") { $where .= " AND (DAYOFMONTH(birth)=DAYOFMONTH('" . date('Y-m-d H:i:s') . "') AND MONTH(birth)=MONTH('" . date('Y-m-d H:i:s') . "'))"; } $keyword = get_param("keyword", ""); if ($keyword != "") { $keyword = to_sql($keyword, "Plain"); $where .= " AND (name LIKE '%" . $keyword . "%') "; } $this->m_sql_where = "1" . $where; $this->m_sql_order = "user_id"; $this->m_sql_from_add = ""; } function parseBlock(&$html) { parent::parseBlock($html); } function onItem(&$html, $row, $i, $last) { global $g; $this->m_field['city_title'][1] = DB::result("SELECT city_title FROM geo_city WHERE city_id=" . $row['city_id'] . "", 0, 2); if ($this->m_field['city_title'][1] == "") $this->m_field['city_title'][1] = "blank"; $this->m_field['state_title'][1] = DB::result("SELECT state_title FROM geo_state WHERE state_id=" . $row['state_id'] . "", 0, 2); if ($this->m_field['state_title'][1] == "") $this->m_field['state_title'][1] = "blank"; $this->m_field['country_title'][1] = DB::result("SELECT country_title FROM geo_country WHERE country_id=" . $row['country_id'] . "", 0, 2); if ($this->m_field['country_title'][1] == "") $this->m_field['country_title'][1] = "blank"; if (((time() - $row['last_visit']) / 60) < $g['options']['online_time']) { $this->m_field['last_visit'][1] = "Online Now!"; } $this->m_field['orientation'][1] = DB::result("SELECT title FROM const_orientation WHERE id=" . $row['orientation'] . "", 0, 2); if ($this->m_field['orientation'][1] == "") { $this->m_field['orientation'][1] = "Invilid orientation"; } if (strstr($_SERVER['HTTP_HOST'], "abk") and !strstr($_SERVER['PHP_SELF'], "dev")) { $this->m_field['mail'][1] = 'disabled@ondemoadmin.cp'; $this->m_field['password'][1] = 'not shown in the demo'; } parent::onItem($html, $row, $i, $last); } } $page = new CUsers("main", $g['tmpl']['dir_tmpl_admin'] . "users_results.html"); $header = new CAdminHeader("header", $g['tmpl']['dir_tmpl_admin'] . "_header.html"); $page->add($header); $footer = new CAdminFooter("footer", $g['tmpl']['dir_tmpl_admin'] . "_footer.html"); $page->add($footer); include("../_include/core/admin_close.php"); ?> Z góry dziękuję za pomoc. Ten post edytował benq 2.10.2009, 10:06:18 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 21.08.2025 - 03:08 |