Jump to content

sqlnoob

Members
  • Posts

    173
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.romegames.nl/

Profile Information

  • Gender
    Male

sqlnoob's Achievements

Member

Member (2/5)

0

Reputation

  1. error no doesn't work, as nothing happens beyond the update as for the user ID I am aware of that. The actual one will have a random key, which i left out here.
  2. <?php //COOKIE CHECKER if (isset($_COOKIE["person"])){ if (filter_var($_COOKIE["person"], FILTER_VALIDATE_INT)){ $user_id = $_COOKIE["person"]; //DATABASE CONNECTION VARIABLES $myserver ="localhost"; $myname = "username"; $mypassword = "password"; $mydb ="dbname"; /*SQL CONNECTION*/ // Create connection $conn = new mysqli($myserver, $myname, $mypassword, $mydb); // Check connection if ($conn->connect_error) { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY> <H1>Decline of the Han - Three Kingdoms</H1>'; die("Connection failed: " . $conn->connect_error); echo '</BODY> </HTML>'; } else { //COUNT USER $cquery = "SELECT COUNT(*) AS usercheck FROM Players WHERE ID = ?"; $cid = $conn->prepare($cquery); $cid->bind_param('i', $user_id); $cid->execute(); $cid->bind_result($usercheck); $cid->fetch(); if ($usercheck ==1){ if (isset($_POST["profile"])){ if(!filter_var($_POST["profile"], FILTER_SANITIZE_STRING)){ echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">Unable to filter bio <a href="biography.php">return</a></P>'; echo '</BODY> </HTML>'; } else { $profile = $_POST["profile"]; $sql = "UPDATE Player_Data SET Bio =? WHERE ID=?"; $q = $conn->prepare($sql); $q->bind_param("si", $profile, $user_id); $q->execute(); echo '<P>Biography altered <a href="biography.php">return</a></P>'; //close connection $conn->close(); } } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">'.$usercheck.' '.$user_id.'</P>'; echo '<P class="error">No such user found!</P>'; //close connection $conn->close(); //foot echo '</BODY> </HTML>'; } //end connection check } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">ERROR invalid cookie!</P>'; echo '</BODY> </HTML>'; } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">No cookie detected!<br><a href="login.php">login</a></P>'; echo '</BODY> </HTML>'; } ?> I have an error in the update, but I am not seeing where I made it. Its annoying because the update won't execute and anything beyond the update isn't visible in the html source code in the browser, so it is likely to be a syntax error, but where?
  3. thanks for the replies guys. That was what I needed.
  4. //DATABASE CONNECTION VARIABLES $myserver ="localhost"; $myname = "myname"; $mypassword = "mypassword"; $mydb ="mygamedb"; /*SQL CONNECTION*/ // Create connection $conn = new mysqli($myserver, $myname, $mypassword, $mydb); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } else { //variables $username = $_POST["username"]; $password = $_POST["password"]; $ip = $_SERVER['REMOTE_ADDR']; //INSERT USER //prepare and bind $stmt = $conn->prepare("INSERT INTO Players (Username, Password, IP) VALUES (?, ?, ?)"); //bind parameters $stmt->bind_param("sss", $username, $password, $ip); //set parameters and execute $stmt->execute(); //close $stmt->close(); //FETCH ID $resultnews = mysql_query("SELECT * FROM Players WHERE Username ='$username'"); $rownews = mysql_fetch_array($resultnews); $user_id = $rownews["ID"]; } After having suffered an SQL injection into one of my sites, I figured it was time to overhaul it and use prepared statements. I am new to this. I figured out how to an INSERT with an example, but now I need to fetch an ID and cannot get it to work. Any help much obliged. All I need is just one good example. Looked all over the place, but all I get are insert examples, which is NOT what i need. Really need one with a select and fetch.
  5. hello all, Can anyone recommend an ftp program, that is able to open a map that contains thousands of smaller maps with thousands of photos. For some reason I'm unable to download let alone open a map via ftp that has about 17.000 maps in it with about 20.000 photo's. I've tried filezilla, fireftp, leechftp, none of which do the trick. I use windows vista.
  6. ok first to dispell some myths you seem to have 1) the ajax software doesn't store the data into a php file, it stores it in a sql database and things like usernames or user ID's are stored in a cookie 2) during login a cookie is set, either a normal cookie or a session cookie. Cookie setting must be done before any other html is sent, else the cookie will not set. 3) if said software prints or echoes html in the script before the cookie is set, then chances are you are better off writing the script from scratch, because it will most likely take longer to integrate both softwares, then to rewrite the entire dating site (regardless of whether someone is familiar with etano or not) would be happy to help you with this problem, but alas I do not live in Vermont. I reside in the Netherlands.
  7. OK tried it with an internal stylesheet and that works allright. Apparently if you use an external stylesheet with a Japanese character set, that isn't supported in firefox and chrome. I don't know why that is so. Perhaps because the stylesheet is not iso, that causes problems for firefox and chrome but not for internet explorer. Would love to hear a suggestion where it works with an external stylesheet.
  8. the character set is clearly supported https://developer.mozilla.org/en-US/docs/Gecko/Character_sets_supported_by_Gecko but somehow the character set prevents the stylesheet from being loaded
  9. ^ OK tried that. Doesn't work! Also doesn't work in IE. Thanks for the suggestion though. Got any more suggestions?
  10. also tried it without the pre tag. It doesn't work. For some odd reason Firefox and Chrome don't support stylesheets with Japanese Kanji in the html.
  11. hi http://www.shugo.nl/shugo7/manual/kanji.php I am trying to make the stylesheet work in all browsers. So far I notice that this page with a pre tag for the japanese kanji only works in Internet Explorer. I'm trying to make it work in Firefox and Chrome too. I tried html 4 transitional and html 5, neither of which works. The only thing Firefox and Chrome loads is the pre tag, but not the stylesheet.
  12. I have a browser based strategy game hosted on starthosting.nl It's a really cheap host, you can get it for as little as 1 euro a month (to be paid annually). The host offers php and sql. Premium allows for a maximum of 10 sql databases and as much mail accounts. Downtime is about 2 times a year and usually for a few hours. Downsides are that it offers no tech support whatsoever (not something i had problems with as everything works fine), you can't do cronjobs with the account and the server seems to be slow sometimes. The major downside however is the limited bandwidth you get (it's only 5 GB per month). I expect the activity of my site to pick up this september (when schools start, i have a lot of students playing my game) and i'll probably get close to my bandwidth limit. Right now the game allows for a maximum of 200 players (due to bandwidth), but i'm looking to expand my game. Right now I'm searching for a host that offers the following: -1 lots of bandwidth for a low price -2 allows for unlimited amount of sql databases -3 allows to do cronjobs -4 has a fast server capable of handling large amounts of users who login at the same time I've done some google searches and have looked and compared some dutch hosts. Right now i'm leaning towards simple-hosting because a basic account offers 40GB of bandwidth for 5 euro a month (= 60 euro a year, a price i can/willing to afford). However I have no idea how many sql databases i get with that account and i don't know if they allow to do cronjobs. also... The FTP upload of the account has to be basic and simple. Right now I'm using leechFTP to upload the pages (which works fine with my old computer (98se, yes not joking)). I realize i'm being very picky, but if any of you know a host that offers what i'm looking for, then i love to hear 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.