Page 1 of 1

Phpbb3 online form post...

Posted: Sun May 24, 2009 4:05 pm
by Alterno
Greetings,

I was wondering if is possible to create an online form integrating the phpbb3 technology to it. What I'm looking forward to do is create an application form that post every field into a post in X forum once he submit the information..

Or I would like to use the custom regristration field to be posted in the application forum, can it be done?

Re: Phpbb3 online form post...

Posted: Sun May 24, 2009 4:24 pm
by ameeck
This is probably the definition of a spambot :)

Re: Phpbb3 online form post...

Posted: Sun May 31, 2009 11:07 am
by Alterno
ameeck wrote:This is probably the definition of a spambot :)
????

Re: Phpbb3 online form post...

Posted: Sun May 31, 2009 11:08 am
by Alterno
well I all i want is some users to fill some fields and after they click submit... they'll be posted @ a forum. Something like this http://www.phpbb.com/community/viewtopic.php?t=289814, but for phpbb.

Re: Phpbb3 online form post...

Posted: Sun May 31, 2009 12:01 pm
by Typo
I get it, you want to be able to use a standard form on a non-phpbb page that will take the info and post it into your phpbb3 forum. Am I on the right track?

If I am guessing correctly, a proper example for instance, would be....lets say the user had a portal, they could have a contact the admin form that asks for name, problem and then lets u post a message, u fill it out, hit submit and it takes the info and posts it as a new topic in a forum.

Typo

Re: Phpbb3 online form post...

Posted: Sun Jun 07, 2009 8:46 pm
by Chukibu
I found this online, Fragnader made it, so all credit to him.

I'm not very familiar with phpbb, as I just switched over from SMF. But it doesn't seem to be able to recognize if you're logged in. Other than that, it seems to work just fine (Removing the part checking if you were logged in, I was able to use the form to post Anonymously).

If anyone could take a look and see how to fix it, would appreciate it.

Here's the two files:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);


// Start session management
$user->session_begin();
$auth->acl($user->data);

if ($user->data['username'] == "Anonymous" || $user->data['username']== "Guest")
{
echo "Please Login to the forums and try again.";
}
//echo "<script type=\"text/javascript\">".
//"window.close();".
//"</script>";
else
{
echo "<html>
<head><title>America's Army Application Form</title></head>
<body>
<form action='poster.php' method='post'>
Enter your America's Army Username: <input type='text' size='25' name='username' /><br>
Enter your PB Guid: <input type='text' MAXLENGTH='32' size='40' name='guid' /><br>
Enter your Age: <input type='text' MAXLENGTH='2'size='2' name='age' /><br>
Enter your Tracker ID: <input type='text' name='trackid' /><br>
Do you have a mic? <input type='text' name='mic' /><br>
Do you have Vent? <input type='text' name='vent' /><br>
Have you ever been banned by an Anti Cheating Community. If yes, Why? <input type='text' name='banned' /><br>
Why do you want to join this clan: <input type='text' name='reason' /><br>
If someone invited you to join the clan, please state his/her name: <input type='text' name='ref' /><br><br>
<input type='submit' />
</form>
</body>
</html>";
}


?>

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);

//Yeah, I know this is not needed but I did it for simplicity
$username = $_POST["username"];
$guid = $_POST["guid"];
$age = $_POST["age"];
$tracker = $_POST["trackid"];
$microphone = $_POST["mic"];
$vent = $_POST["vent"];
$banned = $_POST["banned"];
$reason = $_POST["reason"];
$ref = $_POST["ref"];
$ip = $_SERVER["REMOTE_ADDR"];

$message = "AA Username: $username
PB Guid: http://www.hazardaaclan.com/history/accounthistory.php?guid=$guid
Age: $age
Tracker ID: http://aaotracker.com/usertracker.php?userid=$tracker
Mic? $microphone
Ventrilo? $vent
Banned? $banned
Reason for wanting to join? $reason
Refered by: $ref";

$time = time();

// note that multibyte support is enabled here
$rawsubject = "Americas Army Application for $username";
$my_subject	= utf8_normalize_nfc($rawsubject, '', true);
$my_text	= utf8_normalize_nfc($message, '', true);

// variables to hold the parameters for submit_post
$poll = $uid = $bitfield = $options = ''; 

generate_text_for_storage($my_subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($my_text, $uid, $bitfield, $options, true, true, true);

$data = array( 
	'forum_id'		=> 32,
	'icon_id'		=> false,

	'enable_bbcode'		=> true,
	'enable_smilies'	=> true,
	'enable_urls'		=> true,
	'enable_sig'		=> true,

	'message'		=> $my_text,
	'message_md5'	=> md5($my_text),
				
	'bbcode_bitfield'	=> $bitfield,
	'bbcode_uid'		=> $uid,

	'post_edit_locked'	=> 0,
	'topic_title'		=> $my_subject,
	'notify_set'		=> false,
	'notify'			=> false,
	'post_time' 		=> 0,
	'forum_name'		=> '',
	'enable_indexing'	=> true,
);

submit_post('post', $my_subject, $user->data['username'], POST_NORMAL, $poll, $data);

echo "Application Submitted, You may close this window.";

?>

Re: Phpbb3 online form post...

Posted: Mon Aug 24, 2009 10:48 am
by eklisiarh
I also need this! Bump

Re: Phpbb3 online form post...

Posted: Tue Aug 25, 2009 3:11 am
by tsavory
I also need something like this or even a way to make every reply in a certain topic contain the certain set of text such as in forum a the topic is info for requesting an online survey reason title a list of questions and answers every time someone hit the reply they get text already asking the reason the title and a list of questions and answers
and this only shows up in the topic in question

Re: Phpbb3 online form post...

Posted: Fri Nov 06, 2009 8:55 pm
by chainprayer
Anybody have luck with the code above? I need the same thing for an osx dashboard widget im making for my site

Re: Phpbb3 online form post...

Posted: Sat Nov 07, 2009 5:17 am
by chainprayer
Thanks for the code! I applied it to my widget and have it working perfectly now!

Re: Phpbb3 online form post...

Posted: Mon Nov 01, 2010 9:34 am
by Tim81
I would be also interested in this type of form - however I need my users to be logged in, so no anonymous fillouts. The topic it will create would be on a forum that is not (yet) visible to the users, only to administrators / and users that have permission for that.