Jump to content

mighty2361

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by mighty2361

  1. I can't use post as I am using java http request.
  2. I made a script, asked for help here and somebody told me what I was doing wrong. But now, it won't insert the data in a database. CODE: <?php $myusername = $_GET['user']; $mypassword = md5 ($_GET['pass']); $reportedplayer = $_GET['reportedplayer']; $by = $_GET['by']; $reason = $_GET['reason']; $host = "mysql.0adshost.tk"; $username = ""; $password = ""; $db_name = ""; $tbl_name = "users"; mysql_connect ($host, $username, $password)or die("Cannot connect"); mysql_select_db($db_name)or die("Cannot select db"); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql) or die("Error: ". mysql_error(). " with query ". $sql); $count=mysql_num_rows($result); if($count==1) { mysql_query ("INSERT INTO `reports`(`user`, `reportedplayer`, `by`, `reason`) VALUES ($myusername, $reportedplayer, $by, $reason)"); echo "SUCCESS!!!"; } else echo mysql_error; ?> I added echo "SUCCESS!!!" and it echoes "SUCCESS!!!" but it won't write to database for some reason. What am I doing wrong?
  3. I made a plugin for bukkit gameserver which uses java http request for mysql queries so people won't be able to see the mysql password by decompiling the java code. Then I made a php script which should instert something in a database but it says: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/u177206076/public_html/*****.php on line 7 I added this: or die("Error: ". mysql_error(). " with query ". $sql); and then it says: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/u177206076/public_html/report.php on line 7 Error: Unknown column 'mighty2361' in 'where clause' with query SELECT * FROM users WHERE username=`mighty2361` and password=`**********` (I use md5). <?php $myusername1 = $_GET['user']; $mypassword1 = md5 ($_GET['pass']); $reportedplayer = $_GET['reportedplayer']; $by = $_GET['by']; $reason = $_GET['reason']; $count=mysql_num_rows($result); $host = "mysql.0adshost.tk"; $username = ""; $password = ""; $db_name = ""; $tbl_name = "users"; mysql_connect ($host, $username, $password)or die("Cannot connect"); mysql_select_db($db_name)or die("Cannot select db"); $myusername = stripslashes($myusername1); $mypassword = stripslashes($mypassword1); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username=`$myusername` and password=`$mypassword`"; $result=mysql_query($sql) or die("Error: ". mysql_error(). " with query ". $sql); if($count==1) { mysql_query ("INSERT INTO `reports`(`user`, `reportedplayer`, `by`, `reason`) VALUES ($myusername, $reportedplayer, $by, $reason)"); } else echo mysql_error; ?> The mysql table, user and pass aren't empty. I just don't want people to see them. Please help because I'm really new to PHP and I am probably too young for it.
×
×
  • 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.