Przedszkolak
Postów: 98 Pomógł: 11 Ostrzeżeń: 3
Data rejestracji: 13.03.2008 15:16
Złamana licencja
|
Przygotowałem dla was modyfikację dzięki której nie będzie wyświetlała się strona setuser.php w czasie logowania (Zalogowany jak... ble ble ble) UWAGA! Od razu zaznaczam że nie jest specem od bezpieczeństwa itp i w modyfikacji mogą być jakieś błędy, więc proszę administrację o przejrzenie tego kodu i usunięcie ewentualnych błędów :) Z każdym bądź razie modyfikacja działa :) więc tak:
Plik setuser.php nie będzie nam już potrzebny więc możemy go wyrzucić :)
Otwieramy plik maincore.php i w linii ok 218 zmieniamy
if (isset($_POST['login']) && isset($_POST['user_name']) && isset($_POST['user_pass'])) {
$user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_POST['user_name']));
$user_pass = md5($_POST['user_pass']);
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='".$user_name."' AND user_password='".md5($user_pass)."' LIMIT 1");
if (dbrows($result)) {
$data = dbarray($result);
$cookie_value = $data['user_id'].".".$user_pass;
if ($data['user_status'] == 0) {
$cookie_exp = isset($_POST['remember_me']) ? time() + 3600 * 24 * 30 : time() + 3600 * 3;
header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
setcookie(COOKIE_PREFIX."user", $cookie_value, $cookie_exp, "/", "", "0");
redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
} elseif ($data['user_status'] == 1) {
redirect(BASEDIR."setuser.php?error=1", true);
} elseif ($data['user_status'] == 2) {
redirect(BASEDIR."setuser.php?error=2", true);
}
} else {
redirect(BASEDIR."setuser.php?error=3");
}
}
na if (isset($_POST['login']) && isset($_POST['user_name']) && isset($_POST['user_pass'])) {
$user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_POST['user_name']));
$user_pass = md5($_POST['user_pass']);
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='".$user_name."' AND user_password='".md5($user_pass)."' LIMIT 1");
if (dbrows($result)) {
$data = dbarray($result);
$cookie_value = $data['user_id'].".".$user_pass;
if ($data['user_status'] == 0) {
$cookie_exp = isset($_POST['remember_me']) ? time() + 3600 * 24 * 30 : time() + 3600 * 3;
header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
setcookie(COOKIE_PREFIX."user", $cookie_value, $cookie_exp, "/", "", "0");
redirect(BASEDIR."index.php?user=".$data['user_name'], true);
} elseif ($data['user_status'] == 1) {
redirect(BASEDIR."index.php?error=1", true);
} elseif ($data['user_status'] == 2) {
redirect(BASEDIR."index.php?error=2", true);
}
} else {
redirect(BASEDIR."index.php?error=3");
}
}
w linii 298 przed
function redirect($location, $script = false) {
if (!$script) {
header("Location: ".str_replace("&", "&", $location));
exit;
} else {
echo "<script type='text/javascript'>document.location.href='".str_replace("&", "&", $location)."'</script>\n";
exit;
}
}
wklejamy
if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == "yes") {
header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
setcookie(COOKIE_PREFIX."user", "", time() - 7200, "/", "", "0");
setcookie(COOKIE_PREFIX."lastvisit", "", time() - 7200, "/", "", "0");
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_ip='".USER_IP."'");
echo "<strong>".$locale['global_192'].$userdata['user_name']."</strong><br /><br />\n";
if (isset($_COOKIE[COOKIE_PREFIX.'user'])) {
$cookie_vars = explode(".", $_COOKIE[COOKIE_PREFIX.'user']);
$user_pass = preg_check("/^[0-9a-z]{32}$/", $cookie_vars['1']) ? $cookie_vars['1'] : "";
$user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_GET['user']));
if (!dbcount("(user_id)", DB_USERS, "user_name='".$user_name."' AND user_password='".md5($user_pass)."'")) {
} else {
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_user='0' AND online_ip='".USER_IP."'");
}
}
redirect("index.php");
}
Otwieramy plik infusions/user_info_panel/user_info_panel.php i w linii 29 zmieniamy
echo THEME_BULLET." <a href='".BASEDIR."setuser.php?logout=yes' class='side'>".$locale['global_124']."</a>\n";
na echo THEME_BULLET." <a href='".BASEDIR."index.php?logout=yes' class='side'>".$locale['global_124']."</a>\n";
Jeśli coś nie działa to pisać :)
Edytowane przez jack1920 dnia 30.03.2009 20:35:49
|
Początkujący
Postów: 105 Ostrzeżeń: 2
v7.02.07 Data rejestracji: 05.12.2008 17:27
|
Czy ktoś może odkopać ten temat, ponieważ nie wiem czemu ale nie mam czegoś takiego w pliku maincore.php:
if (isset($_POST['login']) && isset($_POST['user_name']) && isset($_POST['user_pass'])) {
$user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_POST['user_name']));
$user_pass = md5($_POST['user_pass']);
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='".$user_name."' AND user_password='".md5($user_pass)."' LIMIT 1");
if (dbrows($result)) {
$data = dbarray($result);
$cookie_value = $data['user_id'].".".$user_pass;
if ($data['user_status'] == 0) {
$cookie_exp = isset($_POST['remember_me']) ? time() + 3600 * 24 * 30 : time() + 3600 * 3;
header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
setcookie(COOKIE_PREFIX."user", $cookie_value, $cookie_exp, "/", "", "0");
redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
} elseif ($data['user_status'] == 1) {
redirect(BASEDIR."setuser.php?error=1", true);
} elseif ($data['user_status'] == 2) {
redirect(BASEDIR."setuser.php?error=2", true);
}
} else {
redirect(BASEDIR."setuser.php?error=3");
}
}
Kliknij i zaczekaj na załadowanie kodu ...
Liczę że ktoś pomoże bo denerwuje mnie ten setuser.
Pozdrawiam.
Wiadomość doklejona:
Proszę pomóżcie :P
Edytowane przez adams1692 dnia 20.03.2011 21:40:11
|
Przedszkolak
Postów: 78 Pomógł: 7 Ostrzeżeń: 1
Data rejestracji: 11.08.2009 14:36
|
Faktycznie, nie ma tego. Też chciałem to sobie zrobić a tu niespodzianka...Pewnie masz poprawioną wersję PF7. Krok pierwszy, czyli z tym co sobie nie możesz poradzić:
Wchodzisz do folderu includes, szukasz pliku cookie_include.php. Zmieniasz to:
if (isset($_POST['login']) && isset($_POST['user_name']) && isset($_POST['user_pass'])) {
$user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_POST['user_name']));
$user_pass = md5($_POST['user_pass']);
$result = dbquery("SELECT user_id, user_name, user_status, user_actiontime FROM ".DB_USERS." WHERE user_name='".$user_name."' AND user_password='".md5($user_pass)."' LIMIT 1");
if (dbrows($result)) {
$data = dbarray($result);
$cookie_value = $data['user_id'].".".$user_pass;
if ($data['user_status'] == 0 && $data['user_actiontime'] == 0) {
$cookie_exp = isset($_POST['remember_me']) ? time() + 3600 * 24 * 30 : time() + 3600 * 3;
header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
setcookie(COOKIE_PREFIX."user", $cookie_value, $cookie_exp, "/", "", "0");
redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
} elseif ($data['user_status'] == 1) {
redirect(BASEDIR."setuser.php?error=1&id=".$data['user_id'], true);
} elseif ($data['user_status'] == 2) {
redirect(BASEDIR."setuser.php?error=2", true);
} elseif ($data['user_status'] == 3) {
if ($data['user_actiontime'] < time()) {
require_once INCLUDES."suspend_include.php";
require_once INCLUDES."sendmail_include.php";
$_SESSION[COOKIE_PREFIX.'user_id'] = $data['user_id'];
$_SESSION[COOKIE_PREFIX.'user_pass'] = $user_pass;
$result = dbquery("UPDATE ".DB_USERS." SET user_status='0', user_actiontime='0' WHERE user_id='".$data['user_id']."'");
unsuspend_log($data['user_id'], 3, $locale['global_450'], true);
// Send mail
$subject = $locale['global_453'];
$message = str_replace("USER_NAME", $data['user_name'], $locale['global_452']);
sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
// Send mail
redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
} else {
redirect(BASEDIR."setuser.php?error=3&id=".$data['user_id'], true);
}
} elseif ($data['user_status'] == 4) {
redirect(BASEDIR."setuser.php?error=4&id=".$data['user_id'], true);
} elseif ($data['user_status'] == 5) {
redirect(BASEDIR."setuser.php?error=5", true);
} elseif ($data['user_status'] == 6) {
redirect(BASEDIR."setuser.php?error=6", true);
} elseif ($data['user_status'] == 7) {
require_once INCLUDES."sendmail_include.php";
$_SESSION[COOKIE_PREFIX.'user_id'] = $data['user_id'];
$_SESSION[COOKIE_PREFIX.'user_pass'] = $user_pass;
$result = dbquery("UPDATE ".DB_USERS." SET user_status='0', user_actiontime='0' WHERE user_id='".$data['user_id']."'");
// Send mail
$subject = $locale['global_454'];
$message = str_replace("USER_NAME", $data['user_name'], $locale['global_455']);
sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
// Send mail
redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
}
} else {
redirect(BASEDIR."setuser.php?error=8");
}
}
Kliknij i zaczekaj na załadowanie kodu ...
Na to:
if (isset($_POST['login']) && isset($_POST['user_name']) && isset($_POST['user_pass'])) {
$user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_POST['user_name']));
$user_pass = md5($_POST['user_pass']);
$result = dbquery("SELECT user_id, user_name, user_status, user_actiontime FROM ".DB_USERS." WHERE user_name='".$user_name."' AND user_password='".md5($user_pass)."' LIMIT 1");
if (dbrows($result)) {
$data = dbarray($result);
$cookie_value = $data['user_id'].".".$user_pass;
if ($data['user_status'] == 0 && $data['user_actiontime'] == 0) {
$cookie_exp = isset($_POST['remember_me']) ? time() + 3600 * 24 * 30 : time() + 3600 * 3;
header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
setcookie(COOKIE_PREFIX."user", $cookie_value, $cookie_exp, "/", "", "0");
redirect(BASEDIR."index.php?user=".$data['user_name'], true);
} elseif ($data['user_status'] == 1) {
redirect(BASEDIR."index.php?error=1&id=".$data['user_id'], true);
} elseif ($data['user_status'] == 2) {
redirect(BASEDIR."index.php?error=2", true);
} elseif ($data['user_status'] == 3) {
if ($data['user_actiontime'] < time()) {
require_once INCLUDES."suspend_include.php";
require_once INCLUDES."sendmail_include.php";
$_SESSION[COOKIE_PREFIX.'user_id'] = $data['user_id'];
$_SESSION[COOKIE_PREFIX.'user_pass'] = $user_pass;
$result = dbquery("UPDATE ".DB_USERS." SET user_status='0', user_actiontime='0' WHERE user_id='".$data['user_id']."'");
unsuspend_log($data['user_id'], 3, $locale['global_450'], true);
// Send mail
$subject = $locale['global_453'];
$message = str_replace("USER_NAME", $data['user_name'], $locale['global_452']);
sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
// Send mail
redirect(BASEDIR."index.php?user=".$data['user_name'], true);
} else {
redirect(BASEDIR."index.php?error=3&id=".$data['user_id'], true);
}
} elseif ($data['user_status'] == 4) {
redirect(BASEDIR."index.php?error=4&id=".$data['user_id'], true);
} elseif ($data['user_status'] == 5) {
redirect(BASEDIR."index.php?error=5", true);
} elseif ($data['user_status'] == 6) {
redirect(BASEDIR."index.php?error=6", true);
} elseif ($data['user_status'] == 7) {
require_once INCLUDES."sendmail_include.php";
$_SESSION[COOKIE_PREFIX.'user_id'] = $data['user_id'];
$_SESSION[COOKIE_PREFIX.'user_pass'] = $user_pass;
$result = dbquery("UPDATE ".DB_USERS." SET user_status='0', user_actiontime='0' WHERE user_id='".$data['user_id']."'");
// Send mail
$subject = $locale['global_454'];
$message = str_replace("USER_NAME", $data['user_name'], $locale['global_455']);
sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
// Send mail
redirect(BASEDIR."index.php?user=".$data['user_name'], true);
}
} else {
redirect(BASEDIR."index.php?error=8");
}
}
Kliknij i zaczekaj na załadowanie kodu ...
Krok 2 (podmiana w lini 298 w maincore.php) i krok 3 (zmiana w user_info_panel.php) zrób zgodnie z instrukcją od jack1920.
Ma działać:)
Edytowane przez karoldinho dnia 09.04.2011 19:54:19
|