vy...@swtorarchives.com
unread,Aug 25, 2009, 8:59:02 PM8/25/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to reCAPTCHA
I am trying to add captcha into a feedback component for Joomla
however I am getting a parse error when doing so. The exact error is
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
in /home/themodst/public_html/components/com_jfeedback/views/jfeedback/
tmpl/default.php on line 103
the code is as follows ( with recaptcha added in.)
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php
$config =& JComponentHelper::getParams( 'com_jfeedback' );
$showauthor = $config->get( 'showauthor' );
$showdate = $config->get( 'showdate' );
$permission = $config->get( 'permission' );
$the = $config->get( 'the' );
$tmex = $config->get( 'tmex' );
$tauthor = $config->get( 'tauthor' );
$tdate = $config->get( 'tdate' );
$tfeedback = $config->get( 'tfeedback' );
$has_said = $config->get( 'has_said' );
$numfeed = $config->get( 'numfeed' );
$name = $config->get( 'name' );
$intro = $config->get( 'intro' );
$namey = $config->get( 'namey' );
$introy = $config->get( 'introy' );
if ( $namey == '1' ) { echo '
<div class="componentheading" id="jfheading">';echo $name;echo '</div>
<br>';}
if ( $introy == '1' ) { echo '
<p class="jfeedbackintro" style="opacity:.75;;">';echo $intro;echo '</
p><br><br>';
}
if ( $_POST['insfeedback'] != '' && $_POST['insdate'] != '' && $_POST
['insauthor'] != '' )
{ echo '<h2 style="color:red">Feedback added</h2><br><br>';}
?>
<?
// Load ID
$dboid =& JFactory::getDBO();
$queryid = "SELECT id FROM #__jfeedback ORDER BY id DESC";
$dboid->setQuery( $queryid );
$id =& $dboid->loadResultArray();
// Get right number of entries
$outputid = array_slice($id, 0, $numfeed);
// Recursive Write
while (list($key,$v_id) = each($outputid)){
$dbo =& JFactory::getDBO();
$queryauthorv_id = "SELECT author FROM #__jfeedback WHERE id =".
$v_id.';';
$querydatev_id = "SELECT data FROM #__jfeedback WHERE id =".$v_id.';';
$queryfeedbackv_id = "SELECT feedback FROM #__jfeedback WHERE id =".
$v_id.';';
$dbo->setQuery( $queryauthorv_id );
$author =& $dbo->loadResultArray();
$dbo->setQuery( $querydatev_id );
$date =& $dbo->loadResultArray();
$dbo->setQuery( $queryfeedbackv_id );
$feedback =& $dbo->loadResultArray();
// if session
if ( $showauthor == 1 && $showdate == 1 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo "<div class='jfeedbacktitle' id='jftitle".$v_id."'>";
echo '<b>'.$author[0].'</b>';
echo ', '.$the.' ';
echo '<b>'.$date[0].'</b>';
echo ' '.$has_said.':<br>';
echo '</div>';
echo $feedback[0];
echo '</div><br>';
echo "<hr style='width:100%' size='2' /><br>";
}
if ( $showauthor == 1 && $showdate == 0 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo "<div class='jfeedbacktitle' id='jftitle".$v_id."'>";
echo '<b>'.$author[0].'</b>';
echo ' '.$has_said.':<br>';
echo '</div>';
echo $feedback[0];
echo '</div><br>';
echo "<hr style='width:100%' size='2' /><br>";
}
if ( $showauthor == 0 && $showdate == 1 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo "<div class='jfeedbacktitle' id='jftitle".$v_id."'>";
echo '<b>'.$date[0].'</b>';
echo ':<br>';
echo '</div>';
echo $feedback[0];
echo '</div><br>';
echo "<hr style='width:100%' size='2' /><br>";
}
if ( $showauthor == 0 && $showdate == 0 ){
echo "<div class='jfeedback' id='jf".$v_id."'>";
echo $feedback[0];
echo '</div><br>';
echo "<hr style='width:100%' size='2' /><br>";
}
}
?>
<?php
if ( $permission == 1 ) { echo '
<br><div class="leaveus">'.$tmex.'</div><br><br>
<form action="" method="post" name="Form" id="Form">
'.$tauthor.':<br>
<input class="text_area" type="text" name="insauthor" id="insauthor"
size="32" maxlength="250" value="" /><br>
'.$tdate.':<br>
<input class="text_area" type="text" name="insdate" id="insdate"
size="32" maxlength="250" value="" /><br>
'.$tfeedback.':<br>
<textarea class="text_area" type="text" name="insfeedback"
id="insfeedback" rows="8" cols="20" value="" ></textarea>
<br>
require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey);
<br>
require_once('recaptchalib.php');
$privatekey = "...";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it
again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
<br>
<input type="submit" name="Submit" id="Submit" size="32"
maxlength="250" value="Submit" />
</form>';}
?>
<?php
if ( $_POST['insfeedback'] != '' && $_POST['insdate'] != '' && $_POST
['insauthor'] != '' )
{
$database =& JFactory::getDBO();
$user = new stdClass;
$user->id = NULL;
$user->feedback = $_POST['insfeedback'];
$user->data = $_POST['insdate'];
$user->author = $_POST['insauthor'];
if (!$database->insertObject( '#__jfeedback', $user, 'id' )) {
echo $database->stderr();
};
}
?>