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,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 451
  • Total: 451

Generic Application Form

Started by JPDeni, May 23, 2009, 11:04:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JPDeni

I'm not sure about all this because I don't read Greek  (I'm assuming Greek because that's what the letters look like) and the text file shows different letters for the captions than you have. I'll try to figure out what's going on, but I'm not going to guarantee anything. :)

Because of the problems with the text, I won't post the whole code, but just the code you need to change.


foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= '<br />' . $field['caption'] . '<br /><br />';
elseif ($field['name'] == 'comments')
$postbody .= '[b]' . $field['caption'] . '[/b]: ' . $_REQUEST[$field['name']] . '<br />';
elseif ($field['name'] == 'overall')
$postbody .= $field['caption'] . ': [b]' . $_REQUEST[$field['name']] . '[/b]<br />';
else
$postbody .= '[b]' . $field['caption'] . ': [color=red]' . $_REQUEST[$field['name']] . '[/color][/b]<br />';
}

EasyRider

Ok! and.. were exactly  i m gone put this ^^^ code..??  ???
SMF  1.1.11 / TinyPortal v1.0 beta 4 /default theme

JPDeni

In the same place you put the other code.

Here's the whole section, but there's a line in there that you'll have to change back to your language.


if ($enable_post) {  //create new forum post with application



$topic = $_GET['topic'];
$result = db_query("SELECT m.subject
FROM {$db_prefix}messages as m, {$db_prefix}topics as t
WHERE m.ID_TOPIC = $topic
AND t.ID_FIRST_MSG = m.ID_MSG", __FILE__, __LINE__);

$row = mysql_fetch_assoc($result);
$subject = $row['subject'];
mysql_free_result($result);

$postbody = 'Åõ÷áñéóôïýìå ãéá ôçí êñéôéêÞ ' . $context['user']['name'] .'<br /><br/>';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= '<br />' . $field['caption'] . '<br /><br />';
elseif ($field['name'] == 'comments')
$postbody .= '[b]' . $field['caption'] . '[/b]: ' . $_REQUEST[$field['name']] . '<br />';
elseif ($field['name'] == 'overall')
$postbody .= $field['caption'] . ': [b]' . $_REQUEST[$field['name']] . '[/b]<br />';
else
$postbody .= '[b]' . $field['caption'] . ': [color=red]' . $_REQUEST[$field['name']] . '[/color][/b]<br />';
}
$msgOptions = array(
'id' =>  0 ,
'subject' => 'Re: ' . $subject,
'body' => addslashes($postbody) ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => $_GET['topic'] ,
'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,
);
createPost($msgOptions, $topicOptions, $posterOptions);
}


EasyRider

OKK..!!  i try it now..!!   :up:
SMF  1.1.11 / TinyPortal v1.0 beta 4 /default theme

EasyRider

#124
just PERFECT!! !!  :)  :) :) :) :)

i attach screen about what i print and what i thing is missing.  headers in bold, and space  between last caption and comments.


SMF  1.1.11 / TinyPortal v1.0 beta 4 /default theme

JPDeni

I thought I had done that. I guess not. :)


if ($enable_post) {  //create new forum post with application



$topic = $_GET['topic'];
$result = db_query("SELECT m.subject
FROM {$db_prefix}messages as m, {$db_prefix}topics as t
WHERE m.ID_TOPIC = $topic
AND t.ID_FIRST_MSG = m.ID_MSG", __FILE__, __LINE__);

$row = mysql_fetch_assoc($result);
$subject = $row['subject'];
mysql_free_result($result);

$postbody = 'Åõ÷áñéóôïýìå ãéá ôçí êñéôéêÞ ' . $context['user']['name'] .'<br /><br/>';
foreach ($fielddef as $field) {
if ($field['type'] == 'heading')
$postbody .= '<br />[b]' . $field['caption'] . '[/b]<br /><br />';
elseif ($field['name'] == 'comments')
$postbody .= '<br />[b]' . $field['caption'] . '[/b]: ' . $_REQUEST[$field['name']] . '<br />';
elseif ($field['name'] == 'overall')
$postbody .= $field['caption'] . ': [b]' . $_REQUEST[$field['name']] . '[/b]<br />';
else
$postbody .= '[b]' . $field['caption'] . ': [color=red]' . $_REQUEST[$field['name']] . '[/color][/b]<br />';
}
$msgOptions = array(
'id' =>  0 ,
'subject' => 'Re: ' . $subject,
'body' => addslashes($postbody) ,
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' =>  array(),
);
$topicOptions = array(
'id' => $_GET['topic'] ,
'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,
);
createPost($msgOptions, $topicOptions, $posterOptions);
}



EasyRider

I HAVE ONLY 1 THING TO SAY: THANK YOUUUUUUU JPDeni..!!!!!!!!!!!!










SMF  1.1.11 / TinyPortal v1.0 beta 4 /default theme

JPDeni

:D

You're welcome. I'm glad I was able to help.

Freddy


ed_m2

little additional question for me, i'm adapting this with two purposes:
1 - events thread creation & submission to the smf calendar with custom fields
2 - custom events search based on form input
in the first case the form data is used with an INSERT statement and the later case with a SELECT.

i'm a little concerned on security and how best to add extra validation to some of the fields to prevent SQL insertion.

if i was feeling fancy i'd suggest an extra parameter with each field for a string of illegal characters that is checked at the same location as the madatory fields.

any suggestions / tips / tricks ?

This website is proudly hosted on Crocweb Cloud Website Hosting.