Jump to content

burtybob

Members
  • Posts

    105
  • Joined

  • Last visited

Posts posted by burtybob

  1. I have a bank script that gets the time from a databse however putting it into the database i use

    time()+24*60*60 which is one day.

     

    However this means that in the database is all those number what i would like to do is turn it from those numbers into a time and then have it "tick" down...

     

    OR

     

    Maybe just be able to skip the bit with turning it into a date and just make it so i can "tick" down

     

    23:59:59

    23:59:58

    23:59:57

    23:59:56

    23:59:55

    23:59:54

     

    etc.

    Please does anyone know how i can do this?

  2. $sql=mysql_query("SELECT * FROM report WHERE (`verdict` = '') AND ((`staff1` = '') OR (`staff2` = '') OR (`staff3` = '')) AND (`staff1` != 'Adminben') ORDER BY `dtreported` ASC");

    WORKS however

    $sql=mysql_query("SELECT * FROM report WHERE (`verdict` = '') AND ((`staff1` = '') OR (`staff2` = '') OR (`staff3` = '')) AND ((`staff1` != 'Adminben') OR (`staff2` !='Adminben')) ORDER BY `dtreported` ASC");

    DOESNT.

     

    Again Both staff1 and staff2 are set but when i check just staff1 it works but as soon as i try that staff2 using the  ( ) Double bracket method it breaks and just shows all of them even if if staff1 != Adminben.

     

    Sorry to ask AGAIN but please does any one know why this is happening???

     

    Many thanks in advance!

  3. I have:

    $sql=mysql_query("SELECT * FROM report WHERE (`verdict` = '') AND (`staff1` = '') OR (`staff2` = '') OR (`staff3` = '') AND (`staff1` != 'Adminben')  ORDER BY `dtreported` ASC");

    And BTW satff1 is = Adminben and yet it still selects and show it!!!

    Does anyone have any idea why this is i have tried also using a variable in their so as to automate it but to the same result.

    Many thanks in advance.

     

  4. You missed the line of code I added.

     

    print_r($staff1);

     

    Sorry you are right i did miss that piece of code and it now doesnt echo when the variable isnt set, thank you can i please ask what the print_r actually does because in the php manual it says its to do with arrays is this true?

     

    Thank you!

  5. Why don't you echo the var itself and see what it contains?

     

    $staff1 = $_REQUEST['staff1'];

    echo $staff1;

     

    You may also use

    echo int($staff1);

     

    etc.

     

    If you read my post i did try this also mmmvomit i have tried the isset() method and as someone pointed out the variable does set! Even if it is $staff='' still becomes 'set'

  6. OOPs Programming lol!!!! (very bad pun)

     

    Now i am checking to see if its empty and im using same code as before but instead of isset() im using empty () and even when its got data it still echos hello!!! any ideas?

    I even tried manually giveing the variable a value in the code and still it echos!!!

     

    Please? :)

     

    Grr i even tell the code to echo if its empty and it actually echos a value!

  7. I have a piece of code sayin

    $staff1 = $_REQUEST['staff1']; // also tried with $_GET and $_POST but neither worked for me
    if (isset($staff1)) {
    echo "hello";
    }
    

    And i am not 'setting' the variable so why is it echoing the hello (i am going to turn the actual true statement into a usefull thing but i thought echoing something i would be able to see if it is working)

     

    Please can anyone help as i have spent the last week looking thorugh this code to make sure nothing is passed to the variable to be able to set it.

  8. If the question is- "Can an included file include files" the answer is yes. Meaning your example would work.

    If thats not what you mean then try to explain again please.

     

    Orio.

    Yes this is what i meant so that i can include all my current incliudes into one so as to make for smaller code but easyness as well.

    So that i just have one include in each file file instead of loads.

    Thank you for your  help.

  9. Ok...

    Here is my ENTIRE Code for the bank page.

    <?php
    include("dbconnect.php");
      include("playerchecks.php");
      include("checkhospjail.php");
      include("fn_sendmessage.php");
      if (empty($c_userid)) {
        header("Location: index.php");
        exit;
      } else {
        /**********************************************
        ** GET PLAYERS EXISTING MONEY FOR DEPOSIT  ALL**
        ***********************************************/
    $gtaid=secureint($_POST['gtaid']);
    $depall=$_POST['depall'];
    $witall=$_POST['witall'];
    $fetch=mysql_fetch_array(mysql_query("SELECT * FROM members WHERE `userid`='$c_userid'"));
    $moneys=$fetch[money];
        /***************************************
        ** GET PLAYER'S EXISTING BANK BALANCE **
        ***************************************/
        $fetch=mysql_fetch_array(mysql_query("SELECT * FROM members WHERE `userid`='$c_userid'"));
        $bankmoney=$fetch[bankmoney];
        $banktime=$fetch[banktime];
        $bankremain=$banktime-time();
        $moneys=$fetch[money];
        /***************************************************
        ** CHECK IF 24 HOURS HAS EXPIRED AND ADD INTEREST **
        ***************************************************/
        if ($bankremain<=0) {
          $plmoney+=$bankmoney+($bankmoney-intval($bankmoney*1.05));
          $bankmoney=0;
          $banktime=0;
          $bankremain=0;
        }
        /**************************************
        ** PLAYER WANTS TO USE THEIR ACCOUNT **
        **************************************/
    $outtime=time()+(24*60*60); //24 hours
    if (isset($depall)) {
    $allmony = mysql_query("SELECT money FROM members WHERE userid = $c_userid");
    mysql_query("UPDATE members SET `bankmoney`=$allmony,`money`='0',`banktime`='$outtime' WHERE `userid`='$c_userid'");
    } else if(isset($witall)) {
    $allmonya = mysql_query("SELECT bankmoney FROM members WHERE userid = $c_userid");
    mysql_query("UPDATE members SET `money`=money+'$allmonya',`bankmoney`='0' WHERE `userid`='$c_userid'");
    } else {
    if ($_POST['subbalance']) {
          $amount=secureint($_POST['amount']);
          if ($amount>0) {
            $action=secureint($_POST['action']);
            if ($action==1) { //Player wants to credit their account
              if ($plmoney<$amount) {$message="You can't credit your account with money you don't have";} else {
                $outtime=time()+(24*60*60); //24 hours
                $plmoney-=$amount; //Remove money from the player's hand
                if ($bankmoney>0) {//Player wants to credit an existing balance
                  mysql_query("UPDATE members SET `money`=money-'$amount',`bankmoney`=bankmoney+'$amount',`banktime`='$outtime' WHERE `userid`='$c_userid'");
                  $message="You added $".number_format($amount)." to your account - in 24 hours you'll receive 5% interest";
                  $bankmoney+=$amount;
                } else {
                  mysql_query("UPDATE members SET `money`=money-'$amount',`bankmoney`='$amount',`banktime`='$outtime' WHERE `userid`='$c_userid'");
                  $message="You credited your account with $".number_format($amount)." - in 24 hours you'll receive 5% interest";
                  $bankmoney=$amount;
                }
              }
              $bankremain=(24*60*60)-1;
            } else { //Player wants to debit their account
              if ($amount>$bankmoney) {$message="You don't have that much in your account";} else {
                if ($amount<$bankmoney) { //Player wants to withdraw some of their money
                  mysql_query("UPDATE members SET `money`=money+'$amount',`bankmoney`=bankmoney-'$amount' WHERE `userid`='$c_userid'");
                  $message="You debited $".number_format($amount)." from your account";
                  $bankmoney-=$amount;
                } else { //Player wants to withdraw all of their money
                  mysql_query("UPDATE members SET `money`=money+'$amount',`bankmoney`='0',`banktime`='0' WHERE `userid`='$c_userid'");
                  $message="You withdrew all your money from your account";
                  $bankmoney=0;
                  $bankremain=0;
                }
              }
            }
          } else {$message="Invalid amount - please try again";}
        }
    }
        /************************************
        ** PLAYER WANTS TO SEND SOME MONEY **
        ************************************/
        if ($_POST['subsend']) {
          $sendname=securestr($_POST['sendname']);
          if (empty($sendname)) {$message="You need to specify who you want to give to";} else {
            $fetch=mysql_fetch_array(mysql_query("SELECT displayname FROM members WHERE `displayname`='$sendname'"));
            $sendname=$fetch[displayname];
            if (empty($sendname)) {$message="That player doesn't exist";} else {
              $sendamount=secureint($_POST['sendamount']);
              if ($_POST['sendmessage']) {$sendmsg=true;} else {$sendmsg=false;}
              if ($sendamount<100||$sendamount>$plmoney) {$message="Invalid amount - please try again";} else {
                $checkcode=md5(secureint($_POST['chkcode']));
                if ($checkcode==$_SESSION['vcode']) {
                  mysql_query("UPDATE members SET `money`=money-'$sendamount' WHERE `userid`='$c_userid'"); //Remove money "from"
                  $receiveamount=intval($sendamount*0.9);
                  mysql_query("UPDATE members SET `money`=money+'$receiveamount' WHERE `displayname`='$sendname'"); //Give money "to"
                  mysql_query("INSERT INTO banktransfers (`from`,`to`,`amount`,`dt`) VALUES ('$plname','$sendname','$sendamount',NOW() )");
                  $message='You sent <a href="viewprofile.php?user='.$sendname.'">'.$sendname.'</a> $'.number_format($sendamount).', after bank charges they received $'.number_format($receiveamount);
                  if ($sendmsg) {
                    $sendmsg='sent you $'.number_format($sendamount).'.\n\nAfter bank charges you received $'.number_format($receiveamount).'.';
                    sendmessage($plname,$sendname,$sendmsg,5);
                  }
                } else {$message="The code doesn't verify - please try again";}
              }
            }
          }
        }
        /***********************************
        ** GET LAST 10 BANK TRANSFERS OUT **
        ***********************************/
        $outhtml="";
        $query=mysql_query("SELECT * FROM banktransfers WHERE `from`='$plname' ORDER BY `dt` DESC LIMIT 10");
        while ($fetch=mysql_fetch_array($query)) {
          $outhtml.='<tr class="tblin"><td class="gtext"><a href="viewprofile.php?user='.$fetch[to].'">'.$fetch[to].'</a></td><td class="gtextr">$'.number_format($fetch[amount]).'</td><td class="gtextc">'.gmdate("d-m \a\\t H:i",strtotime($fetch[dt])).'</td></tr>';
        }
        /**********************************
        ** GET LAST 10 BANK TRANSFERS IN **
        **********************************/
        $inhtml="";
        $query=mysql_query("SELECT * FROM banktransfers WHERE `to`='$plname' ORDER BY `dt` DESC LIMIT 10");
        while ($fetch=mysql_fetch_array($query)) {
          $inhtml.='<tr class="tblin"><td class="gtext"><a href="viewprofile.php?user='.$fetch[from].'">'.$fetch[from].'</a></td><td class="gtextr">$'.number_format($fetch[amount]).'</td><td class="gtextc">'.gmdate("d-m \a\\t H:i",strtotime($fetch[dt])).'</td></tr>';
        }
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
      <title>Lealta alla Famiglia :: Game Information</title>
      <link rel="stylesheet" type="text/css" href="main.css" />
      <script language="JavaScript" type="text/javascript"">
      function doFocus() {
        document.myform.amount.focus();
        }
      </script>
    </head>
    <body onload="doFocus();" onmouseover="window.status='Lealta alla Famiglia :: Bank';return true;" onmouseout="window.status='';return true;">
      <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr><td colspan="3"><?php include("titlebar.php"); ?></td></tr>
        <tr><td colspan="3"><hr></td></tr>
        <tr>
          <td width="130" valign="top" align="left"><?php include("menu.php"); ?></td>
          <td valign="top" class="playarea" align="center" width="100%">
            <br /><?=$message?><br /><br />
            <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="myform">
            <table cellspacing="0" cellpadding="0" border="0">
              <tr><td align="center" valign="top">
                <table cellspacing="0" cellpadding="0" class="tblout">
                  <tr class="tblin"><td class="tblhdr" colspan="2">Bank</td></tr>
                  <tr class="tblin"><td class="gtext">Balance</td><td class="gtext">$<?php echo number_format($bankmoney); ?></td></tr>
                  <tr class="tblin"><td class="gtext">Time Left</td><td class="gtext"><?php if ($bankremain<0) {echo "00:00:00";} else {echo gmdate("H:i:s",$bankremain);} ?></td></tr>
                  <tr class="tblin"><td class="gtext">Amount</td><td class="gtext"><input type="text" name="amount" size="16" maxlength="10" class="textbox" /></td></tr>
                  <tr class="tblin"><td class="gtext">Action</td><td class="gtext"><input type="radio" name="action" value="1" checked="checked" /> Credit <input type="radio" name="action" value="2" /> Debit</td></tr>
                  <tr class="tblin"><td class="gtextc" colspan="2"><input type="submit" name="subbalance" value=" Make Transaction " class="button" /></td></tr>
                  <tr class="tblin"><td class="gtextc" colspan="2"><input type="submit" name="depall" value=" Deposit All" class="button" /></td></tr>
                  <tr class="tblin"><td class="gtextc" colspan="2"><input type="submit" name="witall" value=" Withdraw All" class="button" /></td></tr>
                </table><br />
                <table cellspacing="0" cellpadding="0" class="tblout">
                  <tr class="tblin"><td class="tblhdr" colspan="2">Transfer Money</td></tr>
                  <tr class="tblin"><td class="gtext">Who to?</td><td class="gtext"><input type="text" name="sendname" size="21" maxlength="20" class="textbox" /></td></tr>
                  <tr class="tblin"><td class="gtext">Amount</td><td class="gtext"><input type="text" name="sendamount" size="16" maxlength="10" class="textbox" /></td></tr>
                  <tr class="tblin"><td class="gtext">Message</td><td class="gtext"><input type="checkbox" name="sendmessage" /></td></tr>
                  <tr class="tblin"><td class="gtextc" colspan="2">Enter verification code:<br /><img src="verifycode.php" width="55" height="15" border="0" /> <input type="text" name="chkcode" size="7" maxlength="6" class="textbox" /></td></tr>
                  <tr class="tblin"><td class="gtextc" colspan="2"><input type="submit" name="subsend" value=" Send " class="button" /></td></tr>
                </table>
              </td>
              <td width="18"> </td>
              <td align="center" valign="top">
                <?php if (!empty($outhtml)) { ?>
                <table cellspacing="0" cellpadding="0" class="tblout">
                  <tr class="tblin"><td class="tblhdr" colspan="3">Last 10 Outgoing</td></tr>
                  <tr class="tblin"><td class="gsubhdr">Name</td><td class="gsubhdr">Amount</td><td class="gsubhdr">When</td></tr>
                  <?=$outhtml?>
                </table><br />
                <?php } ?>
                <?php if (!empty($inhtml)) { ?>
                <table cellspacing="0" cellpadding="0" class="tblout">
                  <tr class="tblin"><td class="tblhdr" colspan="3">Last 10 Incoming</td></tr>
                  <tr class="tblin"><td class="gsubhdr">Name</td><td class="gsubhdr">Amount</td><td class="gsubhdr">When</td></tr>
                  <?=$inhtml?>
                </table>
                <?php } ?>
              </td></tr>
            </table>
            </form>
          </td>
        </tr>
      </table>
    </body>
    </html>
    <?php } ?>
    

    I have tried several things and i can only ever get parts to work like deposit or bank time or neither to work....

     

    And i allready have the db with time and that to log it, that works as long as it isnt via the buttons of dep/wit all.

  10. Your buttons should have each their own name and value. Check which was set using isset(). Then take the appropriate action

     

    so basicall same as above but instead of (empty) use (isset)?

     

    This works mostly but it deposits it and then withdrawable but it doesnt display that it has done either in the ballance area.

     

     

    Ok heres the code i am using.

     

    if (isset($depall)) {
    $allmony = mysql_query("SELECT money FROM members WHERE userid = $c_userid");
    mysql_query("UPDATE members SET `bankmoney`=$allmony,`money`='0',`banktime`='$outtime' WHERE `userid`='$c_userid'");
    } else if(isset($witall)) {
    $allmonya = mysql_query("SELECT bankmoney FROM members WHERE userid = $c_userid");
    mysql_query("UPDATE members SET `money`=money+'$allmonya',`bankmoney`='0' WHERE `userid`='$c_userid'");
    } else {

  11. Ok...

    I have a problem and can i say firstly i dont want code but an explanation on how to do this, i would like to know how can i make a bank script have a button(which i have got) but then one says Deposit all and the other one says Withdraw all,

     

    How would i go about making it so that they do exactly what it says on the button, would it be that i treat the buttons like a normal part of the form? or how?

     

    Please dont post code as i would like to code it fully myself although if you need to post code to make it easier to explain please feel free.

  12. What goes into "minus"? The prices?

    No the prices are fine but the time goes into minus when i go on the page the time from the DB - Current time for some reason seem to go into minuse.

    1189102314 <---- Time now

    Time 4: -1189015805 <------ Time in DB - Time now

     

    So because it never hits 0 it never automatically updates the DB.

  13. I have a code that should update a table named drugs after 2 hours however when i try the code i get the data from the database but it then goes into minus plus can some one look at my code and tell me why it goes minus instead?

     

    <?php
    $con = mysql_connect("sql address","username","password");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("database", $con);
    
    $londonpdp=mt_rand(99,999);
    $oslopdp=mt_rand(98,999);
    $cairopdp=mt_rand(99,999);
    $shanghaipdp=mt_rand(99,999);
    $parispdp=mt_rand(99,999);
    $dublinpdp=mt_rand(99,999);
    $riopdp=mt_rand(99,999);
    $stockholmpdp=mt_rand(99,999);
    $athenspdp=mt_rand(99,999);
    $montrealpdp=mt_rand(99,999);
    $washingtonpdp==mt_rand(99,999);
        $time1=mysql_query("SELECT pricetime FROM drugs");
        $outtime=time()+(24*60*60); //24hours
        $time4= $time1-time();
    if ($time4<=0) {
    mysql_query("UPDATE drugs SET londonprice = '$londonpdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET osloprice = '$oslopdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET cairoprice = '$cairopdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET shanghaiprice = '$shanghaipdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET washingtonprice = '$washingtonpdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET dublinprice = '$dublinpdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET parisprice = '$parispdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET rioprice = '$riopdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET stockholmprice = '$stockholmpdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET athensprice = '$athenspdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET montrealprice = '$montrealpdp' WHERE drugname = 'pot'");
    mysql_query("UPDATE drugs SET pricetime = '$outtime' WHERE drugname = 'pot'");
    }
    mysql_close($con);
    
    echo "$outtime <br>";
    echo "Time 4: $time4 <br>";
    ?>
    d
    

  14. Hi,

     

    Does anyone know a good PvP tutorial, doesnt have to be easy to follow however it would be nice, or even if someone could write a VERY basic one on how to creat PvP pages.

     

    I mean i only really need the basics and a explantion how it works, i did search on here and the main site but couldnt find one.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.