vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   I need some help to finish this hack please! (https://vborg.vbsupport.ru/showthread.php?t=39957)

Parker Clack 06-17-2002 06:56 AM

I need some help to finish this hack please!
 
I have added an option for our members to add a secret word to their profile so if they forget their password and their email address has changed they can still change their email address to have the password reset email sent to their new address.

I have it working somewhat with:

if ($action=="resetemail") {
include("./global.php");

if ($bbuserinfo[userid]==0 or $permissions['canmodifyprofile']==0) {
show_nopermission();
}

if ($email=="" or $secret=="") {
eval("standarderror(\"".gettemplate("error_fieldmi ssing")."\");");
exit;
}

$user=$DB_site->query_first("SELECT email,userid,secret FROM user WHERE secret='".addslashes(htmlspecialchars($secret))."' ");

if ($user['secret']==$secret) {

$DB_site->query("UPDATE user SET email='".addslashes(htmlspecialchars($email))."' WHERE userid='$userid'");

$url = str_replace("\"", "", $url);
eval("standarderror(\"".gettemplate("redirect_emai lupdated")."\");");

} else {

$url = str_replace("\"", "", $url);
eval("standarderror(\"".gettemplate("error_infoinv alid")."\");");

}
}

This ofcourse only changes the first secret word that the database runs into and changes the email address for that userid but if you have more than one person with the same secret word it will change the first one that it runs into and not the one that needs to be changed.

I know I need to run an while array here but I am not sure how to code it. Also, I need it to check to see that the userid and username of the person matches the secret code so it isn't changing another member's email address.

Thanks for any suggestions.

Parker

Admin 06-17-2002 11:28 AM

PHP Code:

if ($action == 'resetemail') {
    include(
'./global.php'); 

    if (
$bbuserinfo['userid'] == or $permissions['canmodifyprofile'] == 0) {
        
show_nopermission();
    } elseif (empty(
$email) or empty($secret)) { 
        eval(
'standarderror("'.gettemplate('error_fieldmissing').'");');
    }

    
$user $DB_site->query_first("
        SELECT email,userid,secret FROM user
        WHERE secret='"
.addslashes(htmlspecialchars($secret))."' AND userid = $bbuserinfo[userid]
    "
); 

    if (
$user) {
        
$DB_site->query("
            UPDATE user SET email = '"
.addslashes(htmlspecialchars($email))."'
            WHERE userid = 
$bbuserinfo[userid]
        "
);
        eval(
'standarderror("'.gettemplate('redirect_emailupdated').'");');
    } else {
        eval(
'standarderror("'.gettemplate('error_infoinvalid').'");');
    }



Parker Clack 06-17-2002 11:40 AM

Chen:

As usual that works like a champ.

Thanks again,
Parker

Admin 06-17-2002 11:59 AM

You're welcome. :)

Chris M 06-17-2002 01:52 PM

That looks sweet Chen...

What file would you add this to?

member.php?

Satan

Admin 06-17-2002 02:29 PM

Heh, I dunno, ask Parker. :) I just fixed his code.

Chris M 06-17-2002 06:20 PM

I just PMed you Parker...

Thanks Chen:)

Satan


All times are GMT. The time now is 01:34 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01168 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete