Przymusowe podanie miejscowości przy rejestracji
|
kibel |
Dodany dnia 24.12.2010 13:45:56
|
Początkujący
Postów: 157 Pomógł: 8 Ostrzeżeń: 2
Data rejestracji: 01.02.2010 18:02
ZBANOWANY: Dożywotnio
|
@kefirek twoja edycja register.php nie działa poprawnie bo jak nowy user się rejestruje to tak admin nie widzi skąd on jest.
Kliknij jeśli pomogłem.
Bo życie uczy nas myślenia.
|
|
|
|
Wścibski Gość |
Dodany dnia 24.11.2024 20:32:18
|
Pan Kontekstualny
Postów: n^x
Data rejestracji: Zawsze
|
|
IP: localhost |
|
|
xtremes |
Dodany dnia 03.03.2011 12:25:55
|
Przedszkolak
Postów: 27 Pomógł: 6 Ostrzeżeń: 1
Data rejestracji: 28.09.2007 22:45
|
Witam.
Zmodyfikowałem plik register według w/w instrukcji podanej, przez kefirka, wszystko poprawnie działa, jeżeli nie korzystam z weryfikacji e-mail. Po włączeniu weryfikacji i rejestracji nowego użytkownika, pola w bazie nie są zapisywane, czym może to być spowodowane?
|
|
|
|
jantom |
Dodany dnia 03.03.2011 14:19:25
|
Weteran
Postów: 3460 Pomógł: 123
Data rejestracji: 31.03.2005 20:10
|
Brakiem zapisania danych w bazie. Musisz uzupełnić plik register.php o 3-4 linijki, o ile dobrze pamiętam. Teraz tego na 100% nie podam.
Edytowane przez jantom dnia 03.03.2011 14:19:57
|
|
|
|
xtremes |
Dodany dnia 03.03.2011 17:31:21
|
Przedszkolak
Postów: 27 Pomógł: 6 Ostrzeżeń: 1
Data rejestracji: 28.09.2007 22:45
|
Dodałem do pliku register takie oto zapytanie do bazy, po którym dane są zapisywane, w polach innych użytkowników, a nie w polu nowego użytkownika. Wiem, że potrzebny jest jakiś warunek, ale nie za bardzo wiem jak to zrobić.
$result = dbquery("UPDATE ".DB_USERS." SET user_miejscowosc='$miejscowosc', user_kod='$kod' ");
Edytowane przez xtremes dnia 05.03.2011 19:28:58
|
|
|
|
AntaresXL |
Dodany dnia 07.03.2011 22:27:35
|
Przedszkolak
Postów: 7
Data rejestracji: 07.03.2011 22:09
|
Witam.
U mnie jest tak samo, po włączeniu weryfikacji nie działa. Może ktoś wie jak rozwiązać ten problem. Niżej kod z register.php
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: register.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."register.php";
include LOCALE.LOCALESET."user_fields.php";
if (iMEMBER || !$settings['enable_registration']) { redirect("index.php"); }
if (isset($_GET['activate'])) {
if (!preg_check("/^[0-9a-z]{32}$/", $_GET['activate'])) { redirect("index.php"); }
$result = dbquery("SELECT user_info FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
if (dbrows($result)) {
$data = dbarray($result);
$user_info = unserialize($data['user_info']);
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM ".DB_USER_FIELDS." tuf
INNER JOIN ".DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.") VALUES('".$user_info['user_name']."', '".$user_info['user_password']."', '', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.")");
$result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
add_to_title($locale['global_200'].$locale['401']);
opentable($locale['401']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
} else {
redirect("index.php");
}
} elseif (isset($_POST['register'])) {
if ($settings['display_validation'] == "1") {
include_once INCLUDES."securimage/securimage.php";
}
$error = ""; $db_fields = ""; $db_values = "";
$username = stripinput(trim(preg_replace("/ +/i", " ", $_POST['username'])));
$email = stripinput(trim(preg_replace("/ +/i", "", $_POST['email'])));
$password1 = stripinput(trim(preg_replace("/ +/i", "", $_POST['password1'])));
$miejscowosc = stripinput(trim($_POST['miejscowosc']));
$wiek = stripinput(trim($_POST['wiek']));
if ($username == "" || $password1 == "" || $email == "") {
$error .= $locale['402']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) {
$error .= $locale['403']."<br />\n";
}
if (preg_match("/^[0-9A-Z@]{6,20}$/i", $password1)) {
if ($password1 != $_POST['password2']) $error .= $locale['404']."<br />\n";
} else {
$error .= $locale['405']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
$error .= $locale['406']."<br />\n";
}
$email_domain = substr(strrchr($email, "@"), 1);
if (dbcount("(blacklist_id)", DB_BLACKLIST, "blacklist_email='$email' OR blacklist_email='$email_domain'") != 0) { $error = $locale['411']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_name='$username'") != 0) { $error = $locale['407']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_email='$email'") != 0) { $error = $locale['408']."<br />\n";}
if ($settings['email_verification'] == "1") {
$result = dbquery("SELECT user_email, user_info FROM ".DB_NEW_USERS);
while ($new_users = dbarray($result)) {
$user_info = unserialize($new_users['user_info']);
if ($new_users['user_email'] == $email) { $error = $locale['409']."<br />\n"; }
if ($user_info['user_name'] == $username) { $error = $locale['407']."<br />\n"; break; }
}
}
if ($settings['display_validation'] == "1") {
$securimage = new Securimage();
if (!isset($_POST['captcha_code']) || $securimage->check($_POST['captcha_code']) == false) {
$error .= $locale['410']."<br />\n";
}
}
$user_hide_email = isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1";
if ($settings['email_verification'] == "0") {
$user_offset = isset($_POST['user_offset']) ? is_numeric($_POST['user_offset']) ? $_POST['user_offset'] : "0" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM ".DB_USER_FIELDS." tuf
INNER JOIN ".DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
}
if ($error == "") {
if ($settings['email_verification'] == "1") {
require_once INCLUDES."sendmail_include.php";
mt_srand((double)microtime()*1000000); $salt = "";
for ($i = 0; $i <= 7; $i++) { $salt .= chr(rand(97, 122)); }
$user_code = md5($email.$salt);
$activation_url = $settings['siteurl']."register.php?activate=".$user_code;
if (sendemail($username,$email,$settings['siteusername'], $settings['siteemail'], $locale['449'], $locale['450'].$activation_url)) {
$user_info = serialize(array(
"user_name" => $username,
"user_password" => md5(md5($password1)),
"user_email" => $email,
"user_hide_email" => isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1"
,"miejscowosc" => $miejscowosc
,"wiek" => $wiek
));
$result = dbquery("INSERT INTO ".DB_NEW_USERS." (user_code, user_email, user_datestamp, user_info) VALUES('$user_code', '".$email."', '".time()."', '$user_info')");
opentable($locale['400']);
echo "<div style='text-align:center'><br />\n".$locale['454']."<br /><br />\n</div>\n";
closetable();
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['457']."<br /><br />\n</div>\n";
closetable();
}
} else {
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.",user_miejscowosc ,user_wiek) VALUES('$username', '".md5(md5($password1))."', '', '".$email."', '$user_hide_email', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.", '$miejscowosc' , '$wiek')");
opentable($locale['400']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
}
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['458']."<br /><br />\n$error<br />\n<a href='".FUSION_SELF."'>".$locale['459']."</a></div><br />\n";
closetable();
}
} else {
if ($settings['email_verification'] == "0") {
$offset_list = "";
for ($i = -13; $i < 17; $i++) {
if ($i > 0) { $offset = "+".$i; } else { $offset = $i; }
$offset_list .= "<option".($offset == "0" ? " selected='selected'" : "").">".$offset."</option>\n";
}
}
opentable($locale['400']);
echo "<div style='text-align:center'>".$locale['500']."\n";
if ($settings['email_verification'] == "1") echo $locale['501']."\n";
echo $locale['502'];
if ($settings['email_verification'] == "1") echo "\n".$locale['503'];
echo "</div><br />\n";
echo "<form name='inputform' method='post' action='".FUSION_SELF."' onsubmit='return ValidateForm(this)'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Miejscowo¶ć<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='miejscowosc' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Wiek<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='wiek' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u006']."</td>\n";
echo "<td class='tbl'><label><input type='radio' name='user_hide_email' value='1' checked='checked' />".$locale['u007']."</label>\n";
echo "<label><input type='radio' name='user_hide_email' value='0' />".$locale['u008']."</label></td>\n";
echo "</tr>\n";
if ($settings['display_validation'] == "1") {
echo "<tr>\n<td valign='top' class='tbl'>".$locale['504']."</td>\n<td class='tbl'>";
echo "<img id='captcha' src='".INCLUDES."securimage/securimage_show.php' alt='".$locale['504']."' align='left' />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' align='top' class='tbl-border' style='margin-bottom:1px' /></a><br />\n";
echo "<a href='#' onclick=\"document.getElementById('captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' align='bottom' class='tbl-border' /></a>\n";
echo "</td>\n</tr>\n<tr>";
echo "<td class='tbl'>".$locale['505']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='captcha_code' class='textbox' style='width:100px' /></td>\n";
echo "</tr>\n";
}
if ($settings['enable_terms'] == 1) {
echo "<tr>\n<td class='tbl'>".$locale['508'] ."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='checkbox' id='agreement' name='agreement' value='1' onclick='checkagreement()' /> <span class='small'><label for='agreement'>".$locale['509'] ."</label></span></td>\n";
echo "</tr>\n";
}
echo "<tr>\n<td align='center' colspan='2'><br />\n";
echo "<input type='submit' name='register' value='".$locale['506']."' class='button'".($settings['enable_terms'] == 1 ? " disabled='disabled'" : "")." />\n";
echo "</td>\n</tr>\n</table>\n</form>\n";
closetable();
echo "<script type='text/javascript'>
function ValidateForm(frm) {
if (frm.username.value==\"\") {
alert(\"".$locale['550']."\");
return false;
}
if (frm.password1.value==\"\") {
alert(\"".$locale['551']."\");
return false;
}
if (frm.email.value==\"\") {
alert(\"".$locale['552']."\");
return false;
}
if (frm.miejscowosc.value==\"\") {
alert(\"Proszę podać Miejscowo¶ć\");
return false;
}
if (frm.wiek.value==\"\") {
alert(\"Proszę podać Wiek\");
return false;
}
}
</script>\n";
if ($settings['enable_terms'] == 1) {
echo "<script language='JavaScript' type='text/javascript'>
function checkagreement() {
if(document.inputform.agreement.checked) {
document.inputform.register.disabled=false;
} else {
document.inputform.register.disabled=true;
}
}
</script>";
}
}
require_once THEMES."templates/footer.php";
?>
Edytowane przez AntaresXL dnia 07.03.2011 22:28:23
|
|
|
|
Chemikpil |
Dodany dnia 09.03.2011 07:59:09
|
Bywalec
Postów: 999 Pomógł: 54
Data rejestracji: 04.05.2008 21:46
|
A mówi wam coś klauzula WHERE?
|
|
|
|
xtremes |
Dodany dnia 09.03.2011 09:09:32
|
Przedszkolak
Postów: 27 Pomógł: 6 Ostrzeżeń: 1
Data rejestracji: 28.09.2007 22:45
|
Witam.
Chemikpil a mógłbyś podpowiedzieć gdzie dodać ten warunek, żeby dane zostały przypisane nowemu użytkownikowi, który się zarejestrował. Bo mi zapisuje wszystkim no i każdy ma taką samą miejscowość i taki sam kod.
|
|
|
|
Gismo_PL |
Dodany dnia 09.03.2011 09:32:01
|
Bywalec
Postów: 462 Pomógł: 40 Ostrzeżeń: 2
v7.01.05 Data rejestracji: 25.02.2007 21:13
|
A może warto sobie zajrzeć do kodów w pliku i co nieco poczytać o składni języka sql kolego @xtremes a nie ciągle żerować na gotowcach :(.
Póki co porównaj sobie obydwa kody, czyli Twój podany wyżej i podany przeze mnie:
$result = dbquery("UPDATE ".DB_USERS." SET user_miejscowosc='$miejscowosc', user_kod='$kod' WHERE user_id='$userdata['user_id']' ");
|
|
|
|
AntaresXL |
Dodany dnia 09.03.2011 14:38:49
|
Przedszkolak
Postów: 7
Data rejestracji: 07.03.2011 22:09
|
Dodałem tak jak wyżej napisałeś @Gismo_pl, rejestracja przebiega prawidłowo, żadnych błędów, e-mail weryfikacyjny jest wysyłany, ale dane nie są zapisywane w bazie. Tak jak @xtremes podał te zapytanie to zapisywało wszystkim userom.
Pozdrawiam.
Edytowane przez krystian1988 dnia 09.03.2011 15:00:25
|
|
|
|
Gismo_PL |
Dodany dnia 09.03.2011 15:06:35
|
Bywalec
Postów: 462 Pomógł: 40 Ostrzeżeń: 2
v7.01.05 Data rejestracji: 25.02.2007 21:13
|
Podaj cały zmodyfikowany do tej pory kod, bo mam obiekcje co do tego czy aby na pewno powinna być użyta klauzula UPDATE a nie INSERT .
|
|
|
|
AntaresXL |
Dodany dnia 09.03.2011 15:25:41
|
Przedszkolak
Postów: 7
Data rejestracji: 07.03.2011 22:09
|
Proszę cały register.php:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: register.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."register.php";
include LOCALE.LOCALESET."user_fields.php";
if (iMEMBER || !$settings['enable_registration']) { redirect("index.php"); }
if (isset($_GET['activate'])) {
if (!preg_check("/^[0-9a-z]{32}$/", $_GET['activate'])) { redirect("index.php"); }
$result = dbquery("SELECT user_info FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
if (dbrows($result)) {
$data = dbarray($result);
$user_info = unserialize($data['user_info']);
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM ".DB_USER_FIELDS." tuf
INNER JOIN ".DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.") VALUES('".$user_info['user_name']."', '".$user_info['user_password']."', '', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.")");
$result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
add_to_title($locale['global_200'].$locale['401']);
opentable($locale['401']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
} else {
redirect("index.php");
}
} elseif (isset($_POST['register'])) {
if ($settings['display_validation'] == "1") {
include_once INCLUDES."securimage/securimage.php";
}
$error = ""; $db_fields = ""; $db_values = "";
$username = stripinput(trim(preg_replace("/ +/i", " ", $_POST['username'])));
$email = stripinput(trim(preg_replace("/ +/i", "", $_POST['email'])));
$password1 = stripinput(trim(preg_replace("/ +/i", "", $_POST['password1'])));
$miejscowosc = stripinput(trim($_POST['miejscowosc']));
$kod = stripinput(trim($_POST['kod']));
if ($username == "" || $password1 == "" || $email == "") {
$error .= $locale['402']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) {
$error .= $locale['403']."<br />\n";
}
if (preg_match("/^[0-9A-Z@]{6,20}$/i", $password1)) {
if ($password1 != $_POST['password2']) $error .= $locale['404']."<br />\n";
} else {
$error .= $locale['405']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
$error .= $locale['406']."<br />\n";
}
$email_domain = substr(strrchr($email, "@"), 1);
if (dbcount("(blacklist_id)", DB_BLACKLIST, "blacklist_email='$email' OR blacklist_email='$email_domain'") != 0) { $error = $locale['411']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_name='$username'") != 0) { $error = $locale['407']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_email='$email'") != 0) { $error = $locale['408']."<br />\n";}
if ($settings['email_verification'] == "1") {
$result = dbquery("SELECT user_email, user_info FROM ".DB_NEW_USERS);
while ($new_users = dbarray($result)) {
$user_info = unserialize($new_users['user_info']);
if ($new_users['user_email'] == $email) { $error = $locale['409']."<br />\n"; }
if ($user_info['user_name'] == $username) { $error = $locale['407']."<br />\n"; break; }
}
}
if ($settings['display_validation'] == "1") {
$securimage = new Securimage();
if (!isset($_POST['captcha_code']) || $securimage->check($_POST['captcha_code']) == false) {
$error .= $locale['410']."<br />\n";
}
}
$user_hide_email = isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1";
if ($settings['email_verification'] == "0") {
$user_offset = isset($_POST['user_offset']) ? is_numeric($_POST['user_offset']) ? $_POST['user_offset'] : "0" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM ".DB_USER_FIELDS." tuf
INNER JOIN ".DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
}
if ($error == "") {
if ($settings['email_verification'] == "1") {
require_once INCLUDES."sendmail_include.php";
mt_srand((double)microtime()*1000000); $salt = "";
for ($i = 0; $i <= 7; $i++) { $salt .= chr(rand(97, 122)); }
$user_code = md5($email.$salt);
$activation_url = $settings['siteurl']."register.php?activate=".$user_code;
if (sendemail($username,$email,$settings['siteusername'], $settings['siteemail'], $locale['449'], $locale['450'].$activation_url)) {
$user_info = serialize(array(
"user_name" => $username,
"user_password" => md5(md5($password1)),
"user_email" => $email,
"user_hide_email" => isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1"
,"miejscowosc" => $miejscowosc
,"kod" => $kod
));
$result = dbquery("INSERT INTO ".DB_NEW_USERS." (user_code, user_email, user_datestamp, user_info) VALUES('$user_code', '".$email."', '".time()."', '$user_info')");
opentable($locale['400']);
echo "<div style='text-align:center'><br />\n".$locale['454']."<br /><br />\n</div>\n";
closetable();
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['457']."<br /><br />\n</div>\n";
closetable();
}
} else {
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.",user_miejscowosc ,user_kod) VALUES('$username', '".md5(md5($password1))."', '', '".$email."', '$user_hide_email', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.", '$miejscowosc' , '$kod' )");
$result = dbquery("UPDATE ".DB_USERS." SET user_miejscowosc='$miejscowosc', user_kod='$kod' WHERE user_id='".$user_data['user_id']."'");
opentable($locale['400']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
}
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['458']."<br /><br />\n$error<br />\n<a href='".FUSION_SELF."'>".$locale['459']."</a></div><br />\n";
closetable();
}
} else {
if ($settings['email_verification'] == "1") {
$offset_list = "";
for ($i = -13; $i < 17; $i++) {
if ($i > 0) { $offset = "+".$i; } else { $offset = $i; }
$offset_list .= "<option".($offset == "0" ? " selected='selected'" : "").">".$offset."</option>\n";
}
}
opentable($locale['400']);
echo "<div style='text-align:center'>".$locale['500']."\n";
if ($settings['email_verification'] == "1") echo $locale['501']."\n";
echo $locale['502'];
if ($settings['email_verification'] == "1") echo "\n".$locale['503'];
echo "</div><br />\n";
echo "<form name='inputform' method='post' action='".FUSION_SELF."' onsubmit='return ValidateForm(this)'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'><input type='text' name='miejscowosc' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Kod Pocztowy<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='kod' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Miejscowo¶ć<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'>".$locale['u006']."</td>\n";
echo "<td class='tbl'><label><input type='radio' name='user_hide_email' value='1' checked='checked' />".$locale['u007']."</label>\n";
echo "<label><input type='radio' name='user_hide_email' value='0' />".$locale['u008']."</label></td>\n";
echo "</tr>\n";
if ($settings['display_validation'] == "1") {
echo "<tr>\n<td valign='top' class='tbl'>".$locale['504']."</td>\n<td class='tbl'>";
echo "<img id='captcha' src='".INCLUDES."securimage/securimage_show.php' alt='".$locale['504']."' align='left' />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' align='top' class='tbl-border' style='margin-bottom:1px' /></a><br />\n";
echo "<a href='#' onclick=\"document.getElementById('captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' align='bottom' class='tbl-border' /></a>\n";
echo "</td>\n</tr>\n<tr>";
echo "<td class='tbl'>".$locale['505']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='captcha_code' class='textbox' style='width:100px' /></td>\n";
echo "</tr>\n";
}
if ($settings['enable_terms'] == 1) {
echo "<tr>\n<td class='tbl'>".$locale['508'] ."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='checkbox' id='agreement' name='agreement' value='1' onclick='checkagreement()' /> <span class='small'><label for='agreement'>".$locale['509'] ."</label></span></td>\n";
echo "</tr>\n";
}
echo "<tr>\n<td align='center' colspan='2'><br />\n";
echo "<input type='submit' name='register' value='".$locale['506']."' class='button'".($settings['enable_terms'] == 1 ? " disabled='disabled'" : "")." />\n";
echo "</td>\n</tr>\n</table>\n</form>\n";
closetable();
echo "<script type='text/javascript'>
function ValidateForm(frm) {
if (frm.username.value==\"\") {
alert(\"".$locale['550']."\");
return false;
}
if (frm.password1.value==\"\") {
alert(\"".$locale['551']."\");
return false;
}
if (frm.email.value==\"\") {
alert(\"".$locale['552']."\");
return false;
}
if (frm.miejscowosc.value==\"\") {
alert(\"Proszę podać Miejscowo¶ć\");
return false;
}
if (frm.kod.value==\"\") {
alert(\"Proszę podać Kod Pocztowy\");
return false;
}
}
</script>\n";
if ($settings['enable_terms'] == 1) {
echo "<script language='JavaScript' type='text/javascript'>
function checkagreement() {
if(document.inputform.agreement.checked) {
document.inputform.register.disabled=false;
} else {
document.inputform.register.disabled=true;
}
}
</script>";
}
}
require_once THEMES."templates/footer.php";
?>
Edytowane przez Pieka dnia 09.03.2011 15:59:45
|
|
|
|
Gismo_PL |
Dodany dnia 09.03.2011 16:05:05
|
Bywalec
Postów: 462 Pomógł: 40 Ostrzeżeń: 2
v7.01.05 Data rejestracji: 25.02.2007 21:13
|
Tak na szybko poprawiony kod:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: register.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.or...agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."register.php";
include LOCALE.LOCALESET."user_fields.php";
if (iMEMBER || !$settings['enable_registration']) { redirect("index.php"); }
if (isset($_GET['activate'])) {
if (!preg_check("/^[0-9a-z]{32}$/", $_GET['activate'])) { redirect("index.php"); }
$result = dbquery("SELECT user_info FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
if (dbrows($result)) {
$data = dbarray($result);
$user_info = unserialize($data['user_info']);
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM ".DB_USER_FIELDS." tuf
INNER JOIN ".DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, miejscowosc, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.") VALUES('".$user_info['user_name']."', '".$user_info['user_password']."', '', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', $miejscowosc, '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.")");
$result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
add_to_title($locale['global_200'].$locale['401']);
opentable($locale['401']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
} else {
redirect("index.php");
}
} elseif (isset($_POST['register'])) {
if ($settings['display_validation'] == "1") {
include_once INCLUDES."securimage/securimage.php";
}
$error = ""; $db_fields = ""; $db_values = "";
$username = stripinput(trim(preg_replace("/ +/i", " ", $_POST['username'])));
$email = stripinput(trim(preg_replace("/ +/i", "", $_POST['email'])));
$password1 = stripinput(trim(preg_replace("/ +/i", "", $_POST['password1'])));
$miejscowosc = stripinput(trim($_POST['miejscowosc']));
$kod = stripinput(trim($_POST['kod']));
if ($username == "" || $password1 == "" || $email == "") {
$error .= $locale['402']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) {
$error .= $locale['403']."<br />\n";
}
if (preg_match("/^[0-9A-Z@]{6,20}$/i", $password1)) {
if ($password1 != $_POST['password2']) $error .= $locale['404']."<br />\n";
} else {
$error .= $locale['405']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
$error .= $locale['406']."<br />\n";
}
$email_domain = substr(strrchr($email, "@"), 1);
if (dbcount("(blacklist_id)", DB_BLACKLIST, "blacklist_email='$email' OR blacklist_email='$email_domain'") != 0) { $error = $locale['411']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_name='$username'") != 0) { $error = $locale['407']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_email='$email'") != 0) { $error = $locale['408']."<br />\n";}
if ($settings['email_verification'] == "1") {
$result = dbquery("SELECT user_email, user_info FROM ".DB_NEW_USERS);
while ($new_users = dbarray($result)) {
$user_info = unserialize($new_users['user_info']);
if ($new_users['user_email'] == $email) { $error = $locale['409']."<br />\n"; }
if ($user_info['user_name'] == $username) { $error = $locale['407']."<br />\n"; break; }
}
}
if ($settings['display_validation'] == "1") {
$securimage = new Securimage();
if (!isset($_POST['captcha_code']) || $securimage->check($_POST['captcha_code']) == false) {
$error .= $locale['410']."<br />\n";
}
}
$user_hide_email = isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1";
if ($settings['email_verification'] == "0") {
$user_offset = isset($_POST['user_offset']) ? is_numeric($_POST['user_offset']) ? $_POST['user_offset'] : "0" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM ".DB_USER_FIELDS." tuf
INNER JOIN ".DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
}
if ($error == "") {
if ($settings['email_verification'] == "1") {
require_once INCLUDES."sendmail_include.php";
mt_srand((double)microtime()*1000000); $salt = "";
for ($i = 0; $i <= 7; $i++) { $salt .= chr(rand(97, 122)); }
$user_code = md5($email.$salt);
$activation_url = $settings['siteurl']."register.php?activate=".$user_code;
if (sendemail($username,$email,$settings['siteusername'], $settings['siteemail'], $locale['449'], $locale['450'].$activation_url)) {
$user_info = serialize(array(
"user_name" => $username,
"user_password" => md5(md5($password1)),
"user_email" => $email,
"user_hide_email" => isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1",
"miejscowosc" => $miejscowosc,
"kod" => $kod
));
$result = dbquery("INSERT INTO ".DB_NEW_USERS." (user_code, user_email, user_datestamp, user_info) VALUES('$user_code', '".$email."', '".time()."', '$user_info')");
opentable($locale['400']);
echo "<div style='text-align:center'><br />\n".$locale['454']."<br /><br />\n</div>\n";
closetable();
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['457']."<br /><br />\n</div>\n";
closetable();
}
} else {
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.",miejscowosc ,user_kod) VALUES('$username', '".md5(md5($password1))."', '', '".$email."', '$user_hide_email', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.", '$miejscowosc' , '$kod' )");
opentable($locale['400']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
}
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['458']."<br /><br />\n$error<br />\n<a href='".FUSION_SELF."'>".$locale['459']."</a></div><br />\n";
closetable();
}
} else {
if ($settings['email_verification'] == "1") {
$offset_list = "";
for ($i = -13; $i < 17; $i++) {
if ($i > 0) { $offset = "+".$i; } else { $offset = $i; }
$offset_list .= "<option".($offset == "0" ? " selected='selected'" : "").">".$offset."</option>\n";
}
}
opentable($locale['400']);
echo "<div style='text-align:center'>".$locale['500']."\n";
if ($settings['email_verification'] == "1") echo $locale['501']."\n";
echo $locale['502'];
if ($settings['email_verification'] == "1") echo "\n".$locale['503'];
echo "</div><br />\n";
echo "<form name='inputform' method='post' action='".FUSION_SELF."' onsubmit='return ValidateForm(this)'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Kod Pocztowy<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='kod' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Miejscowo¶ć<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='miejscowosc' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u006']."</td>\n";
echo "<td class='tbl'><label><input type='radio' name='user_hide_email' value='1' checked='checked' />".$locale['u007']."</label>\n";
echo "<label><input type='radio' name='user_hide_email' value='0' />".$locale['u008']."</label></td>\n";
echo "</tr>\n";
if ($settings['display_validation'] == "1") {
echo "<tr>\n<td valign='top' class='tbl'>".$locale['504']."</td>\n<td class='tbl'>";
echo "<img id='captcha' src='".INCLUDES."securimage/securimage_show.php' alt='".$locale['504']."' align='left' />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' align='top' class='tbl-border' style='margin-bottom:1px' /></a><br />\n";
echo "<a href='#' onclick=\"document.getElementById('captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' align='bottom' class='tbl-border' /></a>\n";
echo "</td>\n</tr>\n<tr>";
echo "<td class='tbl'>".$locale['505']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='captcha_code' class='textbox' style='width:100px' /></td>\n";
echo "</tr>\n";
}
if ($settings['enable_terms'] == 1) {
echo "<tr>\n<td class='tbl'>".$locale['508'] ."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='checkbox' id='agreement' name='agreement' value='1' onclick='checkagreement()' /> <span class='small'><label for='agreement'>".$locale['509'] ."</label></span></td>\n";
echo "</tr>\n";
}
echo "<tr>\n<td align='center' colspan='2'><br />\n";
echo "<input type='submit' name='register' value='".$locale['506']."' class='button'".($settings['enable_terms'] == 1 ? " disabled='disabled'" : "")." />\n";
echo "</td>\n</tr>\n</table>\n</form>\n";
closetable();
echo "<script type='text/javascript'>
function ValidateForm(frm) {
if (frm.username.value==\"\") {
alert(\"".$locale['550']."\");
return false;
}
if (frm.password1.value==\"\") {
alert(\"".$locale['551']."\");
return false;
}
if (frm.email.value==\"\") {
alert(\"".$locale['552']."\");
return false;
}
if (frm.miejscowosc.value==\"\") {
alert(\"Proszę podać Miejscowo¶ć\");
return false;
}
if (frm.kod.value==\"\") {
alert(\"Proszę podać Kod Pocztowy\");
return false;
}
}
</script>\n";
if ($settings['enable_terms'] == 1) {
echo "<script language='JavaScript' type='text/javascript'>
function checkagreement() {
if(document.inputform.agreement.checked) {
document.inputform.register.disabled=false;
} else {
document.inputform.register.disabled=true;
}
}
</script>";
}
}
require_once THEMES."templates/footer.php";
?>
Kliknij i zaczekaj na załadowanie kodu ...
Taka uwaga - skoro używasz zmiennej $miejscowosc to dlaczego wymagasz aby zapisało Ci w bazie zmienną $user_miejscowosc skoro taka nie istnieje :|.
Edytowane przez krystian1988 dnia 09.03.2011 16:07:17
|
|
|
|
AntaresXL |
Dodany dnia 09.03.2011 18:46:38
|
Przedszkolak
Postów: 7
Data rejestracji: 07.03.2011 22:09
|
Po aktywacji e-mail wyświetlił się taki błąd:
Notice: Undefined variable: miejscowosc in /tutaj adres strony/register.php on line 99
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' '0', '0', '1299691932', '0', '88.201.125.60', '', '', '101', '0')' at line 1
|
|
|
|
Gismo_PL |
Dodany dnia 09.03.2011 19:25:30
|
Bywalec
Postów: 462 Pomógł: 40 Ostrzeżeń: 2
v7.01.05 Data rejestracji: 25.02.2007 21:13
|
Sprawdź ten kod:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: register.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.or...agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."register.php";
include LOCALE.LOCALESET."user_fields.php";
if (iMEMBER || !$settings['enable_registration']) { redirect("index.php"); }
if (isset($_GET['activate'])) {
if (!preg_check("/^[0-9a-z]{32}$/", $_GET['activate'])) { redirect("index.php"); }
$result = dbquery("SELECT user_info FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
if (dbrows($result)) {
$data = dbarray($result);
$user_info = unserialize($data['user_info']);
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM "
.DB_USER_FIELDS." tuf
INNER JOIN "
.DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.") VALUES('".$user_info['user_name']."', '".$user_info['user_password']."', '', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.")");
$result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['activate']."'");
add_to_title($locale['global_200'].$locale['401']);
opentable($locale['401']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['455']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
} else {
redirect("index.php");
}
} elseif (isset($_POST['register'])) {
if ($settings['display_validation'] == "1") {
include_once INCLUDES."securimage/securimage.php";
}
$error = ""; $db_fields = ""; $db_values = "";
$username = stripinput(trim(preg_replace("/ +/i", " ", $_POST['username'])));
$email = stripinput(trim(preg_replace("/ +/i", "", $_POST['email'])));
$password1 = stripinput(trim(preg_replace("/ +/i", "", $_POST['password1'])));
$miejscowosc = stripinput(trim($_POST['miejscowosc']));
$kod = stripinput(trim($_POST['kod']));
if ($username == "" || $password1 == "" || $email == "") {
$error .= $locale['402']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) {
$error .= $locale['403']."<br />\n";
}
if (preg_match("/^[0-9A-Z@]{6,20}$/i", $password1)) {
if ($password1 != $_POST['password2']) $error .= $locale['404']."<br />\n";
} else {
$error .= $locale['405']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
$error .= $locale['406']."<br />\n";
}
$email_domain = substr(strrchr($email, "@"), 1);
if (dbcount("(blacklist_id)", DB_BLACKLIST, "blacklist_email='$email' OR blacklist_email='$email_domain'") != 0) { $error = $locale['411']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_name='$username'") != 0) { $error = $locale['407']."<br />\n";}
if (dbcount("(user_id)", DB_USERS, "user_email='$email'") != 0) { $error = $locale['408']."<br />\n";}
if ($settings['email_verification'] == "1") {
$result = dbquery("SELECT user_email, user_info FROM ".DB_NEW_USERS);
while ($new_users = dbarray($result)) {
$user_info = unserialize($new_users['user_info']);
if ($new_users['user_email'] == $email) { $error = $locale['409']."<br />\n"; }
if ($user_info['user_name'] == $username) { $error = $locale['407']."<br />\n"; break; }
}
}
if ($settings['display_validation'] == "1") {
$securimage = new Securimage();
if (!isset($_POST['captcha_code']) || $securimage->check($_POST['captcha_code']) == false) {
$error .= $locale['410']."<br />\n";
}
}
$user_hide_email = isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1";
if ($settings['email_verification'] == "0") {
$user_offset = isset($_POST['user_offset']) ? is_numeric($_POST['user_offset']) ? $_POST['user_offset'] : "0" : "0";
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery(
"SELECT * FROM "
.DB_USER_FIELDS." tuf
INNER JOIN "
.DB_USER_FIELD_CATS." tufc ON tuf.field_cat = tufc.field_cat_id
ORDER BY field_cat_order, field_order"
);if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
}
if ($error == "") {
if ($settings['email_verification'] == "1") {
require_once INCLUDES."sendmail_include.php";
mt_srand((double)microtime()*1000000); $salt = "";
for ($i = 0; $i <= 7; $i++) { $salt .= chr(rand(97, 122)); }
$user_code = md5($email.$salt);
$activation_url = $settings['siteurl']."register.php?activate=".$user_code;
if (sendemail($username,$email,$settings['siteusername'], $settings['siteemail'], $locale['449'], $locale['450'].$activation_url)) {
$user_info = serialize(array(
"user_name" => $username,
"user_password" => md5(md5($password1)),
"user_email" => $email,
"user_hide_email" => isnum($_POST['user_hide_email']) ? $_POST['user_hide_email'] : "1",
"miejscowosc" => $miejscowosc,
"kod" => $kod
));
$result = dbquery("INSERT INTO ".DB_NEW_USERS." (user_code, user_email, user_datestamp, user_info) VALUES('$user_code', '".$email."', '".time()."', '$user_info')");
opentable($locale['400']);
echo "<div style='text-align:center'><br />\n".$locale['454']."<br /><br />\n</div>\n";
closetable();
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['457']."<br /><br />\n</div>\n";
closetable();
}
} else {
$user_status = $settings['admin_activation'] == "1" ? "2" : "0";
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.",miejscowosc ,user_kod) VALUES('$username', '".md5(md5($password1))."', '', '".$email."', '$user_hide_email', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.", '$miejscowosc' , '$kod' )");
opentable($locale['400']);
if ($settings['admin_activation'] == "1") {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['453']."<br /><br />\n</div>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['451']."<br /><br />\n".$locale['452']."<br /><br />\n</div>\n";
}
closetable();
}
} else {
opentable($locale['456']);
echo "<div style='text-align:center'><br />\n".$locale['458']."<br /><br />\n$error<br />\n<a href='".FUSION_SELF."'>".$locale['459']."</a></div><br />\n";
closetable();
}
} else {
if ($settings['email_verification'] == "1") {
$offset_list = "";
for ($i = -13; $i < 17; $i++) {
if ($i > 0) { $offset = "+".$i; } else { $offset = $i; }
$offset_list .= "<option".($offset == "0" ? " selected='selected'" : "").">".$offset."</option>\n";
}
}
opentable($locale['400']);
echo "<div style='text-align:center'>".$locale['500']."\n";
if ($settings['email_verification'] == "1") echo $locale['501']."\n";
echo $locale['502'];
if ($settings['email_verification'] == "1") echo "\n".$locale['503'];
echo "</div><br />\n";
echo "<form name='inputform' method='post' action='".FUSION_SELF."' onsubmit='return ValidateForm(this)'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Kod Pocztowy<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='kod' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>Miejscowo¶ć<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='miejscowosc' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u006']."</td>\n";
echo "<td class='tbl'><label><input type='radio' name='user_hide_email' value='1' checked='checked' />".$locale['u007']."</label>\n";
echo "<label><input type='radio' name='user_hide_email' value='0' />".$locale['u008']."</label></td>\n";
echo "</tr>\n";
if ($settings['display_validation'] == "1") {
echo "<tr>\n<td valign='top' class='tbl'>".$locale['504']."</td>\n<td class='tbl'>";
echo "<img id='captcha' src='".INCLUDES."securimage/securimage_show.php' alt='".$locale['504']."' align='left' />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' align='top' class='tbl-border' style='margin-bottom:1px' /></a><br />\n";
echo "<a href='#' onclick=\"document.getElementById('captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' align='bottom' class='tbl-border' /></a>\n";
echo "</td>\n</tr>\n<tr>";
echo "<td class='tbl'>".$locale['505']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='captcha_code' class='textbox' style='width:100px' /></td>\n";
echo "</tr>\n";
}
if ($settings['enable_terms'] == 1) {
echo "<tr>\n<td class='tbl'>".$locale['508'] ."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='checkbox' id='agreement' name='agreement' value='1' onclick='checkagreement()' /> <span class='small'><label for='agreement'>".$locale['509'] ."</label></span></td>\n";
echo "</tr>\n";
}
echo "<tr>\n<td align='center' colspan='2'><br />\n";
echo "<input type='submit' name='register' value='".$locale['506']."' class='button'".($settings['enable_terms'] == 1 ? " disabled='disabled'" : "")." />\n";
echo "</td>\n</tr>\n</table>\n</form>\n";
closetable();
echo
"<script type='text/javascript'>
function ValidateForm(frm) {
if (frm.username.value==\"\") {
alert(\""
.$locale['550']."\");
return false;
}
if (frm.password1.value==\"\") {
alert(\""
.$locale['551']."\");
return false;
}
if (frm.email.value==\"\") {
alert(\""
.$locale['552']."\");
return false;
}
if (frm.miejscowosc.value==\"\") {
alert(\"Proszę podać Miejscowo¶ć\");
return false;
}
if (frm.kod.value==\"\") {
alert(\"Proszę podać Kod Pocztowy\");
return false;
}
#
}
</script>\n"
;
if ($settings['enable_terms'] == 1) {
echo
"<script language='JavaScript' type='text/javascript'>
function checkagreement() {
if(document.inputform.agreement.checked) {
document.inputform.register.disabled=false;
} else {
document.inputform.register.disabled=true;
}
}
</script>"
;}
}
require_once THEMES."templates/footer.php";
?>
Kliknij i zaczekaj na załadowanie kodu ...
Powinno być ok.
PW od moderatora:
- Ogólna Uwaga - hoopak 09.03 - 19:39
Edytowane przez Gismo_PL dnia 09.03.2011 20:12:08
|
|
|
|
AntaresXL |
Dodany dnia 09.03.2011 20:05:50
|
Przedszkolak
Postów: 7
Data rejestracji: 07.03.2011 22:09
|
Rejestracja przebiega dobrze żadnego błędu, ale nie zapisuje do bazy. |
|
|
|
Gismo_PL |
Dodany dnia 09.03.2011 20:14:23
|
Bywalec
Postów: 462 Pomógł: 40 Ostrzeżeń: 2
v7.01.05 Data rejestracji: 25.02.2007 21:13
|
Powiem tak - zaczyna mnie to trochę mdlić
Bądź tak łaskaw i podaj adres strony to łatwiej będzie mi sprawdzić cokolwiek.
|
|
|
|
AntaresXL |
Dodany dnia 09.03.2011 20:27:39
|
Przedszkolak
Postów: 7
Data rejestracji: 07.03.2011 22:09
|
Proszę http://www.youdom...
Edytowane przez AntaresXL dnia 15.03.2011 01:10:37
|
|
|
|
Gismo_PL |
Dodany dnia 09.03.2011 21:03:09
|
Bywalec
Postów: 462 Pomógł: 40 Ostrzeżeń: 2
v7.01.05 Data rejestracji: 25.02.2007 21:13
|
Podmień kod z linii 52 podanego wyżej kodu na:
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, miejscowosc, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".$db_fields.") VALUES('".$user_info['user_name']."', '".$user_info['user_password']."', '', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '".$user_info['miejscowosc']."', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$user_status'".$db_values.")");
Kliknij i zaczekaj na załadowanie kodu ...
|
|
|
|
AntaresXL |
Dodany dnia 10.03.2011 00:03:14
|
Przedszkolak
Postów: 7
Data rejestracji: 07.03.2011 22:09
|
Wszystko pięknie działa, nawet dodałem inne pola. Bardzo, ale to bardzo dziękuję no i klikam na pomógł. Gismo_PL jest niezastąpiony !!! |
|
|
|
xtremes |
Dodany dnia 10.03.2011 00:23:22
|
Przedszkolak
Postów: 27 Pomógł: 6 Ostrzeżeń: 1
Data rejestracji: 28.09.2007 22:45
|
Dzięki Gismo_PL, u mnie też dzięki Tobie wszystko pięknie działa. |
|
|