Jump to content

joquius

Members
  • Posts

    319
  • Joined

  • Last visited

Everything posted by joquius

  1. You might want to try the AJAX library http://www.townofajax.com/page15.aspx
  2. Ah ok I finally understand what's going on. <input type=\"hidden\" name=\"Id\" value=\"$noticia[id]\"/> Where is $noticia[id] from? Where is the changeable input field? $layout_id = "echo POST_['Id']"; should be $layout_id = isset ($_POST['fieldname']) ? $_POST['fieldname'] : $defaultvalue; A lot of other things but this is a start.
  3. First of all you might want to have more punctuation in your sentences, it's hard to understand the connection between what's gone wrong and what you actually need. Are you trying to UPDATE the mysql table with the new value?
  4. PHP is not a system for storing and retrieving data. What you need is to either: (1) Store all your page content in a MySQL database and then search that with the help of PHP. (2) Use Python to make a cache of all the pages on the site, and this search this cache (much like Google). I wouldn't use PHP to do a scheduled caching of a site, you can but I think it's better to use Python for stuff like that.
  5. G.php is just a file with a function, and if there is nothing to run that function in G.php you'll just get a blank page. Your post should be leading the user to your main script which should be running the G.php function when (1) you want to display the form and (2) when you want to process the form data from a post. You need to differentiate between display the form and posting. For example: <?php require_once ("filewithformfunctions.php"); if (!isset ($_POST['mysubmitbutton')) display_form(); else $res = process_form(); if (isset ($res)) do_stuff_with_res($res); ?> Just an example. Apart from this, if you have a form which needs different functions for displaying/processing information it's sometimes better to have it as an object.
  6. First of all you need to make sure G.php is included for displaying the form and getting the post values. The way you wrote this is somewhat reminiscent of a javascript pop up. You do understand the differences right? Anyway paste the form code in so we can see why the forms going to G.php.
  7. Ok so the script just doesn't have a default "not logged in" text. Sadly my time zone is not very sympathetic to your problem, and as it is 2:15am here I can't rewrite the script for you.
  8. Interesting I was just thinking the same thing.
  9. First of all checking for form submissions with "if ($_POST['cake'])" will throw warnings when nothing is posted. Better to use "if (isset ($_POST['pudding']))". "Checkbox01_I_Accept_all_the_Terms_and_Conditions" has to be the name of a posted field. As far as I can see, there's no such form input field setup anywhere in your code with that name. If you want to find out what fields are being posted you can just get php to vomit them out for you: var_dump ($_POST);
  10. First all of what do you mean by putting one variable from one script into another? What is it you are actually trying to do? Are you getting any error messages? What is happening with your script?
  11. Can you post some actual PHP code to help solve the problem?
  12. The failure is due to the fact that $ext is a value and $extensions is an array. What you would need is "!in_array ($ext, $extensions)" and not "$ext != $extensions". Apart from that, you're better off using regex for this: $extensions = array ("jpg", "jpeg"); if (!preg_match ("/\.(".implode ("|", $extensions).")$/", $file)) // where $file is the fullname of the file
  13. Is this a topic table or do only have one table for everything? Is forumtutorial_posts the only table? Apart from that the SUM() needs to be on the numreplies not the id..
  14. preg_match_all ($pat, $str, $matches) matches are returned in the format of $matches[sub pattern index] = sub pattern matches
  15. I think your fields are wrong, use mysql_query ("...") or die (mysql_error ());
  16. What's this: $_POST[$file]; Where is $file set? There's no point in sending a form when you don't know what the names of the fields are going to be. The values should be variable not the field names.
  17. Create a table, for user activity with the `user_id` and `activity` fields, each time a user does something on the site update the value of `activity` to time(). Then just do "SELECT COUNT(`user_id`) FROM `user_activity` WHERE `activity` + 1800 > ".time(); You can set 1800 (seconds since active) to whatever you want.
  18. Your code: $thename=remove_none_letters_and_numbers($_get['name'])// the part i added but dont know how to make work turns into: $thename = preg_replace ("/[^a-zA-Z0-9]/", "", $_GET['name']); or if you like function clearInvalidChars ($str) { return preg_replace ("/[^a-zA-Z0-9]/", "", $str); } $thename = clearInvalidChars ($_GET['name']);
  19. What would be even more helpful is the error text. Do you have sufficient permissions for the directory/files?
  20. Common issue: http://www.google.com/search?q=IE6+php+cookies&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
  21. What are you trying to remove these chars from? a string? $str = preg_replace ("/[^a-zA-Z0-9]/", "", $str); // this?
  22. stripslashes($text);? And if you don't want html tags you're better off using: $text = str_replace ("<", ">", $text); $text = str_replace (">", "<", $text); I may have greater-than and less-than mixed up, I can never remember which is which.
  23. First of all it's good practice to have a topic/post number field in each table, updated after each post to have less queries. For the moment, assuming the topics table name is "topics" $counts = mysql_fetch_array (mysql_query ("SELECT COUNT(`postid`) as count, SUM(`numreplies`) as sum FROM `topics` WHERE `forum` = 'general'")); $counts['count']; // topic num $counts['count'] + $counts['sum']; // posts (replies + first post in topic)
  24. joquius

    Help

    Man unless you are actually referencing a string you need to escape the $ at the beginning of the eval. What this has to do with OOP is beyond me.
×
×
  • 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.