Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by sqlnoob

  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;}
  15. actually i just put the rows next to eachother that contain words that have the same combination of letters on the end. This allowed me to fetch the records according to ID number. It chaves seconds of the time it takes to run the query.
  16. I still haven't found the solution to this problem.
  17. Hi I have a problem with image width and height. Apparently the images are the correct size on a windows computer, with the internet explorer, firefox, chrome or safari browser. But the height is wrong on a mac computer using the safari browser. The uploaded images on the server can be of any size. The visitors screen resolution varies, so that's why I set the width in percentages, because I don't want the picture being wider than 50% of the page. I see that picture is distorted in safari using a mac computer. The width is correct, but the height is wrong. The safari browser doesn't want to get the height in percentages for some reason. How do I solve this? CSS CODE: IMG.zooma {width: 50%; height: 50%;} DIV.edger {padding: 10px; border-style: solid; border-width: 1px; border-color: #000000;} PHP CODE: <DIV class='edger'> <P> <A HREF='fotoview.php?photo=".$photoid."&zoom=full'>".$photonom."</A> </P> <A HREF='fotoview.php?photo=".$photoid."&zoom=full'> <IMG src='pictures/".$photofile."' border='0' class='zooma'> </A> </DIV>
  18. no wait, it is optional, nevermind http://www.w3schools.com/php/php_mail.asp
  19. Hello fellow Dutchie... Have you tried this: $to ="stijn03@hotmail.com"; $subject ="Stijn zijn Contact Formulier"; $email = $_POST["fromwhosemail"]; mail($to,$subject,$message,"From: $email"); I think, it doesn't send an email, because there's no headers. Those are not optional, if my memory serves me correct they are mandatory in the mail function.
  20. I had the same problem with the filter. Whenever users wanted to post a message with an apostrophe in it, it would just go blank. Here is how I solved it. $filtermessage = $_POST["messagetext"]; $rawmessage = str_replace("'","\'",$filtermessage); filter_var($rawmessage, FILTER_SANITIZE_STRING);
  21. Hi, not sure where to put this thread, but here goes. I have a few users on handheld devices, iphones and ipads, who seem to get stale pages on my website. Things work ok on desktop computers. I doesn't matter what kind of page it is. It could be a html 4.01 transitional page, or a dynamic php page, a dynamic php page with javascript, a php page with javascript and svg. It doesn't matter. Some of these users tell me the pages just don't refresh. Pressing F5 doesn't seem to help either. With some users this started to occur moments after they had installed a flash player update. Others had issues with firefox prior to that. I have phone users with IE9, firefox 8, and chrome. Some don't have any problems, others do have problems. I can find no discernable pattern in it. Does anyone know what is the matter and how this can be fixed?
  22. anyhow this is really weird why would a table work around a html form and not a div? I think I've tried a div before and it worked then, but somehow it doesn't work now. It's mindboggling?! It doesn't seem to make sense. It must be something really silly and simple. Or perhaps it's due to some error in the css. Oh well, table works fine. I'll just do it that way.
  23. you must have opened it just when i was about to remove that page. I've now removed rymwurden page. You can still see this one http://www.rymwurdboek.nl/index.php
  24. anyhow I removed the div around the html form and replaced it with a table and now it seems to work fine is this some weird firefox oddity that I'm not aware off like you know numbered ID's (another thing firefox doesn't accept)?
  • 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.