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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 697
  • Total: 697

[Done!] Join Us! form

Started by mebymyself, October 19, 2006, 08:10:13 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Assistance


mfKG

#91
Quote from: dapoppet on January 04, 2007, 12:34:28 AM
This actually posts to the forum, but it does not redirect to the thank you article.Ã,  I get a 404 error for index.php?page=11.

i've manged this on another way:
i made anyway a costum action for the formular with a template.

in the code i added after:
if ($enable_post)
Ã,  Ã,  Ã,  Ã,  createPost($msgOptions, $topicOptions, $posterOptions);

this:

echo
'
<br />
<p align="center">
BlaBlaBla, '.$_POST['name'].'.
<br />
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, Ã,  BlaBlaBla
<br />
THX u 4 filling out the apllication BlaBla
</p>
';
RETURN;

So it's "all in one" ;)
Works nice for me

i needed to this that way, coz the method with remember the <textarea> input dont works that way like the <input> (with the value, needed to do else). after i corrected this, the article "messed up up" then. postet this time ago....
but so it works like a charme ;)

dapoppet

Thanks so much for the replies.  I got it to work!

mfKG

does perhaps someone know, how i get the Post ID of the new created Post?
coz i wanna redirect after the "Thx u page" to his application-post.

Ryushi32

I was wondering how to create a poll in the post with the application

iowamf

#95
I was interested in the code that posts the output of a PHP form into the forum - works! Thanks ...

One issue -> I changed the $board_id to a highly restricted board and found that this script could post into that board (even though the user filling out the form cannot access that board).  I don't consider this a bug - I think it is a feature - but it did surprise me that this would work. 

If someone cares to explain why this script allows a user to post into a board they do not have access to - I would love to hear the answer.

PS - even a guest can post to restricted boards with this form.

iowamf

btw, the script assumes SMF is installed in the root directory.
If you installed SMF in a subdirectory, you have to change a couple lines of code that reference the path.

mfKG

Quote from: iowamf on February 05, 2007, 08:38:40 AM
One issue -> I changed the $board_id to a highly restricted board and found that this script could post into that board (even though the user filling out the form cannot access that board).  I don't consider this a bug - I think it is a feature - but it did surprise me that this would work. 

thats simple, isnt it.....u take the function "createPost", which creates just the Post. But u dont check if the user have the right to Post in this Board(s) ;) ^^ that u need to do before, if u want....

alan s

Oh god...........why does everything go wrong for me! lol

I get this error

Fatal error: Call to undefined function: createpost() in /home/alan/public_html/beboskinzone.com/forum/Sources/Load.php(1733) : eval()'d code(231) : eval()'d code on line 126

using this code





//post the application on forum?
$enable_post=true;

//board id to which the application should be posted
$board_id=5;

//the id of the this article
$this_article_id = '7';

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


//END OF CONFIGURATION SECTION

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

// Check required fields
$enroll_errors = array(); //Initialize error array

// Check for a name
if (empty($_POST['real_name']) ){
$enroll_errors[] = 'You forgot to enter the Authors name.';
}
// Check for an email
if (empty($_POST['email']) ){
$enroll_errors[] = 'You forgot to enter your skin theme.';
}
// Check for an AA name
if (empty($_POST['aa_name']) ){
$enroll_errors[] = 'You forgot to enter the Skin name.';
}

