Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 08-25-2002, 05:33 PM
isman isman is offline
 
Join Date: Nov 2001
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default What's wrong with this code?

This little tidbit of code is part of the IB3 import script. It's supposed to email the imported users their new password but the username and password fields are blank.

I've been racking my brain on this for two days and can't figure it out. I was hoping a fresh pair of eyes might be able to spot it.
Code:
if ($action == "passwords") {
$emailmessage =
"Hello,

Today $bbtitle has been upgraded blah blah blah. Your new password is below:

Username: \$username
Password: \$password

You can change the password at this address:

$bburl/usercp.php

Thank you for your co-operation, and apologies for any inconvenience caused.

Best Regards,

$bbtitle Team";

	doformheader("bbimport_ib3", "dopasswords");
	maketableheader("Step 8: Update User Passwords");
	makehiddenfields();
	makedescription("Ikonboard uses a non-reversible password encryption blah blah blah");
	maketextareacode("Email Subject", "emailsubject", "$bbtitle Password Update");
	maketextareacode("Email To Send", "emailmessage", stripslashes($emailmessage));
	makeinputcode("Number of users to email per cycle:","perpage","25");
	makeyesnocode("Send Emails (set to no if you are testing)", "reallysend", "1");
	makedescription("If you want to skip this step, please click ".makelinkcode("here", "bbimport_ib3.php?action=cleanup"));
	doformfooter("Send Emails");
}

if ($action == "dopasswords") {
	if ($startat=="") {
		$startat = 0;
	}

	$users = $DB_site->query("SELECT * FROM user WHERE importuserid <> '' LIMIT $startat,$perpage");
	if ($DB_site->num_rows($users)) {

		while ($user = $DB_site->fetch_array($users)) {
			
			// make random number
			mt_srand ((double) microtime() * 1000000);
			$newpassword=mt_rand(0,100000000);

			$DB_site->query("UPDATE user SET password='$newpassword' WHERE userid='$user[userid]'");
			echo("User <i>$user[username]</i> updated...<br>");
			
			$sendmessage = str_replace("\$username",$user[username],$emailmessage);
			$sendmessage = str_replace("\$password",$newpassword,$emailmessage);
			
			if ($reallysend == 1) {
				mail($user[email], $emailsubject, $emailmessage, "From: \"$bbtitle Mailer\" <$webmasteremail>");
				echo("Mail sent to <i>$user[username]</i>...<br><br>");
			}
		}
		$startat+=$perpage;


			doformheader("bbimport_ib3","dopasswords");
			maketableheader("Update User Passwords");
			makehiddenfields();
			makehiddencode("emailmessage", $emailmessage);
			makehiddencode("emailsubject", $emailsubject);
			makehiddencode("startat", $startat);
			makehiddencode("perpage", $perpage);
			makehiddencode("reallysend", $reallysend);
			doformfooter("Do Next Page",0);
	} else {
		makedescription("Password update complete.");
		$action = "cleanup";
	}
}
Reply With Quote
  #2  
Old 08-26-2002, 07:07 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1- Remove \ from \$username and \$password..

2- If this does not work insert
echo 'username='.$username.'<br>';
echo 'password='.$password.'<br>';

lines right after

if ($action == "passwords") {

and see if the variables are set correctly before being processed (if not you may need to "globalize" them)

3- Your message would well fit in "Help me Finish" or "PHP" boards rather than requests..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:51 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.03948 seconds
  • Memory Usage 2,166KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete