
iRoot121
Members-
Posts
36 -
Joined
-
Last visited
iRoot121's Achievements

Member (2/5)
0
Reputation
-
Hi guys, I wanted to make a script login to the website Marktplaats.nl, but it doesn't seem to work.. At the moment I can't post the code as it's on my laptop. Does anyone know how to login and maybe do other stuff on Marktplaats.nl with cURL? Kind regards, Kevin Ruhl.
-
Hi, I'm trying to make a program that filters data out of a website. Now I've got a problem. For example, I've this line: <td class="maintxt" width="200"><a href="profile.php?x=Stranger">Stranger</a></td><td class="maintxt" width="200">Godfather (96.76%)</td><td class="maintxt" width="200"><i><a href="clanprofile.php?x=Ettertjes">Ettertjes</a></i></td> Form this line I want to set the word "Stranger" in a variable, and do the same for the word "Godfather". What is the best method to do this? Thanks in advance, iRoot121
-
Hi, I'm trying to let JavaScript check if a givin user exist in the database. It seems that the _check-user.php always returns 0, but if I fill in a name that doesn't exist, and echo out the result variable in JS, the echo will return 1. Is there someone who could help me? JavaScript part: function checkUser() { $.post("_check_user.php", { 'username': document.getElementById("username").value }, function(result) { if (result == 1) { document.getElementById("checkUser").className = "succes"; document.getElementById("checkUser").innerHTML = "Name is available"; }else{ document.getElementById("checkUser").className = "errormsg"; document.getElementById("checkUser").innerHTML = "Name is not available!"; } }); } _check-user.php: <?php include("config.php"); $result = mysql_query("SELECT login FROM users WHERE login='".clean_string($_POST["username"])."'"); if(mysql_num_rows($result)>0){ echo 0; }else{ echo 1; } ?>
- 1 reply
-
- javascript
- check
-
(and 3 more)
Tagged with:
-
I've already got the solution: after the UPDATE query there was another query that said: update the cash of the user with the cash + an amount of cash. But the second query had the old cash value, not the updated one. Thanks for helping anyway guys!
-
Yea, that could be possible. Here is the code if you want to take a look at it: http://pastebin.com/JDWZuf2b The update query is on line 431
-
Do you mean the whole page? If so, do you want to have a pastebin, or should I just paste it here? EDIT: Here is the code for the error handling: $q = "UPDATE users SET cash='".clean_string($info["cash"]-$_POST["bet"])."' WHERE login='".$info["login"]."'"; echo "Query is <br>$q"; $qresults = MySQL_query($q); if (!$qresults) { echo "Error in query - msg is<br>" . MySQL_error(); exit(); } $q2 = "UPDATE objecten SET bank='".clean_string($object["bank"]+$_POST["bet"])."' WHERE type='4' AND land='".$info["land"]."'"; echo "Query is <br>$q2"; $qresults2 = MySQL_query($q2); if (!$qresults2) { echo "Error in query - msg is<br>" . MySQL_error(); exit(); }
-
If I use that for both queries, I get: Query is UPDATE users SET cash='13000' WHERE login='Goed' Query is UPDATE objecten SET bank='9223372036854774807' WHERE type='4' AND land='1' as output, no errors or whatever.
-
If I echo the var_dumps like this: echo '$info["login"]: '.var_dump($info["login"]); echo '$_POST["bet"]: '.var_dump($_POST["bet"]); echo '$info["cash"]: '.var_dump($info["cash"]); echo '$info["land"]: '.var_dump($info["land"]); I get string(4) "Goed" $info["login"]: string(4) "1000" $_POST["bet"]: string(5) "14000" $info["cash"]: string(1) "1" $info["land"]: as output. Do you need any more information?
-
Both of the queries aren't working. And if I do: echo "UPDATE users SET cash='".clean_string($info["cash"]-$_POST["bet"])."' WHERE login='".$info["login"]."'"; echo "UPDATE objecten SET bank='".clean_string($object["bank"]+$_POST["bet"])."' WHERE type='4' AND land='".$info["land"]."'"; I get UPDATE users SET cash='12000' WHERE login='Goed' AND UPDATE objecten SET bank='775807' WHERE type='4' AND land='1' as output, so the variables are set. By the way, if I throw these outputs in PHPMyAdmin, the query works perfectly.
-
Hi, When I run an UPDATE query in my PHP code, nothing happends, no errors or anything. The weardest thing is, is that if I echo the query, it's the correct output. Any other queries that come after them are still executed. This is my query code: mysql_query("UPDATE users SET cash='".clean_string($info["cash"]-$_POST["bet"])."' WHERE login='".$info["login"]."'") or die(mysql_error()); mysql_query("UPDATE objecten SET bank='".clean_string($object["bank"]+$_POST["bet"])."' WHERE type='4' AND land='".$info["land"]."'") or die(mysql_error()); Thanks in advance, iRoot121.
-
Hi guys, I was wondering, is it possible to split an array into pages with 10 values on each page? And how can I make a navigation bar with Page 1 2 3 in it? And if it's possible, how would I do that? Thanks in advance, iRoot121
-
Hi guys, I had a question about how to do a safe query. For example, I've a query like SELECT * FROM users WHERE login='".$_GET["x"]."' Do I need to do more then just adding mysql_real_escape_string(), or is that one just enough? And how goes it for the INSERT, UPDATE, DELETE statement? And do you need to parse the output from a database before displaying it? Thanks in advance,
-
I asume you want to have some sort of userlist, with a link to each user's profile. So, if this is the case, you can do something like this: Members.php: <?php $sql = mysql_query("SELECT * FROM `users` ORDER BY `id`"); if ($sql) { while ($info = mysql_fetch_array($sql)) { //Some userinfo here. //The link to the user his profile. echo '<a href="profile.php?user='.$info["id"].'">More info about this user.</a>'; } }else{ die(mysql_error()); } ?> Profile.php: if (!isset($_GET['user']) || $_GET['user'] == "") { echo 'Please insert a user to lookup..'; exit; }else{ $sql = mysql_query("SELECT * FROM users WHERE id='".$_GET['user']."'"); if (mysql_num_rows($sql)>0) { while ($info= mysql_fetch_array($sql)) { //User information to display. } }else{ echo 'This user isn\'t in our database!'; exit; } }
-
I don't think there is one. Except that the table needs to be sorted again after a cache clean.