Jump to content

desjardins2010

Members
  • Posts

    187
  • Joined

  • Last visited

Posts posted by desjardins2010

  1. hey curious this code here i'm using from another script to make things quicker for me however the two querys here were on the other script picking from the same place IE: members in table heaven_users

     

    this new script however will need the forst query for pull from heaven_npc so i tried

    $query = mysql_query("SELECT * FROM 'heaven_users' 'members' WHERE username='$player'");
    

    this script below given this error

     

    "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''heaven_users' 'members' WHERE username='solidsoul'' at line 1 "

     

    here the whole script

    include('connectnpc.php');
    
    	$query = mysql_query ("SELECT * FROM npcs WHERE ipaddress='$npcip'") or die (mysql_error());
    	$query2 = mysql_query ("SELECT * FROM 'heaven_users' 'members' WHERE username='$player'") or die (mysql_error());
    

    the connectnpc.php connects and sleects heave_npc

  2. I don't understand what you mean about printing my sql? if I put header redirect at the top of the screen it will finsh the script prior to redirect?

     

    and Zurev when you say to start a session for the notice in my if statement? like if ($delete) {$_SESSION['notice'];}

     

    then in the main file use $_SESSION['notice']; = "Your IP have been removed!";

     

    or do I need to use session_start('notice') in the deleteip.php

     

    and dunno why string looks good but it;s not deleting the entry from db though it;s saying it is?

     

    thanks guys

  3. alright so thats working great... it's passing the right values across to deleteip.php I created deleteip.php quickly here is what I got.. it's saying deleted IP but it's not getting deleted from the db??

     

    <?php
    session_start();
    if (!isset($_SESSION['username'])) {
    echo "Sorry you must be logged in to view this page<BR>";
    echo "Please <a href='index.php'>GO BACK</a> and try again";
    exit();
    }
    else {
    if ($_SESSION['username']) {
    $username = $_SESSION['username'];
    $userid = $_SESSION['userid'];
    }
    }
    
    $ip = $_GET['ip'];
    
    //deleted selected ip from selected users list
    include('connectdb.php');
    
    mysql_select_db('heaven_users') or die (mysql_error());
    
    $delete = mysql_query("DELETE FROM ipdatabase WHERE userid='$userid' AND ipaddress='$ip' limit 1") or die (mysql_error()); 
    
    if ($delete) {
    echo "<font color='#ff0000'>Deleted IP</font>";
    echo "<br />";
    echo $ip;
    echo "<br />";
    echo $userid;
    }
    
    ?>
    

  4. ok, so whats wrong with this... it's erroring out saying unexpected .;'

     

    while ($result = mysql_fetch_assoc($query)) {
    $ip = long2ip($result['ipaddress']);
    echo "<tr align='center'><td><font color='#ffffff'>".$ip."</font></td><td><a href='deleteip.php?uid=".$userid."&ip=".$ip"><img border='0' src='images/delete.png'></a></td></tr>";
    

  5. i'm still confused on how you plan on using $_GET with a field that is sitting in a table... when I click on the link to delete how does it know first of all to take the IP from the colum... say there is a table with two colums one is an IP address and the other an img of an x to delete... when I click the x img how does it now what colms x i'm pressing.. i could be really confised here but I don't see away to set the value of IP without hitting a submit button and capturing a name feild

  6. hey all;

     

    i created a script that just allows a user to record an IP address and it presents them in a table..

     

    issue: each record draws its own row and a colum for an image (for deleting).. I can't igure out how I can delete the one row when they click on image(little x) to delete...

     

    issue2: it's showing the error message when you bring up the screen telling them they didn't enter anything even prior to them hitting submit...

     

    issue3: it's allowing me to enter the same IP again

     

    code:

    
    <?php
    session_start();
    if (!isset($_SESSION['username'])) {
    echo "Sorry you must be logged in to view this page<BR>";
    echo "Please <a href='index.php'>GO BACK</a> and try again";
    exit();
    }
    else {
    if ($_SESSION['username']) {
    $username = $_SESSION['username'];
    $userid = $_SESSION['userid'];
    }
    }
    //script v1.0 ipdatabase.php - create a list of IP addresses that the user has added to their list to remember. can add or remove IPs
    ?>
    <style type="text/css">
    <!--
    .style1 {color: #FFFFFF}
    -->
    </style>
    
    <table align="center" width="550" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
      <!--DWLayoutTable-->
      <tr>
        <td height="106" colspan="3" valign="top"><img src="images/myvpc.png" width="550" height="106"></td>
      </tr>
      <tr>
        <td width="16" height="57"> </td>
        <td width="516" valign="top"><div align="center" class="style1">
          <p>IP DATABASE</p>
          <p align="left">add or remove IP address you have encountered in the game thus far for later use!</p>
        </div></td>
        <td width="18"> </td>
      </tr>
      <tr>
        <td height="100"> </td>
        <td valign="top">
          <form action="ipaddressadd.php" method="POST">
            <p> </p>
            <p><span class="style1">IP ADDRESS</span>:
              <input type="text" name="ipaddress" size="16">
              <input type="submit" name="submit" value="submit">
              </p>
          </form></td>
        <td> </td>
      </tr>
      <tr>
        <td height="17"></td>
        <td valign="top"><img src="images/filler.jpg" width="516" height="19"></td>
        <td></td>
      </tr>
      <tr>
        <td height="296"></td>
        <td valign="top">
          <?php
    $submit = $_POST['submit'];
    if ($submit) {
     $ipaddress = ip2long($_POST['ipaddress']);
     }
    //script to add IP to database
    include('connectdb.php');
    
    mysql_select_db('heaven_users') or die (mysql_error());
    
    if (isset($ipaddress,$submit)) {
    
    
    mysql_query("INSERT INTO ipdatabase (userid,ipaddress) VALUE ('$userid','$ipaddress')") or die ("Could Not write to database, Please try again");
    }
    else
    echo "<center><font color='#ff0000'>You didn't add anything mate!</font></center>";
    echo "<br />";
    
    
    echo "<table align='center' border='1'><tr align='center'><th><font color='#ffffff'>SAVED IPADDRESS</font></th></tr><tr>";
    
    $query = mysql_query("SELECT * FROM ipdatabase WHERE userid = '$userid'");
    while ($result = mysql_fetch_assoc($query)) {
    $ip = long2ip($result['ipaddress']);
    echo "<tr align=\"center\"><td><font color='#ffffff'>".$ip."</font></td><td><a href='deleteip.php'><img border='0' src='images/delete.png'></a></td></tr>";
    }
    echo "</table>";
    
    
    ?>    </td>
        <td></td>
      </tr>
    </table>
    

  7. hello all, i can't get this to work; i'm able to echo both accts entered into the form via the _get but can't pull both balances using the $from_acct and $to_acct only the first query working do I have it formated wrong

     

    <?php
    //check for submit
    $submit = $_GET['submit'];
    //end looking for submit
    
    //set varibles if submit is present
    if (!$submit) {
    echo "Sorry Mate I don't see you have submitted anything for me to process";
    }
    else {
    //make the connecting and set some varibles from _get
    $from_acct = $_GET['from_acct'];
    $to_acct = $_GET['to_acct'];
    $amount = $_GET['amount'];
    
    
    
    $connect = mysql_connect("localhost","root","") or die (mysql_error());
    mysql_select_db('users') or die ("no such database exisit");
    
    $query = mysql_query("SELECT * from members WHERE bankaccount=$from_acct") or die ("Could not locate to account");
    $query2 = mysql_query("SELECT * from members WHERE bankaccount=$to_acct") or die ("Could not locate to account");
    
    while ($result = mysql_fetch_assoc($query) && $result2 = mysql_fetch_assoc($query2))
    {
    $fromb = $result['balance'];
    $tob = $result2['balance'];
    }
    //make a check to see if the account that is sending has the money to send
    if ($fromb<$amount) {
    echo "Mate you don't have enough cash to transfer " .$amount. "to this account<br />";
    echo "Your Current Balance available for transfer is " .$fromb;
    
    }
    else {
    $newbalancefrom = $fromb - $amount;
    $newbalanceto = $tob + $amount;
    //make the transfer
    $transfer = mysql_query("UPDATE 'users' . 'members' SET 'balance' = '$newblanceto' WHERE bankaccount='$to_acct'") or die ("could not write to profile");
    $transfer2 = mysql_query("UPDATE 'users' . 'members' SET 'balance' = '$newblancefrom' WHERE bankaccount='$from_acct'") or die ("Could Not Write to From Account");
    
    if ($transfer) {
    echo "Transfer Complete Thanks!";
    }
    else {
    echo "There was a error in the transfer process please try again";
    }
    }
    }
    echo $fromb . "<br />";
    echo $tob . "<br />";
    echo $from_acct . "<br />";
    echo $to_acct . "<br />";
    ?>
    <h2>Peer to Peer Transfer</h2><br><br>
    <form action="testtrans.php" method="get">
    Amount to Transfer: <input type="text" size="8" name="amount"><br>
    From Account: <input type="text" size="15" name="from_acct"> To Account: <input type="text" size="15" name="to_acct" /><br />
    <input type="submit" name="submit" value="transfer" />
    </form>
    

×
×
  • 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.