I saw this site
http://path-to-peace.com/forum2/ :D
and I want this I saw :o
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fomsites.com%2Fomsaigan%2Findex.php%3Faction%3Ddlattach%3Btopic%3D607.0%3Battach%3D334%3Bimage&hash=e07ae085398deeed281cdbaf640c12eafc3f6d93)
I searched the block code snippets and could not find it how to get this :-\
I'll see if I can modify a different snippet to do something like this, I'm only new to this stuff so allow me some time falguni1 :)
hmmmm :D
thanks :)
OK here goes :-\
Try this and tell me what you think, make sure you change the admin email and website addresses!
It will also take the person to an article page after they use it, make an article to say thanks or something, it's currently set for article ID #6
//article to be redirected when form is submitted
$thank_you_article_id = '6';
Also a pic attached (colors adjusts to your theme)
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>
';
Edit: some more un-needed code removed
I thought I should post an example of the email it sends, (I have removed my IP from this image)
::)
It might not be as pretty as the original but I'm sure some people here might have fun improving it :up:
Cheers
PS. If anyone can think of a much better way to word the email it sends please say so and I'll quickly fix it. It's quite late here so I can not think good right now :uglystupid2:
Falguni, please do NOT post for support in the snippets board. I've told you before this, please post any requests in the REQUESTS board. Since you have a snippet now though, I'll leave it if it works for everyone.
I am very new to ALL of this and I'm not even sure yet what tiny portal does for SMF. But I do wonder - how would go about installing this little snippet code - or where?
Sorry if this request is in the wrong place - but it is my first post and I will 'get it' soon I hope :)
Thanks
Chris
cluksha, TP is a mod for SMF. If you read up in the Docs board you'll find a lot more info about TP. Any of the code snippets here can be added to a right/left/center block or even articles.
Hairy you are genius :D
it works so good and looks so nice :coolsmiley:
thankyou :)
one thing I noticed is that if you want to send email to someone you dont need to log to your email account, just fill this form and send it. :o
sounds lazy and quick ::)
Make sure you switch the block off for guests or it will get bombed.
Regards,
Wilsy.
Quote from: falguni1 on November 29, 2007, 05:52:47 AM
Hairy you are genius :D
it works so good and looks so nice :coolsmiley:
thankyou :)
No problem :)
Quote from: wilsy on November 29, 2007, 09:02:02 AM
Make sure you switch the block off for guests or it will get bombed.
Regards,
Wilsy.
I agree with that, maybe adding CAPTCHA and/or flood control could be a good way in keeping it open for guests.
Cheers
being a newbie with these codes can anyone tell me why I get this when I submit:
Not Found
The requested URL /index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I set up an article(article is #5) and I replaced the 6 in the code. is there something else I am supposed to do here that I am missing?
I'm not sure, maybe if your forum is in a different folder eg "/smf" or "/forum" you might need to change some of the code :-\
Find
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);
Replace the XXXXXXXX's with your forum folder:
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/XXXXXXXX/index.php?page=' . $thank_you_article_id);
Hope that helps!
Quote from: Hairy on December 09, 2007, 02:34:43 AM
I'm not sure, maybe if your forum is in a different folder eg "/smf" or "/forum" you might need to change some of the code :-\
Find
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);
Replace the XXXXXXXX's with your forum folder:
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/XXXXXXXX/index.php?page=' . $thank_you_article_id);
Hope that helps!
thank you. it did but now I have another problem(s). :(
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
hopefully this will be an easy fix as my members have been asking for an invite system for months.
ps. I thought I should add that even though I get the errors the invite actually does work.
There are a few problems,
1. It doesn't do any security checks, means anyone can inject JS or SQL injections. In Short, hack your forum.
2. No Captcha.
Not bragging or complaining, just telling the people about this.
I just adjusted the join us snippet http://www.tinyportal.net/index.php?topic=9840.msg84957#msg84957 so does that snippet allow hacking? if so I am going to need another join us form :buck2:
Ps. sorry I can't help with them errors :(
Quote from: Hairy on December 09, 2007, 03:30:30 PM
I just adjusted the join us snippet http://www.tinyportal.net/index.php?topic=9840.msg84957#msg84957 so does that snippet allow hacking? if so I am going to need another join us form :buck2:
Ps. sorry I can't help with them errors :(
nope, Security can be easily compromised there.
This isn't posting anything to the forum or saving anything to the database. What kind of hack are you thinking about Dragooon?
JavaScript injection....
I still am not 100% as I didn't had any time to see the code, just had a very very quick overview.
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. :)
This snippet only emails but the join us snippet posts and/or emails so that one is probably a risk :'(
You can also send insecure E-mails right....
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.
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?
*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>
';
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.
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...
You would only get that error if the friends email is not input and the form is submitted. (I think) ;)
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