Jump to content


mysql with some coding, need some help.

  • Please log in to reply
No replies to this topic

#1 furielrage

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 07 November 2003 - 04:14 AM

<?php// Cute way of saying don\'t hack the boardif ($mid == $userid){die(\'Noone (Script Shutdown: mid = userid)\');}// Let\'s find out exactly who we are donating to$DB->query("SELECT name, id FROM ibf_members WHERE id=\'".$mid."\'");if ( ! $row = $DB->fetch_row() ){die(\'User does not exist\');}$dname = $row[\'name\'];echo($dname);// Print Form?>!

With this code (where it queries the database) it will only select the guest id instead of the member who clicks his/her id. It\'s supposed to select the id of the person that is clicked on and change some data in the sql database, but I don\'t know how to get it to do that.

I haven\'t done much of this stuff so a little explanation would help very much

This piece of code is suppose to select the member who you clicked on to donate zeny(fake forum money) to in ibf_members. The thing is, I can\'t get it to point to the person that a member chose to donate money to.

Here is a shot of my ibf_members table:
Posted Image

If it helps, you can login to the forum and check. http://www.ffxii.org/forum
user/pass = demo/demo

In each user\'s post look at the left with all the rpg stats. You\'ll see \"donate zeny\" link at the bottom.

Here is the whole coding for the page:

<?php//-----------------------------------------//     RPG Shop 1.1 beta for IPB 1.2      //-----------------------------------------//     This is part of a pre-made set//     of files created to add a shop//     and other community related things//     to an community bulliten board.//     Feel free to edit to your hearts//     content, but leave this copyright//     at the top.//-----------------------------------------//     Created by: Xerin//     Edited by: Gogeta//     Released for IPB 1.2 by: Gogeta//-----------------------------------------/*     Place Your Edits Here*/?><html><head><title>Donating!</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="#BFC4C9"><?phpglobal $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;  // Check to see if the member is loged inif ( ! $ibforums->member[\'id\'] ) {  die(\'Please login\');  return; }  // Define some nice names for varibles   $userid = $ibforums->member[\'id\'];   $username = $ibforums->member[\'name\'];    $zeny = $ibforums->member[\'zeny\'];   if ($z == 1) // We are transfering money{  // Begin Hack Check   if ($donate < 100){  // Anything below 100, Stop   die(\'Please be nice and donate at least 50 zeny.\');}   if ($mid == \'\'){  // No Member ID, Stop  die(\'No Member Selected\');}   if ($mid == $userid){  // User is attempting to donate to self  // Do Not Remove this Check, or everyone can  // have unlimited zenies.  die(\'No Way Mister Hax0r\');}   if ($mid <= 0){  // User is attempting to donate to a guest  // Can\'t allow this can we?  die(\'I\'m sure guest would love it, but, no\');}  // End Hack Check  // Begin Zeny Checking Amountecho(\'Checking zeny amount.....\');   $negz = ($zeny - $donate);   if ($zeny < $negz){  die(\' Sorry, not enough money :(\');}   if ($zeny < $donate){  die(\'You dont have enough money :(\');}   if ($negz < 0){  die(\'omg u h4x\');}  // Done  echo(\'done<br>\');  // Query the database and get the member we are donating to $DB->query("SELECT name, id, zeny FROM ibf_members WHERE id=\'".$mid."\'"); if ( ! $row = $DB->fetch_row() ) {  die(\'Please Report this Error to your Admin (Script Shutdown)\'); }  // Begin updating accounts  // Update our members account firstecho(\'Updating members accounts.....\'); $ze = "UPDATE `ibf_members` SET `zeny` = \'$negz\' WHERE `id` = \'$userid\' LIMIT 1;";mysql_query($ze);  // Now update the other members account$donate2 = ($row[\'zeny\'] + $donate);$sql = "UPDATE `ibf_members` SET `zeny` = \'$donate2\' WHERE `id` = \'". $row[\'id\'] ."\' LIMIT 1";mysql_query($sql);echo(\'done<br>\');  // Done  // Printing out a Receipt (Graphical Use Only)echo(\'Preparing Receipt........\');$today = date("F j, Y, g:i a"); echo(\'done<br>\');echo(\'Printing Your Receipt (Please Save for Future Refernce)<br><br>\');echo("<span id=\'code\'>");echo(\'-------------------------------------<br>\');echo(\'             Receipt                 <br>\');echo(\'-------------------------------------<br>\');echo(\'You Transfered                 \'.$donate.\'z<br>\');echo($row[\'name\']." Recieved the amount in full.<br>");echo(\'Your new balence is:\'.$negz.\'<br>\');echo($row[\'name\']."\'s new balence is:".$donate2."<br>");echo(\'Thank you for using our service!<br>\');echo(\'-------------------------------------<br>\');echo($today.\'<br>\');echo(\'-------------------------------------<br>\');echo(\'</span><br><br><br>\');  // Done Showing the Receipt, Save it to Profileecho(\'Saving receipt to database....\');  // Save for Member Giving$re = \'INSERT INTO `ibf_receipt` (`id`, `mid`, `tran`, `z`, `date`) VALUES (\'\', \'\'.$userid.\'\', \'Transfered Zeny to \'.$row[\'name\'].\'\', \'\'.$donate.\'\', \'\'.$today.\'\');\'; mysql_query($re);  // Save for Member Taking$re = \'INSERT INTO `ibf_receipt` (`id`, `mid`, `tran`, `z`, `date`) VALUES (\'\', \'\'.$row[\'name\'].\'\', \'Recieve Zeny from \'.$username.\'\', \'\'.$donate.\'\', \'\'.$today.\'\');\'; mysql_query($re);  // Doneecho(\'done<br>\');  // Thank You Come Againecho(\'Thank You!\');}else // Print up a box and say please tell us how much you want to transfer{ global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;?><center><font face="Verdana" size="2">Hello <?php echo($username); ?>, you have  <?php echo $zeny; ?> to donate.<br><br>If you choose to donate, we will be transferring your money to:<?php  // Cute way of saying don\'t hack the board   if ($mid == $userid){  die(\'Noone (Script Shutdown: mid = userid)\');}  // Let\'s find out exactly who we are donating to $DB->query("SELECT name, id FROM ibf_members WHERE id=\'".$mid."\'"); if ( ! $row = $DB->fetch_row() ) {  die(\'User does not exist\'); } $dname = $row[\'name\']; echo($dname);  // Print Form?>! </font><form name="form1" method="post" action="<?php echo $PHP_SELF; ?>?act=tran&mid=<?php echo($row[\'id\']); ?>&z=1"> <p>Amount You Wish to Donate:   <input type="text" name="donate"> </p> <p>   <input type="submit" name="Submit" value="Donate!"> </p></form></center><?php}?>

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users