desjardins2010
-
Posts
187 -
Joined
-
Last visited
Posts posted by desjardins2010
-
-
ok, so I figured out one part I was comparing long2ip to db that is ip2long
-
well this is the output About to execute query: DELETE FROM ipdatabase WHERE userid='22' AND ipaddress='232.143.196.91' limit 1
Query succeeded and go into db and the entry is still there I only have three entries all with id 22 different ip addresses... don't get it
-
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
-
tried the header redirect and it redirected me before even doing anything cause if i'm not mistaken you have to declare the header prior to any other text right?
-
try
date('H:m:s \m \i\s\ \m\o\n\t\h');
-
what I would like to see is it delete the entry and then foward them back to list of ips and THERE show the message IP deleted...
-
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; } ?>
-
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>";
-
AHHHHHH ok, let me this this... sorry i couldn't wrap my head about this one!
-
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
-
ok, so lets assume row1 colum 1 has an IP as 1.1.1.1 how can I when I click the image to go to deleteip.php pass that colums value to the script? you say use ?uid='.$selectID."$ip =".$ip''> where does ip get set
-
sounds about right for the deleteip.php however it's just an image of an x that I'm using to simulate a del button... so when thats clicked how can I set varibles with it like a form?
-
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>
-
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>
-
yes, bluesky is right the data needs to be stored in this case I would use date/time
-
first off try echo subject_id see what the value is... I could be missing something but I don't see where your declaring subject_id
-
if your using localhost did you set a password? if not try connecting with localhost, root, "" or localhost, "", ""
-
No, for this you would need to give access. You cannot fetch a file from server to server without security issues being present!
-
that should work
-
SELECT * FROM tickets WHERE username = 'username' AND HOUR(TIMEDIFF(NOW() , purchaseDate)) < 24
-
that's not the correct format to use the TIMEDIFF function give me a few look at this but TIMEDIFF is def' the way to accomplish what you trying to do mate..
-
First off, where is the actual purchase being stored in the db I would assume in the ticket number?
-
Thanks plenty guys always there to save me
-
so something like
$submit = $_POST['submit']; if ($submit) { $v2 = $_POST['v2.0']; $v3 = $_POST['v3.0']; } echo $v2; //should echo "PasswordCrackerv2.0"
question about mysql_select_db
in PHP Coding Help
Posted
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
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
the connectnpc.php connects and sleects heave_npc