Log in

View Full Version : Ran into a bit of a problem


Reeve of shinra
01-14-2006, 01:20 PM
I'm updating a small custom hack from 3.0 to 3.5 and I seem to be having some problems with a form I'm inserting into the postbit template.

When I hit submit, the value entered into the text box should be updating two fields in the db -- the problem is its not.


<if condition="is_member_of($bbuserinfo, 5, 6, 7)">
<div>
<form action="./modcp/gilupdate.php" method="post">
<input type="hidden" name="action" value="private204">
<input type="hidden" name="postid" value="$post[postid]">
<input type="hidden" name="userid" value="$post[userid]">
<input type="text" name="amount" size="3">&nbsp;
<input type="image" src="images/coin.gif" border="0" name="submit" alt="Give Gil" onClick="javascript:alert('Gil Paid!');">
</form>
<br />
<br />

</if>


I tried using the following script to see it that was the problem but it seems to work fine when I call it directly. Its only when I try to call it from the postbit that there seems to be an issue



// ##### Set us up an enviroment #####
error_reporting(E_ALL & ~E_NOTICE);
require_once('./global.php');


// ##### Lets set up some user defined variables #####
$fieldx="field5";
$postx="gilpaid";

//### Hard Constants for Testing #####
$userid="7";
$postid="88";
$gilstr="93";

//##### Start Doing Stuff #####
//if ($_POST['action']=="private204") {

$vbulletin->db->query_write("UPDATE userfield SET $fieldx = '$gilstr' WHERE userid = '$userid'");
$vbulletin->db->query_write("UPDATE post SET $postx = '$gilstr' WHERE postid = '$postid'");

//}

?>


Any thoughts about where I'm going wrong? I'm sure it must be something simple.

Bumping this with a pretty please!

Reeve of shinra
01-16-2006, 07:39 PM
/me pleads for help lol

Ranma2k
01-16-2006, 09:55 PM
I'm updating a small custom hack from 3.0 to 3.5 and I seem to be having some problems with a form I'm inserting into the postbit template.

When I hit submit, the value entered into the text box should be updating two fields in the db -- the problem is its not.


<if condition="is_member_of($bbuserinfo, 5, 6, 7)">
<div>
<form action="./modcp/gilupdate.php" method="post">
<input type="hidden" name="action" value="private204">
<input type="hidden" name="postid" value="$post[postid]">
<input type="hidden" name="userid" value="$post[userid]">
<input type="text" name="amount" size="3">&nbsp;
<input type="image" src="images/coin.gif" border="0" name="submit" alt="Give Gil" onClick="javascript:alert('Gil Paid!');">
</form>
<br />
<br />

</if>


I tried using the following script to see it that was the problem but it seems to work fine when I call it directly. Its only when I try to call it from the postbit that there seems to be an issue



// ##### Set us up an enviroment #####
error_reporting(E_ALL & ~E_NOTICE);
require_once('./global.php');


// ##### Lets set up some user defined variables #####
$fieldx="field5";
$postx="gilpaid";

//### Hard Constants for Testing #####
$userid="7";
$postid="88";
$gilstr="93";

//##### Start Doing Stuff #####
//if ($_POST['action']=="private204") {

$vbulletin->db->query_write("UPDATE userfield SET $fieldx = '$gilstr' WHERE userid = '$userid'");
$vbulletin->db->query_write("UPDATE post SET $postx = '$gilstr' WHERE postid = '$postid'");

//}

?>


Any thoughts about where I'm going wrong? I'm sure it must be something simple.

Bumping this with a pretty please!

well i don't understand what is your problem
but passing vraiables in to a script from a form you have to use the clean class

Please read about here :
https://vborg.vbsupport.ru/showthread.php?t=98047

Hope it helps you