Jump to content

I-AM-OBODO

Members
  • Posts

    439
  • Joined

  • Last visited

Everything posted by I-AM-OBODO

  1. Thanks. I have just modified the code. But I'm not sure if i got the ClearAddresses() method usage correctly.
  2. Ok. Thanks guys. i've modified the code. But @mac_gyver I'm not sure how to use the ClearAddresses() method. Hope what i did is right. @jacques1, i know sending all the mails at once will curse flooding, was thinking i'd find a way around that later but thanks for reminding. but how will the script know the first hundred mails it has sent? or does it mean i will have to create another table so that after sending a 100 it marks them as sent/1 as the case maybe it updates the table column and loop again for those not sent. another problem i envisage is the time when the script needs to run again cos there's limit it can run for x hour. Thanks my modified code if(isset($_POST['send_reminder'])){ $sql = "SELECT * FROM users WHERE status = '$status' LIMIT 100"; $stmt = $pdo->query($sql); $stmt->execute(); $message="Hello $name,<br> <p> This is to remind you that your subscription will expire in $expiry_day. </p> <p> Details as follows: Name: $name<br> Account Number: $acct_no<br> Email: $email_addresses<br> Expire in days: $expiry_day<br> Expiry Date: $expiry_date </p> <p> Thank you </p> "; $mail = new PHPMailer; //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.server.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'mails@services.cap'; // SMTP username $mail->Password = 'password'; // SMTP password $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 465; // TCP port to connect to $mail->From = 'mails@services.cap'; $mail->FromName = 'Club 404'; $mail->WordWrap = 587; // Set word wrap to 50 characters $mail->AddEmbeddedImage('../img/logo.png', 'my_logo'); $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'REMINDER ON CLUB EXPIRY DATE'; while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ $name = $row['name']; $acct_no = $row['acct_no']; $email_addresses = $row['email']; $expiry_date = $row['expiry_date']; $expiry_day = $row['expiry_day']; //$mail->addAddress($email_addresses); // Add a recipient $mail->ClearAllRecipients($email_addresses);// not too sure how to use it $mail->Body = $mess; if(!$mail->send()) { echo 'Problem sending message.'; } else { echo 'Message has been sent successfully'; } } }
  3. Hi all. How can i send mail to multiple users at the same time with each user getting their own related data. I'm using php mailer as an engine to send the mail. Based on this, i'd have loved to setup a cron for it but i do not know how, so i figure i'd just do it manually before i get to know how to setup a cron job. It's just to send a reminder to users and each user has a different subscription expiry time. I want each user to get their respective expiration date, expiry day etc. Thanks if(isset($_POST['send_reminder'])){ $sql = "SELECT * FROM users WHERE status = '$status'"; $stmt = $pdo->query($sql); $stmt->execute(); while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ $name = $row['name']; $acct_no = $row['acct_no']; $email_addresses = $row['email']; $expiry_date = $row['expiry_date']; $expiry_day = $row['expiry_day']; } $message="Hello $name,<br> <p> This is to remind you that your subscription will expire in $expiry_day. </p> <p> Details as follows: Name: $name<br> Account Number: $acct_no<br> Email: $email_addresses<br> Expire in days: $expiry_day<br> Expiry Date: $expiry_date </p> <p> Thank you </p> $mail = new PHPMailer; //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.server.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'mails@services.cap'; // SMTP username $mail->Password = 'password'; // SMTP password $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 465; // TCP port to connect to $mail->From = mails@services.cap'; $mail->FromName = 'Club 404'; $mail->addAddress($email_addresses); // Add a recipient $mail->WordWrap = 587; // Set word wrap to 50 characters $mail->AddEmbeddedImage("../img/logo.png", "my_logo"); $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'REMINDER ON CLUB EXPIRY DATE'; $mail->Body = $mess; $mail->send(); }
  4. nope dont have it as the account was merged. and i cant find the new one u sent either cos no message view enabled. thanks
  5. Thanks. But you still did not mention which is best?
  6. Thanks all. My Mistake. And i have implemented a different case similar to what Ch0cu3r suggested. What i did was create a column with default value as "NONE" so when the delete command is issued, instead of deleting it updates the "NONE" to "DELETED" so that should i want to issue a query of deleted records, i just use a where delete_status = 'DELETED' and to view all the records: where delete_status = "NONE". It works fine but i dunno if it has any side effect. What's the advantage one has over the other (moving to another table and updating/creating another column)? Thanks all again!!!!!
  7. I tried below but still wouldnt work $checkbox_ids = implode(',', $_POST['check_list']); $sql = "INSERT INTO cash_user_deleted_transaction SELECT * FROM $tbl_name WHERE id IN($checkbox_ids)"; $stmt=$pdo->prepare($sql); $stmt->execute(); if($stmt-.rowCount()){ echo "inserted"; }else{ echo "not inserted"; }
  8. $checkbox_ids = implode(',', $_POST['check_list']); $sql = "INSERT INTO cash_user_deleted_transaction SELECT * FROM $tbl_name WHERE id IN($checkbox_ids)"; Does this mean the insert statement here dont need the "values" attributes? will give it a go, thanks
  9. Hello admin, I dunno why i cannot login into my account. This is the 3rd time it's happening and even when i reset password, i dont get a mail from phpfreaks. Pls help restore my account back and why does it keep happening? ps: why don't i get mail from phpfreaks? Thanks
  10. Hi all. I'm having an issue with my code. I dunno why it's not working as intended. I want to delete selected rows and insert them into another table just in case i want to recall them. So far the delete is working but i'm having two issues with it. 1. when i select 5 rows and press delete, it echos result for the 5 rows instead of just one echo result. 2. I cannot insert it into another table. Thanks here's my code <?php $stmt = $pdo->prepare( "SELECT * FROM $tbl_name ORDER BY trans_date DESC" ); $stmt->execute(); <form action="" method="post"> <table class='table-responsive table-condensed table-striped'> <tr> <td align="center" bgcolor="#444444"><font color='#fff'><strong>#</strong></font></td> <td align='center' bgcolor="#444444"><font color='#fff'>Client Username</font></td> <td align='center' bgcolor="#444444"><font color='#fff'>Loan Number</font></td> <td align='center' bgcolor="#444444"><font color='#fff'>Amount</font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>Repayment Amount</strong></font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>Loan Date</strong></font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>Due Date</strong></font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>BTN</strong></font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>FIN</strong></font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>Bank Acct Number</strong></font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>Date Closed</strong></font></td> <td align="center" bgcolor="#444444"><font color='#fff'><strong>Closed From</strong></font></td> </tr> <?php // keeps getting the next row until there are no more to get while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { ?> <tr> <td align="center"><input name="check_list[]" type="checkbox" value="<?php echo $row['id']; ?>" ></td> <td><?php echo $row['email']; ?></td> <td><?php echo $row['loan_number']; ?></td> <td><?php echo number_format($row['amount_borrow'],2); ?></td> <td><?php echo number_format($row['payback_amount'],2); ?></td> <td><?php echo $row['trans_date']; ?></td> <td><?php echo $row['payback_date']; ?></td> <td><?php echo $row['branch_transit_number']; ?></td> <td><?php echo $row['financial_institution_number']; ?></td> <td><?php echo $row['bank_account_number']; ?></td> <td><?php echo $row['date_closed']; ?></td> <td><?php echo $row['closed_from']; ?></td> </tr> <?php } ?> </table> <input name="delete" type="submit" class="btn btn-default btn-delete" id="delete" value="DELETE SELECTED"> </form> <?php if(isset($_POST['delete'])){ $table=$pdo->query("ALTER TABLE cash_user_transaction AUTO_INCREMENT = 1"); $table->execute(); if(!empty($_POST['check_list'])){ foreach($_POST['check_list'] as $selected){ $stmt = $pdo->prepare("SELECT * FROM $tbl_name WHERE id = '$selected'"); $stmt->execute(); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $email = $row['email']; $loan_number = $row['loan_humber']; $amount_borrow = $row['amount_borrow']; $terms_agreement=$row['terms_agreement']; $terms_agreement_days=$row['terms_agreement_days']; $cost_borrow=$row['cost_borrow']; $trans_date=$row['trans_date']; $payback_date=$row['payback_date']; $payback_amount=$row['payback_amount']; $branch_transit_number=$row['branch_transit_number']; $financial_institution_number=$row['financial_institution_number']; $bank_account_number=$row['bank_account_number']; $status=$row['status']; $initial=$row['initial']; $pay_frequency=$row['pay_frequency']; $refinance_request=$row['refinance_request']; $date_closed=$row['date_closed']; $disbursed_status=$row['disbursed_status']; $date_disbursed=$row['date_disbursed']; $closed_from=$row['closed_from']; } if($stmt->rowCount()){ $stmt = $pdo->prepare("INSERT INTO cash_user_deleted_transaction (email, loan_number, amount_borrow, terms_agreement, terms_agreement_days, cost_borrow, trans_date, payback_date, payback_amount, branch_transit_number, financial_institution_number, bank_account_number, status, initial, pay_frequency, refinance_request, date_closed, disbursed_status, date_disbursed, closed_from, date_deleted) VALUES(:email, :loan_number, :amount_borrow, :terms_agreement, :terms_agreement_days, :cost_borrow, :trans_date, :payback_date, :payback_amount, :branch_transit_number, :financial_institution_number, :bank_account_number, :status, :initial, :pay_frequency, :refinance_request, :date_closed, :disbursed_status, :date_disbursed, :closed_from, NOW())"); $stmt->execute(array( ':email'=>$email, ':loan_number'=>$loan_humber, ':amount_borrow'=>$amount_borrow, ':terms_agreement'=>$terms_agreement, ':terms_agreement_days'=>$terms_agreement_days, ':cost_borrow'=>$cost_borrow, ':trans_date'=>$trans_date, ':payback_date'=>$payback_date, ':payback_amount'=>$payback_amount, ':branch_transit_number'=>$branch_transit_number, ':financial_institution_number'=>$financial_institution_number, ':bank_account_number'=>$bank_account_number, ':status'=>$status, ':initial'=>$initial, ':pay_frequency'=>$pay_frequency, ':refinance_request'=>$refinance_request, ':date_closed'=>$date_closed, ':disbursed_status'=>$disbursed_status, ':date_disbursed'=>$date_disbursed, ':closed_from'=>$closed_from )); $stmt = $pdo->prepare("DELETE FROM $tbl_name WHERE id=:id"); $stmt->bindValue(':id', $selected, PDO::PARAM_STR); $stmt->execute(); echo "<div class='bg-success alert alert-success text-center'>RECORD DELETED</div>"; }else{ echo "<div class='bg-warning alert alert-warning text-center'>RECORD NOT DELETED</div>"; echo $pay_frequency; echo "<br>"; echo $status; echo "<br>"; echo $amount_borrow; } } } } ?>
  11. My directory structure app - Console -Events - Exeptions - Http - Jobs - Listeners - Policies - Providers -- user bootstrap - cache -- app -- autoload config -- app -- auth -- broadcasting -- cache -- compile -- database -- filesystems -- mail -- queue -- services -- session -- view database - factories - migrations - seeds public - css - fonts - js -- htaccess -- favicon -- index -- robots resources - assets - lang - views storage - app - framework - logs tests - ExampleTest - TestCase vendor - so many folders
  12. My directory structure app - Console -Events - Exeptions - Http - Jobs - Listeners - Policies - Providers -- user bootstrap - cache -- app -- autoload config -- app -- auth -- broadcasting -- cache -- compile -- database -- filesystems -- mail -- queue -- services -- session -- view database - factories - migrations - seeds public - css - fonts - js -- htaccess -- favicon -- index -- robots resources - assets - lang - views storage - app - framework - logs tests - ExampleTest - TestCase vendor - so many folders
  13. On the network tab in chrome it's not showing any url at all. just blank but on view source localhost/laravel/index localhost/laravel/css/styles.css localhost/laravel/css/bootstrap.min.css localhost/laravel/css/bootstrap-theme.min.css localhost/laravel/js/bootstrap.min.js again i noticed it has 8 error notifications and when i checked, i saw that the path to my styles is not seen: Failed to load resource: the server responded with a status of 404 (Not Found) what could be wrong. but when i load the bootstrap style from the cdn, it works perfectly!!
  14. Hi all. No matter what i tried my links just wont work on my laravel app. My css folder is in the public folder. public/css. I dunno what is wrong. I installed laravel with composer and i am running windows 7 and wamp. this is the link i used: <link rel="stylesheet" href="{!! asset('css/bootstrap.min.css') !!}"> <link rel="stylesheet" href="{!! asset('css/styles.css') !!}"> Thanks
  15. Thanks all. Finally i got it to work. I noticed that the point where the regenerating starts is not the next page but on the first page (reason i don't understand though) I had to create a hidden field and assign the random number to it and then i did an insert with the post value and after that reassigned the value to a session. Viola! it did the magic! PS: The code shown is not the complete code but the modified code/logic that was giving me trouble and that worked the trouble. Here's my code $number = mt_rand(1000, 9999); $name = "John Doe"; echo $name; echo "<br>"; echo "Your tally nuber is: ". $number ; if(isset($_POST['submit'])){ //database insert stuff $_SESSION['numb'] = $_POST['numb']; header("location: nextpage.php"); }else{ echo "could not complete action"; } //html form <form method="post" action=""> <input name="numb" type="hidden" value="<?php echo $number; ?>"> <input name="submit" type="submit" value="NEXT" > </form> //page two session_start(); $number = $_SESSION['numb']; echo $number;
  16. i'm generating the number on the first page, see new code
  17. There seems to be a little problem with my first post but the problem still lingers. I generate the code on the first page so that it can pass on the value generated to the second page. here's a modification of my code //page one session_start(); //generate the number // i even tried $_SESSION['number'] = mt_rand(1000, 9999); but to no avail $number = mt_rand(1000, 9999); $name = "John Doe"; echo $name; echo "<br>"; echo "Your tally nuber is: ". $number ; if(isset($_POST['submit'])){ //database insert stuff $_SESSION['number'] = $number; header("location: nextpage.php"); }else{ echo "could not complete action"; } //html form cos <form method="post" action=""> <input name="submit" type="submit" value="NEXT" > </form> //page two session_start(); echo $_SESSION['number']; //but it regenerates another number
  18. yes. i have other session value and all is working well except this one. funny enough there's no code generating function on the next page. but why does it regenerate?
  19. Hi all. I generated a random number and assigned it a variable to be used through out the session but on getting to the next page, the value changes. It is regenerating another number which isnt the intention. I have tried severally but no way! i really cannot figure out why the value changes in my second page. $loan = mt_rand(1000, 9999); $name = "John"; if(isset($_POST['continue'])){ $_SESSION['num'] = $number; $sql = ("INSERT INTO table (name, token_number) VALUES(:name, :token_number) $stmt=$pdo->prepare($sql); $stmt->execute(array( ':name'=>$name; ':token_number'=>$_SESSION['num'] )); if($stmt->rowCount()==1){ header("location: nextpage.php"); }else{ echo "Something went wrong"; } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.