Uitlezen van index_emails.php
Nee ik bedoel niet include. Er staat namelijk een email en een nummer in index_emails.php en dat nummer wil ik uitlezen als het ingevulde email adres gelijk is aan het email adres wat daar staat.
en wat je dan in je script wilt krijgen.
Code (php)
En hoe staat dat emailadres en dat nummer in dat bestand?
Sorry, zal wel aan mij liggen, maar ik snap niet wat de bedoeling is.
Maar wat is het globale/totale/ofzoë nut van je script?
Ik heb het script niet zelf gescheven maar het is een uploader. Alleen zit er ergens een fout in het script als je je pasword wil op vragen. En volgens mij ligt het aan het bovengenoemde stukje code. Dus ik hoopte eigenlijk dat iemand mij kon vertellen wat en of daat een fout in zit.
Ik zie ook niet in wat je met dat script wilt bereiken? Wat is het totale plaatje waarin die index_email.php geinclude wordt?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
case 'password':
{
$tpl_pass = new Template ( TPL_DIR . 'tpl_password.php' );
if ( $task == 'password' )
{
if ( $demo ) exit ( 'Demo only!' );
// Get user info
$email = trim ( gpc ( 'email', 'P' ) );
$err = 'none';
if ( $email == '' )
{
$err = $lang_account['pass_no_email'];
}
else
{
// search for user from the emails index
$emails_idx = new Index;
$emails_idx->open ( EMAILS_INDEX );
$userid = $emails_idx->search ( strtolower ( $email ) );
if ( $userid === false )
{
$err = $lang_account['pass_email_not_found'];
}
else
{
$user = new User;
if ( $user->open ( $userid ) )
{
// generate random password code and send it to the user to make sure that the user did indeed request for password reset
$pw_code = get_rand ( 50 );
$user->set ( 'xtr_password_code', md5 ( $pw_code ) );
$email_templates = new DB;
if ( !$email_templates->open ( EMAIL_TEMPLATES ) ) { exit ( 'Unable to open email templates' ); }
$message = parse ( $email_templates->get ( 'email_header' ), '{username}', $user->get ( 'name' ) );
$message .= parse ( $email_templates->get ( 'password_request' ), array ( '{ip}' => $_SERVER['REMOTE_ADDR'], '{reset_url}' => $UPL['SETTINGS']['uploader_url'] . 'account.php?action=resetpassword&userid=' . $userid . '&code=' . $pw_code ) );
$message .= $email_templates->get ( 'email_footer' );
send_email ( $user->get ( 'email' ), $lang_account['pass_email_sub2'], $message, 'From: Uploader Admin <' . $UPL['SETTINGS']['email'] . '>' );
// save it!
$user->save ( );
}
else
{
exit ( 'Unable to load user data for userid ' . $userid );
}
}
}
// errors?
if ( $err == 'none' )
{
$tpl_message->set ( 'message', parse ( $lang_account['pass_sent'], '{username}', $user->get ( 'name' ) ) );
$tpl_message->set ( 'back_url', 'account.php?action=login' );
$tpl_uploader->setr ( 'content', $tpl_message );
$tpl_uploader->display ( );
}
else
{
// display form again with error messages
$tpl_error->set ( 'error', $err );
$tpl_pass->setr( 'error', $tpl_error );
$tpl_uploader->set ( array ( 'page_title' => $lang_misc['error'], 'content' => &$tpl_pass ) );
$tpl_uploader->display ( );
}
}
else
{
// show form for user to enter email address
$tpl_uploader->setr ( 'content', $tpl_pass );
$tpl_uploader->display ( );
}
}
break;
{
$tpl_pass = new Template ( TPL_DIR . 'tpl_password.php' );
if ( $task == 'password' )
{
if ( $demo ) exit ( 'Demo only!' );
// Get user info
$email = trim ( gpc ( 'email', 'P' ) );
$err = 'none';
if ( $email == '' )
{
$err = $lang_account['pass_no_email'];
}
else
{
// search for user from the emails index
$emails_idx = new Index;
$emails_idx->open ( EMAILS_INDEX );
$userid = $emails_idx->search ( strtolower ( $email ) );
if ( $userid === false )
{
$err = $lang_account['pass_email_not_found'];
}
else
{
$user = new User;
if ( $user->open ( $userid ) )
{
// generate random password code and send it to the user to make sure that the user did indeed request for password reset
$pw_code = get_rand ( 50 );
$user->set ( 'xtr_password_code', md5 ( $pw_code ) );
$email_templates = new DB;
if ( !$email_templates->open ( EMAIL_TEMPLATES ) ) { exit ( 'Unable to open email templates' ); }
$message = parse ( $email_templates->get ( 'email_header' ), '{username}', $user->get ( 'name' ) );
$message .= parse ( $email_templates->get ( 'password_request' ), array ( '{ip}' => $_SERVER['REMOTE_ADDR'], '{reset_url}' => $UPL['SETTINGS']['uploader_url'] . 'account.php?action=resetpassword&userid=' . $userid . '&code=' . $pw_code ) );
$message .= $email_templates->get ( 'email_footer' );
send_email ( $user->get ( 'email' ), $lang_account['pass_email_sub2'], $message, 'From: Uploader Admin <' . $UPL['SETTINGS']['email'] . '>' );
// save it!
$user->save ( );
}
else
{
exit ( 'Unable to load user data for userid ' . $userid );
}
}
}
// errors?
if ( $err == 'none' )
{
$tpl_message->set ( 'message', parse ( $lang_account['pass_sent'], '{username}', $user->get ( 'name' ) ) );
$tpl_message->set ( 'back_url', 'account.php?action=login' );
$tpl_uploader->setr ( 'content', $tpl_message );
$tpl_uploader->display ( );
}
else
{
// display form again with error messages
$tpl_error->set ( 'error', $err );
$tpl_pass->setr( 'error', $tpl_error );
$tpl_uploader->set ( array ( 'page_title' => $lang_misc['error'], 'content' => &$tpl_pass ) );
$tpl_uploader->display ( );
}
}
else
{
// show form for user to enter email address
$tpl_uploader->setr ( 'content', $tpl_pass );
$tpl_uploader->display ( );
}
}
break;