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. segfault is when your script uses up more CPU than the server can deliver. In essence your script has so many calculations that the server can't handle the workload. In other words it CRASHes, hence the random 500 internal server errors. You get the 500 error when the script has too many calculations to execute and you don't get the error when the script doesn't have too many calculations to execute. Let's say the server can handle a maximum of 10,000 rows, if the script fetches 10,001 rows or more it will crash and cause a 500 internal server error, if the script fetches 9,999 rows it will calculate it and serve the page just fine. The only solution is to limit the number of calculations in the script. For example: if you fetch 1 million rows from the sql database and then perform calculations on the fetched data, then the server will crash. The solution is to limit the number of rows fetched by let's say a 1000 rows.
  7. 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.
  8. 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.
  9. 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
  10. ^ OK tried that. Doesn't work! Also doesn't work in IE. Thanks for the suggestion though. Got any more suggestions?
  11. 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.
  12. 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.
  13. Hi, Some woman did an update for her wordpress website. It may have changed or removed some files. I have no way of determining if that is so, because she can't tell me what update she made. The error I see is the following: Warning: Invalid argument supplied for foreach() in /usr/home/deb27616n2/domains/plezierinleven.nl/public_html/wp-includes/query.php on line 1702 This is all I know. She can't tell me anymore and she can't define or tell me what exactly she did and what update she performed. If someone has an easy answer for this, with a quick recode of that function. It be much appreciated, because I don't know where to look for. Whether it is a misreferenced variable, or a missing variable because a file has been deleted I don't know. The error is on line 1702 in the query.php file in the directory of wp-includes: foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { if ( 'post_tag' == $taxonomy ) continue; // Handled further down in the $q['tag'] block if ( $t->query_var && !empty( $q[$t->query_var] ) ) { $tax_query_defaults = array( 'taxonomy' => $taxonomy, 'field' => 'slug', ); if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) { $q[$t->query_var] = wp_basename( $q[$t->query_var] ); } $term = $q[$t->query_var]; if ( strpos($term, '+') !== false ) { $terms = preg_split( '/[+]+/', $term ); foreach ( $terms as $term ) { $tax_query[] = array_merge( $tax_query_defaults, array( 'terms' => array( $term ) ) ); } } else { $tax_query[] = array_merge( $tax_query_defaults, array( 'terms' => preg_split( '/[,]+/', $term ) ) ); } } }
  14. it was {width: 50%; height: auto;}
×
×
  • 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.