Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Most likely, if it does not work, then no. The get is not getting the id. <?php $t = isset($_GET['topic'])?(int)$_GET['topic']:null; if (isset($t) { echo "{$t} was passed in, yay!"; }else { echo "Get data was not appened to the url like http://yoursite.com/script.php?t=2"; } ?> Give that a try and see what happens.
  2. <?php include($_SERVER['DOCUMENT_ROOT'] . "/includes/db.php"); ?> I tend to use the php variable document_root when including files so it includes it via the absolute path, not relative.
  3. Try this pattern and see if that works better for ya. $pattern = '/^((1?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(1?\d{1,2}|2[0-4]\d|25[0-5]){1}$/';
  4. Your never incrementing $i, so it is always 0. Also the 'type' column will never get displayed because you only have one output. There is really no need for the $i echo $dateavail[0] . "<br />"; echo $dateavail[1] . "<br /><br />"; Should display the data.
  5. system would allow you to access your system's zip functions and allow you to use the command line for it.
  6. You should not save files as just ".inc". You should save them as ".inc.php" for security reasons. As far as why, show the code and maybe we can help.
  7. Send the filesize with the header. It should tell the browser how long to stay open.
  8. FYI. echo '<img src="$newname">'; Will not work. The $newname is taken literally in single quotes. echo '<img src="' . $newname . '">'; Would work.
  9. With the image tag: <?php $string = '<p>Also from the wonderful Tank Theory line is this nice Comrade t-shirt. She’s not all that innocent, not that she really looks it, but if you inspect the shirt closer you’ll see she is hiding something on the back. The shirt is now available in red with black wterbased print, and gold foil accents.</p> <p><a title="Tank Theory Comrade" href="http://www.tanktheory.com/store/standard-t-shirts/product/comrade/" target="_blank"><img class="alignnone size-full wp-image-2642" title="m_509_tank_theory_red" src="http://www.birdfight.com/blogfiles/wp-content/uploads/2009/02/m_509_tank_theory_red.jpg" alt="m_509_tank_theory_red" height="400" width="399"></a></p>'; $string = '<p>testing this other image <img src="blahblah.jpg" height="50">'; if (stristr($string, "<img") !== false) { if (preg_match('~<img.*width="(.*)".+?>~is', $string) > 0) { $string = preg_replace("~<img(.*)width=\"(.*)\"(.+?)>~is", "<img$1width=\"500\"$3>", $string); }else { $string = preg_replace("~<img(.+?)>~is", "<img $1 width=\"500\">", $string); } } echo htmlentities($string); ?> Tested for both (commented out the lower one to test to upper). It worked as expected. As far as if there is a better way to do this, no clue, probably since I am still new to regex. I am working on a better way to do it
  10. Can you store a function as a variable? I.e. $variable = add(); AS long as the function returns something. <?php function myFunc() { return "Test"; } $val = myFunc(); echo $val; // echos "Test" ?>
  11. Instead of echoing out, why not store the output in a variable then return that variable and echo that out where you want it to go in the script?
  12. The database is going to be quicker and more efficient than the xml and much more easier/versatile. I would stick to that. To answer your question, stristr.
  13. The function call is what I meant. And no a function being defined is just that. It is a set of responses that when called it processes it. The function declaration could be at the end of the page but what matters is where you call the function, as Mad was kind to show you with an example. function
  14. No, it coincides with the name, how he had it is correct.
  15. Nope, and looking at insert into I guess you can do it the way you had it, weird. The reason it requires another page refresh is because you call the function "add" after the data processing has been done. Move that portion above the data fetching portion and it should work.
  16. Your mysql connection gets started below 2 of the delete queries. Move that above them and it should work.
  17. Either use Session to store/repopulate the data or use GET. That is you want it done automatically. If you would rather have a user push a "Post More" button you add the post data to a form in hidden input fields and make that action go to the next posting.
  18. Your query is bad. mysql_query("INSERT INTO Things SET ThingID='', Thing='$addthing', Amount='$addamount' WHERE AccountID='".$AccountID."'"); Should be mysql_query("INSERT INTO Things (ThingID, Thing, Amount, AccountID) VALUES ('', '$addthing', '$addamount', '".$AccountID."'"); Or you really meant to update it: mysql_query("UPDATE Things SET ThingID='', Thing='$addthing', Amount='$addamount' WHERE AccountID='".$AccountID."'");
  19. Create an image script that runs what you need for tracking, then displays a transparent png or gif image. Include this on each page you want to track and viola, you have tracking.
  20. eregi is being depreciated. Better to use preg_match What is the goal of the script. Please provide what is being input and what you expect the output. Also what are possible values of $post_eregi ? $the_e = preg_match("~(\*נעול\*)~i", $post_eregi); Give that a try and see if it works for you. Edit, it converted that text to the ascii, replace that with everything between the *'s
  21. Aside from what Mad posted. Another way is to do a header redirect after the processing is done and send them to a thank you page (or the same page with something set so it just thanks them.) Doing the header redirect will wipe out all post data.
  22. Single quotes interpret the $ literally. $var = $content_data[$this->row]; They are not needed for a variable, so remove them and it should work like you expect.
  23. Change the input field type to be type="password" and it will hide it. This does not encrypt it, however. You have to do that on your end in the php code however you want to do it. Whether it is encrypting it or hashing it with md5.
  24. Create a page profile.php where it accesses a get parameter (user). So someone can call the page profile.php?user=bob and it will show bob's profile. On the page you do a check make sure it is valid data, query the database for the username bob. If he is found display is information, if not then show a "user not found" message. Yes, during signup process you would put his information in the database so you can access it later. The profile script is simply reading from the table in the db, and should not really be doing anything else.
  25. That method has to be defined in your class. It is not: <?php class myClass { public function __construct() { $this->value = "test"; } public function __toString() { return $this->value; } } $class = new myClass(); echo $class->__toString(); // echos "test"; ?>
×
×
  • 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.