私は自分で物事を学び、行うことを楽しんでいますが、修正方法がわからない漬物に遭遇しました。
ボタンを介して管理ページ内でアクティブ化できるアナウンスシステム用のphpマスメーラーを作成しようとしています。
現在のスクリプトは次のようになります。
function sendStreamAnnounce(){
global $database, $session, $mailer, $form;
$q = "SELECT username,email"
."FROM ".TBL_USERS."";
$result = $database->query($q);
$num_rows = mysql_numrows($result);
for($i=0; $i<$num_rows; $i++){
$email = mysql_result($result,$i,"email");
/* Attempt to send the email with new password */
if($mailer->sendStreamAnnounce($email))
$_SESSION['mailed'] = true;
else{
$_SESSION['forgotpass'] = false;
}
header("Location: ".$session->referrer);
}
}
現在の設定は私にこれを残します
私が使用しているチュートリアル風のバックエンドに付属している「パスワードを忘れた」phpスクリプトから、これをどうにかして適応させました。「$_SESSION」のようなものはおそらく必要ないだろうと思います。
どんな助けでも大歓迎です!多くの人がスプーンフィーディングを嫌うのを知っているので、ヒントは私にも大いに役立ちます。
よろしくお願いします!
編集:私は自分で/アルンの助けを借りてそれを修正しました!
function sendStreamNotice(){
global $database, $session, $mailer, $form;
$q = "SELECT username,email "
."FROM ".TBL_USERS."";
$result = $database->query($q);
$num_rows = mysql_num_rows($result);
if(!$result || ($num_rows < 0)){
echo "Error displaying info";
return;
}
if($num_rows == 0){
echo "Database table empty";
return;
}
for($i=0; $i<$num_rows; $i++){
$email = mysql_result($result,$i,"email");
$user = mysql_result($result,$i,"username");
/* Attempt to send the email with new password */
if($mailer->sendStreamNotice($user,$email))
$_SESSION['mailed'] = true;
else{
$_SESSION['forgotpass'] = false;
}
header("Location: ".$session->referrer);
}
}
メールはうまくいきました!