summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpb1dft <pb1dft@ampache>2008-02-16 21:56:18 +0000
committerpb1dft <pb1dft@ampache>2008-02-16 21:56:18 +0000
commitb70a11b78bec4ed1bc2ace4f0358763d51c80693 (patch)
tree22614b9e46d4fe09c1699ea076c77c471468fe8a
parent2e55ddf4988e94b2328529834e9baab219cb8856 (diff)
downloadampache-b70a11b78bec4ed1bc2ace4f0358763d51c80693.tar.gz
ampache-b70a11b78bec4ed1bc2ace4f0358763d51c80693.tar.bz2
ampache-b70a11b78bec4ed1bc2ace4f0358763d51c80693.zip
Fixed minor glitches in user registration
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/registration.class.php2
-rw-r--r--lib/class/user.class.php16
-rw-r--r--templates/show_user_activate.inc.php5
4 files changed, 17 insertions, 7 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index ad81a0e7..fcb21b05 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Beta2
+ - Fixed some minor glitches in user registration ( pb1dft )
- Fixed typo that caused mail to always mail to everyone.
- Fixed an issue with user auth in XML API always registering as
system (Thx purdyk)
diff --git a/lib/class/registration.class.php b/lib/class/registration.class.php
index 7b3f344c..24015dc7 100644
--- a/lib/class/registration.class.php
+++ b/lib/class/registration.class.php
@@ -60,7 +60,7 @@ class Registration {
if (Config::get('admin_notify_reg')) {
$body = "A new user has registered\n\n" .
"The following values were entered.\n\n" .
- "Username:$username\nFullname:$fullname\nE-mail:$mail\n\n";
+ "Username:$username\nFullname:$fullname\nE-mail:$email\n\n";
mail(Config::get('mail_from'),$subject,$body,$headers);
}
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 1755aa11..9f4e6715 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -546,8 +546,14 @@ class User {
* address at this time in this place, doing this thing.. you get the point
*/
public function insert_ip_history() {
-
- $ip = ip2int($_SERVER['REMOTE_ADDR']);
+ if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
+ $sip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+ debug_event('User Ip', 'Login from ip adress: ' . $sip,'3');
+ } else {
+ $sip = $_SERVER['REMOTE_ADDR'];
+ debug_event('User Ip', 'Login from ip adress: ' . $sip,'3');
+ }
+ $ip = ip2int($sip);
$date = time();
$user = $this->id;
@@ -1000,10 +1006,10 @@ class User {
*/
function activate_user($username) {
- $username = sql_escape($username);
+ $username = Dba::escape($username);
$sql = "UPDATE user SET disabled='0' WHERE username='$username'";
- $db_results = mysql_query($sql, dbh());
+ $db_results = Dba::query($sql);
} // activate_user
@@ -1033,7 +1039,7 @@ class User {
*/
public static function check_username($username) {
- $usrename = Dba::escape($username);
+ $username = Dba::escape($username);
$sql = "SELECT `id` FROM `user` WHERE `username`='$username'";
$db_results = Dba::query($sql);
diff --git a/templates/show_user_activate.inc.php b/templates/show_user_activate.inc.php
index 0fc03d11..9a8fc15c 100644
--- a/templates/show_user_activate.inc.php
+++ b/templates/show_user_activate.inc.php
@@ -42,7 +42,10 @@ $web_path = Config::get('web_path');
<script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script>
<div id="maincontainer">
-<?php if ($validation == User::get_validation($username) AND strlen($validation)) { ?>
+<?php
+ if ($validation == User::get_validation($username) AND strlen($validation)) {
+ User::activate_user($username);
+?>
<h3><?php echo _('User Activated'); ?></h3>
<p>
<?php echo _('This User ID is activated and can be used'); ?>. <a href="<?php echo Config::get('web_path'); ?>/login.php"><?php echo _('Login'); ?></a>