Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Concerning register.php in Fusion8

Asked Modified Viewed 1,166 times
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
asked
Senior Member

I need help with this. When a new user registers: code from register.php
 if (dbrows($result) > 0) {
 add_to_title($locale['global_200'].$locale['u155']);

 $data = dbarray($result);
 -----------------> $user_info = unserialize(base64_decode(($data['user_info']))); <------------------

 $result = dbquery("INSERT INTO ".DB_USERS." (".$user_info['user_field_fields'].") VALUES (".$user_info['user_field_inputs'].")");
 $result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['code']."' LIMIT 1");

 opentable($locale['u155']);
 if ($settings['admin_activation'] == "1") {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u162']."<br /><br />n</div>n";
 } else {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u161']."<br /><br />n</div>n";
 }
------------------------> include BASEDIR."welcome_letter.php"; <-------------------
 closetable();
 } else {
 redirect("index.php");
 }

I have annotated the info in question. I need to know if it's possible and proper to do this in my welcome_letter.php script:
   $to_email = $user_info['user_email'];
   $to_name = $user_info['user_name'];

After the user receives the notice that they are now registered and can login I want to send them a welcome letter.
Edited by Chan on 09-02-2023 06:40,
0 replies

12 posts

M
MathiasHU
M
https://fusion.bltfm.hu/
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 3 threads in the forums
  • Answered 1 question
answered
Junior Member

0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

Maybe I'll take a look at it and see if I can use any of it. But I'm on Fusion8.
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

That doesn't help me a bit. Thanks for trying.
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

Still trying. Please tell me what is wrong with this code I added in register.php:
 if (dbrows($result) > 0) {
 add_to_title($locale['global_200'].$locale['u155']);
 $data = dbarray($result);
 $user_info = unserialize(base64_decode(($data['user_info'])));
 $result = dbquery("INSERT INTO ".DB_USERS." (".$user_info['user_field_fields'].") VALUES (".$user_info['user_field_inputs'].")");
    $lastid = db_lastid();
 $result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['code']."' LIMIT 1");
opentable($locale['u155']);
 if ($settings['admin_activation'] == "1") {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u162']."<br /><br />n</div>n";
 } else {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u161']."<br /><br />n</div>n";
   }
      $result = dbquery("SELECT user_name, user_email FROM ".DB_USERS." WHERE user_id = '".$lastid."'");
         while ($data = dbarray($result)) {
         $email = $data['user_email'];
         $name = $data['user_name'];
      include BASEDIR."welcome_letter.php";
   }
closetable();

And in the welcome_letter.php besides the html content I have this:
<?php
require_once INCLUDES."sendmail_include.php";
   $to_name = $name;
   $to_email = $email;
   $subject = "Letter of Welcome";
$content
   $message = $content;
   $from_name = "Tom Wills";
   $from_email = 'twills@ohs1962.org';

      sendemail($to_name, $to_email, $from_name, $from_email, $subject, $message, $type = "html", $cc = "", $bcc = "terry@whisperwillow.com");
?>
Edited by Grimloch on 07-02-2023 16:05,
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

What's in $user_info ? if it contains user name and user email you can use it without doing anything else.
I cannot see anything wrong without the array debug output except for the reliance of dblastid in the last query. We have also mentioned before that lastid is unreliable if server lags.
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

The db_lastid (which is the way it is in ver8) works fine I tested it. It does grab the last username and email that was inserted from users table. The problem is it just refuses to send the email; no error codes in the log. I'm still plugging away at it but so far no luck.
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

When I submit the registration it gives the proper message on the screen. But then when I click the link in the verification email that I get this is the result on the website. The email that I am trying to send never comes through.
Grimloch attached the following image:
Image not found
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

I just do not understand why this won't work. I spent some time cleaning up and simplyfying the code. The end result is still the same (see image in previous post); user is validated and confirmed but no welcome email is sent. Here is the code now:
 if (dbrows($result) > 0) {
 add_to_title($locale['global_200'].$locale['u155']);
 $data = dbarray($result);
 $user_info = unserialize(base64_decode(($data['user_info'])));
 $result = dbquery("INSERT INTO ".DB_USERS." (".$user_info['user_field_fields'].") VALUES (".$user_info['user_field_inputs'].")");
         $lastid = db_lastid();
 $result = dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_code='".$_GET['code']."' LIMIT 1");
opentable($locale['u155']);
 if ($settings['admin_activation'] == "1") {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u162']."<br /><br />n</div>n";
 } else {
 echo "<div style='text-align:center'><br />n".$locale['u171']."<br /><br />n".$locale['u161']."<br /><br />n</div>n";
   }
// New coding to send welcome letter
      $result = dbquery("SELECT user_name, user_email FROM ".DB_USERS." WHERE user_id = '$lastid'");
         while ($data = dbarray($result)) {
         $email = $data['user_email'];
         $name = $data['user_name'];

require_once INCLUDES."sendmail_include.php";

      $to_name = $name;
      $to_email = $email;
      $from_name = "xxx xxxx";
      $from_email = "xxxx@xxxx";
      $subject = "Letter of Welcome";
      include "welcome_tpl.php";
      sendemail($to_name, $to_email, $from_name, $from_email, $subject, $message, $type = "html");
}
// End new welcome letter coding
closetable();

The 'welcome_tpl.php' is a non-image html template in the root folder from my newsletters infusion that I have used successfully for many years now. I do not suspect a problem there. Can someone please try to help me with this. It's the final step in making my friends closed membership alumni website complete. It would be greatly appreciated!
Edited by Grimloch on 09-02-2023 14:52,
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

Well my friends it now works like a charm! I have never been afraid of admitting when I am wrong and this time is no exception! I had multiple errors in my template file. No errors in Fusion and I discovered them by looking at the Host error log. Anyway this puppy can be put to bed!
0 replies
M
MathiasHU
M
https://fusion.bltfm.hu/
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 3 threads in the forums
  • Answered 1 question
answered
Junior Member

Have you created a new user?
1 reply
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

To anyone running a version 8 site. If you might be interested in doing this just PM me and I can supply you with all the details not shown here.
0 replies
M
MathiasHU
M
https://fusion.bltfm.hu/
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 3 threads in the forums
  • Answered 1 question
answered
Junior Member

It works, I get a welcome email

            // New coding to send welcome letter
 $result = dbquery("SELECT user_name, user_email FROM ".DB_USERS." WHERE user_id = '".$lastid."'");
 while ($data = dbarray($result)) {
 $email = $data['user_email'];
 $name = $data['user_name'];

require_once INCLUDES."sendmail_include.php";

 $to_name = $name;
 $to_email = $email;
 $from_name = $settings['siteusername'];
 $from_email = $settings['siteemail'];
 $subject = "Letter of Welcome ".$lastid."";
      $message = "Letter of Welcome test message";
 //include "welcome_tpl.php";

 sendemail($to_name, $to_email, $from_name, $from_email, $subject, $message, $type = "html");

}
// End new welcome letter coding
0 replies

Category Forum

User Administration - 8

Statistics

  • Views 0 views
  • Posts 12 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
G
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
M
M
https://fusion.bltfm.hu/
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 3 threads in the forums
  • Answered 1 question

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet