Jump to content

AbraCadaver

Staff Alumni
  • Posts

    1,893
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by AbraCadaver

  1. Did google tell you that there is rarely if EVER a good reason to use variable variables? Use an array: if ($pos[$i] == '1234') Post more code if you are still unsure.
  2. That's probably a bad idea. You might want to read up on database design and normalization so you don't run into problems down the road. But the simple answer is this, with no foreach loop: require 'databaseconnect.php'; if(isset($_POST['select'])) { $movies = implode(',', array_map('mysql_real_escape_string', $_POST['select'])); $run = "INSERT INTO `test` VALUES ('','$movies')"; $result = mysql_query($run); } Also, get off of the mysql_* functions and use mysqli_* or PDO.
  3. Well, we'll hope that somebody with more charset knowledge than me reads this, as that is the extent of my knowledge there.
  4. That was a long post with surprisingly little information. Error reporting on? What errors? Just a shot in the dark, are you using sessions and are you saving the BOM in your files? Notepad++: Settings > Preferences > New Document > UTF-8 without BOM, Apply to opened ANSI files? The BOM will cause issues, especially with sessions.
  5. if(isset($_POST['select'])) { foreach ($_POST['select'] as $key => $value) { Don't use [] with the $_POST var.
  6. Go to Settings > Style Configurator and select Language: PHP and Style: WORD, then add them under User-defined keywords. Notepad++ is a notepad with some scripting features, not a PHP editor.
  7. I have no idea what your directory structure is, but maybe: include ("includes/functions.php");
  8. Sorry, I was wrong. allow_url_fopen affects file_get_contents() etc. allow_url_include determines whether you can include/require. When using any of those you us // not \\ in http://
  9. Wrong website. You're looking for another kind of freaks.
  10. If you click: <a href="gameInfo.php?id=<?php echo $_SESSION['id']; ?>"> (notice I changed it) Then on gameinfo.php, you get the id with: $id = $_GET['id'];
  11. If you can't require the file on the remote site, then most likely allow_url_fopen is off. You can try this on the remote site pages: <script type="txt/javascript"> xmlhttp.open("GET","http://yoursite.com/tracker.php", true); xmlhttp.send(); </script> Or your tracking script could output a 1px transparent image and your remote site pages would just use: <img src="http://yoursite.com/tracker.php">
  12. If the error is from that line number then check the previous line.
  13. First, don't do that! Create another table for the selected workshops and store individual workshop ids along with the persons id: person_id workshop_id 5 1 5 14 5 12 5 7 13 1 13 11 13 9
  14. OK, I was bored. Just a simple example with regex: preg_match_all('/function([^\(]+)\s*\(/i', $file, $functions); print_r($functions[1]); preg_match_all('/\$([a-z_][a-z0-9_]*)/i', $file, $variables); print_r(array_unique($variables[1]));
  15. Might check reflection class (but I think they will need to be loaded), or: print_r( token_get_all ( file_get_contents( $filename ) ) );
  16. Probably an easier pattern, but: $var = preg_replace('/,1\b|\b1,/', '', $var);
  17. Just paste the ping code in the existing while loop and format the echo how you want inside a td /td or whatever.
  18. Assuming everything that you've shown is working independently, just add your ping.php code into the while loop in list.php and change the 8.8.8.8 to $row['IP_Address'].
  19. Also, phpMyAdmin http://www.phpmyadmin.net/home_page/index.php
  20. Why not just: SELECT QuestionId FROM Questions WHERE CategoryId = ? ORDER BY RAND()
  21. // assuming this is from a trusted source meaning you or your teacher.
  22. Lots of ways depending on what you want to achieve overall. Here are two: $requestURI = $_SERVER['REQUEST_URI']; $something = basename($requestURI); if($something == '/articles') { // do something } if(preg_match('#/articles/\d+#', $requestURI)) { // do something } EDIT: I'm late today.
  23. Haha, yes, wait till you use strip_tags() and stripslashes(), but wait, there's more.... how about some functions take ($needle, $haystack) and some take ($haystack, $needle)? That would be just plain crazy. EDIT: Seconds late
  24. Lots of problems: 1. You need to run the POST vars through mysqli_real_escape_string() or use prepared statements before using them in your query. 2. Your form input is name etc. and you are trying to use $_POST[Name]. 3. You're mixing mysql and mysqli functions which won't work. etc...
×
×
  • 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.