omardealo
03-29-2015, 03:57 PM
Hello ,
i used this code in my plugin in hook : misc_start
this is a form to do insert on database
// this VAR $order on while loop and i print it on a template
$order = '<td class="alt2">
<form action="misc.php?do=points_usergift&giftid='.$resultgift[giftid].'&pointgift='.$resultgift[giftpoints].'" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="points_usergift" />
<input type="submit" class="button" value="submit" />
</form></td>';
if ($_REQUEST['do'] == 'points_usergift')
{
if($vbulletin->userinfo['user_points'] > $_POST["pointgift"])
{
eval(standard_error(fetch_error('points_nopermissi on')));
}else{
$db->query_write("INSERT INTO " . TABLE_PREFIX . " points_usergift
(giftid,userid,dateline)
VALUES
('".$_POST['giftid']."','".$vbulletin->userinfo['userid']."','".TIMENOW."')
");
eval(print_standard_redirect('points_addredirect', 1,1));
}
}
i think something is missing about session , and i think if i put a form in a template will be working good but i want but it on a plugin
This error appears
Your submission could not be processed because a security token was invalid.
If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error.
i used this code in my plugin in hook : misc_start
this is a form to do insert on database
// this VAR $order on while loop and i print it on a template
$order = '<td class="alt2">
<form action="misc.php?do=points_usergift&giftid='.$resultgift[giftid].'&pointgift='.$resultgift[giftpoints].'" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="points_usergift" />
<input type="submit" class="button" value="submit" />
</form></td>';
if ($_REQUEST['do'] == 'points_usergift')
{
if($vbulletin->userinfo['user_points'] > $_POST["pointgift"])
{
eval(standard_error(fetch_error('points_nopermissi on')));
}else{
$db->query_write("INSERT INTO " . TABLE_PREFIX . " points_usergift
(giftid,userid,dateline)
VALUES
('".$_POST['giftid']."','".$vbulletin->userinfo['userid']."','".TIMENOW."')
");
eval(print_standard_redirect('points_addredirect', 1,1));
}
}
i think something is missing about session , and i think if i put a form in a template will be working good but i want but it on a plugin
This error appears
Your submission could not be processed because a security token was invalid.
If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error.