24, July 2008
additional information for update to version 1.92 - webmaster forum
This forum shares its ad revenue with its members!
Navigation
Webdigity Services
Pagerank Monitor
Whois Tool
Web Design Gallery
Webmaster Forums
Webmaster Directory
Tutorials Database
Webmaster Forums
WebDigity Community
HumanWorks network new...
Clickbank Contextual S...
Forum Contests
Forum Lounge
New Member Introductions
Tech News
Google Forum
User Forums
aStatSpam forum
Computers
3rd-Party Scripting
The 100 Lists Website ...
PixelThings
Smart Publisher
Forums Talk
Design and Layout
General webmaster disc...
Graphics & Multimedia
Adobe Photoshop
Macromedia Flash & Act...
Web Page Design
HTML & XHTML
CSS
Accesibility issues
Website & Graphic Revi...
Web Development
PhP
PHP classes @finalwebs...
Php User Class
JavaScript
Databases
MySQL
Security
Miscellaneous Languages
ASP & .NET
Java & JSP
Web hosting talk
Hosting companies
Domain names
Configuring your server
Apache web server
Monetizing your site
General Business
CPC programs
Adsense
Chitika eMiniMalls
CPM programs
Affiliate programs & o...
Web site promotion
Promotion techniques
Search Engine Optimiza...
Google SEO
Promoting & building a...
SMF moding & promoting
Marketplace
Advertise your services
Sell your site
Sell a domain name
Request services
Hire people
Link trading requests
[
Home
|
Help
|
Search
|
Forum's Shop
|
Archive
|
Login
|
Register
|
Webmaster Directory
]
Web
www.webdigity.com
Hide the search bar
Whois database search :
Domain :
Use the whois database tool to retrieve information on any top level domain you are interested in.
Webdigity Webmaster Forums
>
Web Development
>
PhP
>
PHP classes @finalwebsites.com
>
Access_user Class
(Moderator:
Olaf
)
Topic:
additional information for update to version 1.92
« previous
next »
Pages: [
1
]
Author
Topic: additional information for update to version 1.92 (Read 1631 times)
Moderator
Community Supporter
?
Jedai Sword Master
Gender:
Posts: 6280
38506 credits
Members referred : 374
It's time to use PHP5!
«
on:
Sep 16, 2006, 02:04:45 PM »
Hello,
I you're using previous version of the access_user class you need to change the following methods:
Code:
<?php
// added the MD5 to the sql statement
function
activate_new_password
(
$new_pass
,
$new_confirm
,
$old_pass
,
$user_id
) {
if (
$this
->
check_new_password
(
$new_pass
,
$new_confirm
)) {
$sql_new_pass
=
sprintf
(
"UPDATE %s SET pw = '%s' WHERE MD5(pw) = '%s' AND id = %d"
,
$this
->
table_name
,
md5
(
$new_pass
),
$old_pass
,
$user_id
);
if (
mysql_query
(
$sql_new_pass
)) {
$this
->
the_msg
=
$this
->
messages
(
30
);
return
true
;
} else {
$this
->
the_msg
=
$this
->
messages
(
14
);
return
false
;
}
} else {
return
false
;
}
}
// added the MD5 to the sql statement
function
check_activation_password
(
$controle_str
,
$id
) {
if (
$controle_str
!=
""
&&
strlen
(
$controle_str
) ==
32
&&
$id
>
0
) {
$this
->
user_pw
=
$controle_str
;
$this
->
id
=
$id
;
if (
$this
->
check_user
(
"new_pass"
)) {
// this is a fix for version 1.76
$sql_get_user
=
sprintf
(
"SELECT login FROM %s WHERE MD5(pw) = '%s' AND id = %d"
,
$this
->
table_name
,
$this
->
user_pw
,
$this
->
id
);
$get_user
=
mysql_query
(
$sql_get_user
);
$this
->
user
=
mysql_result
(
$get_user
,
0
,
"login"
);
// end fix
return
true
;
} else {
$this
->
the_msg
=
$this
->
messages
(
21
);
return
false
;
}
} else {
$this
->
the_msg
=
$this
->
messages
(
21
);
return
false
;
}
}
// added the MD5 to the sql statement
function
activate_account
(
$activate_key
,
$key_id
) {
if (
$activate_key
!=
""
&&
strlen
(
$activate_key
) ==
32
&&
$key_id
>
0
) {
$this
->
id
=
$key_id
;
if (
$this
->
check_user
(
"active"
)) {
if (
$this
->
auto_activation
) {
$upd_sql
=
sprintf
(
"UPDATE %s SET active = 'y' WHERE id = %s AND MD5(pw) = '%s'"
,
$this
->
table_name
,
$key_id
,
$activate_key
);
if (
mysql_query
(
$upd_sql
)) {
if (
$this
->
send_confirmation
(
$key_id
)) {
$this
->
the_msg
=
$this
->
messages
(
18
);
} else {
$this
->
the_msg
=
$this
->
messages
(
14
);
}
} else {
$this
->
the_msg
=
$this
->
messages
(
19
);
}
} else {
if (
$this
->
send_mail
(
$this
->
admin_mail
,
40
,
39
)) {
$this
->
the_msg
=
$this
->
messages
(
36
);
} else {
$this
->
the_msg
=
$this
->
messages
(
14
);
}
}
} else {
$this
->
the_msg
=
$this
->
messages
(
20
);
}
} else {
$this
->
the_msg
=
$this
->
messages
(
21
);
}
}
// added the MD5 to the sql statement
function
validate_email
(
$validation_key
,
$key_id
) {
if (
$validation_key
!=
""
&&
strlen
(
$validation_key
) ==
32
&&
$key_id
>
0
) {
$this
->
id
=
$key_id
;
if (
$this
->
check_user
(
"validate"
)) {
$upd_sql
=
sprintf
(
"UPDATE %s SET email = tmp_mail, tmp_mail = '' WHERE id = %d AND MD5(pw) = '%s'"
,
$this
->
table_name
,
$key_id
,
$validation_key
);
if (
mysql_query
(
$upd_sql
)) {
$this
->
the_msg
=
$this
->
messages
(
18
);
} else {
$this
->
the_msg
=
$this
->
messages
(
19
);
}
} else {
$this
->
the_msg
=
$this
->
messages
(
34
);
}
} else {
$this
->
the_msg
=
$this
->
messages
(
21
);
}
}
// added the md5 to the var $first_password before calling the send_mail() method
function
register_user
(
$first_login
,
$first_password
,
$confirm_password
,
$first_name
,
$first_info
,
$first_email
) {
if (
$this
->
check_new_password
(
$first_password
,
$confirm_password
)) {
if (
strlen
(
$first_login
) >=
LOGIN_LENGTH
) {
if (
$this
->
check_email
(
$first_email
)) {
$this
->
user_email
=
$first_email
;
$this
->
user
=
$first_login
;
if (
$this
->
check_user
(
"new"
)) {
$this
->
the_msg
=
$this
->
messages
(
12
);
return;
} else {
$sql
=
sprintf
(
"INSERT INTO %s (id, login, pw, real_name, extra_info, email, access_level, active) VALUES (NULL, %s, %s, %s, %s, %s, %d, 'n')"
,
$this
->
table_name
,
$this
->
ins_string
(
$first_login
),
$this
->
ins_string
(
md5
(
$first_password
)),
$this
->
ins_string
(
$first_name
),
$this
->
ins_string
(
$first_info
),
$this
->
ins_string
(
$this
->
user_email
),
DEFAULT_ACCESS_LEVEL
);
$ins_res
=
mysql_query
(
$sql
) or die(
mysql_error
());
if (
$ins_res
) {
$this
->
id
=
mysql_insert_id
();
$this
->
user_pw
=
md5
(
$first_password
);
if (
$this
->
send_mail
(
$this
->
user_email
,
29
,
28
)) {
$this
->
the_msg
=
$this
->
messages
(
13
);
} else {
mysql_query
(
sprintf
(
"DELETE FROM %s WHERE id = %s"
,
$this
->
table_name
,
$this
->
id
));
$this
->
the_msg
=
$this
->
messages
(
14
);
}
} else {
$this
->
the_msg
=
$this
->
messages
(
15
);
}
}
} else {
$this
->
the_msg
=
$this
->
messages
(
16
);
}
} else {
$this
->
the_msg
=
$this
->
messages
(
17
);
}
}
}
// added md5 to the var $new_password
// removed the md5 from $this->ins_string($ins_password)
function
update_user
(
$new_password
,
$new_confirm
,
$new_name
,
$new_info
,
$new_mail
) {
if (
$new_password
!=
""
) {
if (
$this
->
check_new_password
(
$new_password
,
$new_confirm
)) {
$ins_password
=
md5
(
$new_password
);
$update_pw
=
true
;
} else {
return;
}
} else {
$ins_password
=
$this
->
user_pw
;
$update_pw
=
false
;
}
if (
trim
(
$new_mail
) <>
$this
->
user_email
) {
if (
$this
->
check_email
(
$new_mail
)) {
$this
->
user_email
=
$new_mail
;
if (!
$this
->
check_user
(
"lost"
)) {
$update_email
=
true
;
} else {
$this
->
the_msg
=
$this
->
messages
(
31
);
return;
}
} else {
$this
->
the_msg
=
$this
->
messages
(
16
);
return;
}
} else {
$update_email
=
false
;
$new_mail
=
""
;
}
$upd_sql
=
sprintf
(
"UPDATE %s SET pw = %s, real_name = %s, extra_info = %s, tmp_mail = %s WHERE id = %d"
,
$this
->
table_name
,
$this
->
ins_string
(
$ins_password
),
$this
->
ins_string
(
$new_name
),
$this
->
ins_string
(
$new_info
),
$this
->
ins_string
(
$new_mail
),
$this
->
id
);
$upd_res
=
mysql_query
(
$upd_sql
);
if (
$upd_res
) {
if (
$update_pw
) {
$_SESSION
[
'pw'
] =
$this
->
user_pw
=
$ins_password
;
if (isset(
$_COOKIE
[
$this
->
cookie_name
])) {
$this
->
save_login
=
"yes"
;
$this
->
login_saver
();
}
}
$this
->
the_msg
=
$this
->
messages
(
30
);
if (
$update_email
) {
if (
$this
->
send_mail
(
$new_mail
,
33
)) {
$this
->
the_msg
=
$this
->
messages
(
27
);
} else {
mysql_query
(
sprintf
(
"UPDATE %s SET tmp_mail = ''"
,
$this
->
table_name
));
$this
->
the_msg
=
$this
->
messages
(
14
);
}
}
} else {
$this
->
the_msg
=
$this
->
messages
(
15
);
}
}
// removed the md5 from var $pass
function
reg_visit
(
$login
,
$pass
) {
$visit_sql
=
sprintf
(
"UPDATE %s SET extra_info = '%s' WHERE login = '%s' AND pw = '%s'"
,
$this
->
table_name
,
date
(
"Y-m-d H:i:s"
),
$login
,
$pass
);
mysql_query
(
$visit_sql
);
}
// added md5 to var $password id $this->is_cookie = false
// changed argument for req_visit to $this->user_pw
function
login_user
(
$user
,
$password
) {
if (
$user
!=
""
&&
$password
!=
""
) {
$this
->
user
=
$user
;
$this
->
user_pw
=
md5
(
$password
);
if (
$this
->
check_user
()) {
$this
->
login_saver
();
if (
$this
->
count_visit
) {
$this
->
reg_visit
(
$user
,
$this
->
user_pw
);
}
$this
->
set_user
();
} else {
$this
->
the_msg
=
$this
->
messages
(
10
);
}
} else {
$this
->
the_msg
=
$this
->
messages
(
11
);
}
}
// removed check for encoded var $this->user_pw
// replaced in default case var $password with $this->user_pw
// added MD5 to sql statement for "new_pass"
function
check_user
(
$pass
=
""
) {
switch (
$pass
) {
case
"new"
:
$sql
=
sprintf
(
"SELECT COUNT(*) AS test FROM %s WHERE email = '%s' OR login = '%s'"
,
$this
->
table_name
,
$this
->
user_email
,
$this
->
user
);
break;
case
"lost"
:
$sql
=
sprintf
(
"SELECT COUNT(*) AS test FROM %s WHERE email = '%s' AND active = 'y'"
,
$this
->
table_name
,
$this
->
user_email
);
break;
case
"new_pass"
:
$sql
=
sprintf
(
"SELECT COUNT(*) AS test FROM %s WHERE MD5(pw) = '%s' AND id = %d"
,
$this
->
table_name
,
$this
->
user_pw
,
$this
->
id
);
break;
case
"active"
:
$sql
=
sprintf
(
"SELECT COUNT(*) AS test FROM %s WHERE id = %d AND active = 'n'"
,
$this
->
table_name
,
$this
->
id
);
break;
case
"validate"
:
$sql
=
sprintf
(
"SELECT COUNT(*) AS test FROM %s WHERE id = %d AND tmp_mail <> ''"
,
$this
->
table_name
,
$this
->
id
);
break;
default:
$sql
=
sprintf
(
"SELECT COUNT(*) AS test FROM %s WHERE BINARY login = '%s' AND pw = '%s' AND active = 'y'"
,
$this
->
table_name
,
$this
->
user
,
$this
->
user_pw
);
}
$result
=
mysql_query
(
$sql
) or die(
mysql_error
());
if (
mysql_result
(
$result
,
0
,
"test"
) ==
1
) {
return
true
;
} else {
return
false
;
}
}
Free WordPress Themes
CMS Reviews and Resources
PHP Scripts Archive
Last blog :
4th of July Lottery from TemplateMonster.com
Trackback URI for this entry :
http://www.webdigity.com/trackback.php?topic=4117
Tags :
email
Bookmark this thread :
Digg
Del.icio.us
Dzone
more....
Topic sponsors:
Get a permanent link here for $1.99!
Pages: [
1
]
Webdigity Webmaster Forums
>
Web Development
>
PhP
>
PHP classes @finalwebsites.com
>
Access_user Class
(Moderator:
Olaf
)
Topic:
additional information for update to version 1.92
« previous
next »
Jump to:
=>Personal Messages
=>My Subscriptions
=>Profile Settings
=>Account Settings
=>Look and Layout Settings
=>Unread Posts
=>Unread Replies To My Posts
=>Affiliate Program
=>Forum's Shop
=>Arcade
Category: WebDigity Community
=> HumanWorks network news & feedback
===> Clickbank Contextual Script Support
=> Forum Contests
=> Forum Lounge
===> New Member Introductions
===> Tech News
===> Google Forum
=> User Forums
Category: Design and Layout
=> General webmaster discussions
=> Graphics & Multimedia
===> Adobe Photoshop
===> Macromedia Flash & Actionscript
=> Web Page Design
===> HTML & XHTML
===> CSS
===> Accesibility issues
=> Website & Graphic Reviews
Category: Web Development
=> PhP
===> PHP classes @finalwebsites.com
=====> Easy PHP Upload
=====> Access_user Class
=====> Validate_fields Class
=====> DB_cart Class
=====> Miscellaneous scripts or snippets
=====> PHP Whois script