if (empty($enroll_errors)) { //Everything seems to be OK

        $show_form='false';



// email an application

$subject = 'Enrollment Application';
$body = 'Enrollment application has been made by ' . $context['user']['name'] .
' from IP Address ' . $user_info['ip'] . '
Real Name:  ' . $_POST['real_name'] . '
Email address:  ' . $_POST['email'] . '
Current Game Name:  ' . $_POST['aa_name'] . '
Age:  ' . $_POST['age'] . '
Gender: ' . $_POST['gender'] . '
Location:  ' . $_POST['location'] . '
Current Honor:  ' . $_POST['honor'] . '
Previous clan(s):  ' . $_POST['prev_clans'] . '
Banned from any sever:  ' . $_POST['banned'] . '
Registered with AAOTracker? ' . $_POST['aaotracker'] . '
AAOTracker name:  ' . $_POST['aaotracker_name'] . '
Registred with X-fire?  ' . $_POST['xfire'] . '
X-Fire Account:  ' . $_POST['xfire_name'] . '
TeamSpeak installed?:  ' . $_POST['ts'] . '
Have microphone/headset:  ' . $_POST['mic'] . '
Would like to help pay for a server?: ' . $_POST['pay'] . '
Why do you want to join our clan?  ' . $_POST['why'] . '
Gaming habbits:   ' . $_POST['habbits'] . '
Other information:  ' . $_POST['other'];

$postbody = 'Enrollment application has been made by ' . $context['user']['name'] .'<br />
<table>
<tr><td>Real Name:<td></td><td>  ' . $_POST['real_name'] . '</td></tr>
<tr><td>Email address:<td></td><td>  ' . $_POST['email'] . '</td></tr>
<tr><td>Current Game Name:<td></td><td>  ' . $_POST['aa_name'] . '</td></tr>
<tr><td>Age:<td></td><td>  ' . $_POST['age'] . '</td></tr>
<tr><td>Gender: <td></td><td>' . $_POST['gender'] . '</td></tr>
<tr><td>Location:<td></td><td>  ' . $_POST['location'] . '</td></tr>
<tr><td>Current Honor: <td></td><td> ' . $_POST['honor'] . '</td></tr>
<tr><td>Previous clan(s): <td></td><td> ' . $_POST['prev_clans'] . '</td></tr>
<tr><td>Banned from any sever: <td></td><td> ' . $_POST['banned'] . '</td></tr>
<tr><td>Registered with AAOTracker? <td></td><td>' . $_POST['aaotracker'] . '</td></tr>
<tr><td>AAOTracker name:  <td></td><td>' . $_POST['aaotracker_name'] . '</td></tr>
<tr><td>Registred with X-fire? <td></td><td> ' . $_POST['xfire'] . '</td></tr>
<tr><td>X-Fire Account: <td></td><td> ' . $_POST['xfire_name'] . '</td></tr>
<tr><td>TeamSpeak installed?: <td></td><td> ' . $_POST['ts'] . '</td></tr>
<tr><td>Have microphone/headset: <td></td><td> ' . $_POST['mic'] . '</td></tr>
<tr><td>Would like to help pay for a server?:<td></td><td> ' . $_POST['pay'] . '</td></tr>
<tr><td>Why do you want to join our clan? <td></td><td> ' . $_POST['why'] . '</td></tr>
<tr><td>Gaming habbits: <td></td><td> ' . $_POST['habbits'] . '</td></tr>
<tr><td>Other information: <td></td><td> ' . $_POST['other']. '</td></tr>
</table>';



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



//create new forum post with application

$msgOptions = array(
'id' =>  0 ,
'subject' => '[Skin] ' . $context['aa_name'],
'body' => $postbody ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => 0 ,
'board' => $board_id,
'poll' =>  null,
'lock_mode' =>  null,
'sticky_mode' =>  null,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $context['user']['id'],
'name' => $context['user']['name'],
'email' => $user_info['email'],
'update_post_count' => true,
);

if ($enable_post)
        createPost($msgOptions, $topicOptions, $posterOptions);
         echo
'
<br />
<p align="center">
BlaBlaBla, '.$_POST['name'].'.
<br />
                       BlaBlaBla
<br />
THX u 4 filling out the apllication BlaBla
</p>
';
RETURN;
// Redirect to thank you page
header('Location: http://' . $_SERVER['HTTP_HOST'] .'/index.php?page=' . $thank_you_article_id);

} else {
// Redirect to error page
//header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?page=' . $enroll_error_article_id );
echo '<h2 class="error">Error!</h2>';
echo '<p class="error">The following error(s) occured:<br />';

foreach ($enroll_errors as $msg) {
echo " - $msg<br />";
}
   echo "<p>Please, correct all errors and try again.</p>" ;



}
}
//else { // Display the form

echo '
<form action="index.php?page='  . $this_article_id  . '" 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 = "200px">Authors Name :</TD>
<TD><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 = "200px">Skin Theme :</TD>
<TD><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 = "200px">Skin Name :</TD>
<TD><INPUT id="aa_name" name="aa_name" type="text" value ="';
if (isset($_POST['aa_name'])) echo $_POST['aa_name'];
echo '" /></TD>
</TR>
<TR class ="windowbg2">
<TD width = "200px">ScreenShot :</TD>
<TD><INPUT id="age" name="age" type="text" value ="';
if (isset($_POST['age'])) echo $_POST['age'];
echo '" /></TD>
</TR>

<TR class ="windowbg2">
<TD width = "200px">Download :</TD>
<TD><INPUT id="location" name="location" type="text" value ="';
if (isset($_POST['location'])) echo $_POST['location'];
echo '" /></TD>
</TR>

<TR class ="windowbg">
<TD width = "200px">Any other information you want to add about the skin? :</TD>
<TD><TEXTAREA id="other" name = "other" rows="4" cols="40" value ="';
if (isset($_POST['other'])) echo $_POST['other'];
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>

';




Line 126 = createPost($msgOptions, $topicOptions, $posterOptions);

Any ideas?

jacortina

Try a require_once for Sources/Subs-Post.php perhaps (that's where that function is defined)?

This website is proudly hosted on Crocweb Cloud Website Hosting.