TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,993
  • Total Topics: 21,324
  • Online today: 322
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 205
  • Total: 205

invite friend

Started by falguni1, November 28, 2007, 07:54:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IchBin

But where is it going to inject it? Nothing is being stored. Its only emailed isn't it? I haven't looked to hard at the code either as you can tell. :)

Hairy

This snippet only emails but the join us snippet posts and/or emails so that one is probably a risk   :'(

Dragooon

You can also send insecure E-mails right....

Hairy

The email will attach the users IP (and account name if logged in) with Admin contact details.

Flood control via IP would be something that would be great to have for this, in the mean time it's best to restrict this block for members only until some more modifications are done to it.

chrishicks

Quote from: chrishicks on December 09, 2007, 02:54:34 PM

I get these errors in my forum log:

8: Undefined variable: user_info
File: /home/rejectsr/public_html/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 67

8: Undefined variable: this_article_id
File: /home/rejectsr/public_html/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 55

8: Undefined index: fmail
File: /home/rejectsr/public_html/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 21

8: Undefined variable: this_article_id
File: /home/rejectsr/public_html/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 55

8: Undefined variable: user_info
File: /home/rejectsr/public_html/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 39

anyone have any idea on how to fix these errors?

Hairy

#25
*Original code updated*

It appears there might be something with your TPortal.template.php that's having issues with this, You may want to ask in the support area (follow the posting guidelines there).

I did notice a reference to this_article_id was still in the code but is not needed in this snippet so I removed and tested and seems to be good, this will probably take your errors down to 3 lines instead of 5  :-\

Here is the revised:

global $user_info, $context, $settings ;


///////////////////////////
// CONFIGURATION SECTION //
///////////////////////////


//Website address
$website_address= 'http://www.yoursite.com';

//Admin email address
$admin_email_address= 'adminemail@yours.com';

//article to be redirected when form is submitted
$thank_you_article_id = '6';


/////////////////////////////////
//END OF CONFIGURATION SECTION //
/////////////////////////////////


$email_address= $_POST['fmail'];

$show_form= 'true';
if (isset($_POST['submitted'])) {
// Handle the form

// email the form

$subject = 'Invitation from ' . $_POST['real_name'] . '';
$body =
'Hello ' . $_POST['fname'] . '

' . $_POST['real_name'] . ' wanted to invite you to our community at ' . $website_address . '

Their message.....
"' . $_POST['message'] . '"


This email was generated by ' . $context['user']['name'] . ' from IP Address ' . $user_info['ip'] . ' via ' . $website_address . '
If this is spam or abusive, please report it to: ' . $admin_email_address . ' (please include a copy of this email)';



mail($email_address, $subject, $body,"From: " . $_POST['email']);

// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

}

//else { // Display the form
echo '
<br /><center>Invite A Friend</center><hr>';
echo '
<form method="post">
        <INPUT id="submitted" name="submitted" type="hidden" value="TRUE" />
<TABLE class = "bordercolor" cellSpacing="1" cellPadding="1" width="95%" border="0">
<TR class ="windowbg">
<TD width = "180px">Your Name<br />
<INPUT id="real_name" name="real_name" type="text" value ="';
if (isset($_POST['real_name'])) echo $_POST['real_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "180px">Your Email<br />
<INPUT id="email" name="email" type="text" value ="';
if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email']; 
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "180px">Friend\'s Name<br />
<INPUT id="fname" name="fname" type="text" value ="';
if (isset($_POST['fname'])) echo $_POST['fname'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "180px">Friend\'s Email<br />
<INPUT id="fmail" name="fmail" type="text" value ="';
if (isset($_POST['fmail'])) echo $_POST['fmail'];   
echo '" /></TD>
</TR>
<TR class ="windowbg">
<TD width = "180px">Your Message<br />
<TEXTAREA id="message" name = "message" rows="4" cols="20" value ="';
if (isset($_POST['message'])) echo $_POST['message'];   
echo '" ></' . 'TEXTAREA></TD>
</TR>
<TR class ="windowbg2">
<TD colspan="2" align="center">
<INPUT type="submit" value="Submit">
<INPUT type="reset" value="Reset"></TD>
</TR>
</TABLE>
</form>

';

Hairy

Also try this chrishicks:

Find if (isset($_POST['email'])) echo $_POST['email']; else echo $user_info['email'];

Replace with if (isset($_POST['email'])) echo $_POST['email'];

Not sure if that works, it should get rid of the user_info error messages for you.

dannbass

I know this is not for support, but I didn't know if I should open a new topic just for this error in my log...

8: Undefined index: fmail
In this line...
$email_address= $_POST['fmail'];
Thanks and sorry about that...

IchBin

You would only get that error if the friends email is not input and the form is submitted. (I think) ;)

dannbass

Thanks IchBinâ,,¢, but I have send a couple of tests and the went very smooth and all, and everything I open the front page, where the block is, one error is added to the log...

This is the complete error
8: Undefined index: fmail
Archivo: /www/f/o/r/o/c/o/n/t/forocontrabasso/htdocs/Themes/default/TPortalBlocks.template.php(35) : eval()'d code
Línea: 24

This website is proudly hosted on Crocweb Cloud Website Hosting.