Jump to content

TreeNode

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Everything posted by TreeNode

  1. similar problem and solution here: http://www.hu-forums.com/archive/index.php?t-934.html
  2. combine the variables to the url, for example: var pars = 'content='+new_content+'&edit=true'; var url = 'edit.php' . '?' . $pars;
  3. wildteen88 is right, but also keep in mind that anything in double quotes is "evaluated" by the PHP parser so in a very miniscule way outputting something in double quotes that doesn't need to be takes longer than using single quotes, unless of course you ARE outputting a variable. Additionally, by keeping your HTML only output in single quotes, you'll be able to read it easier (no slashes). I would suggest this: print '<a class="sidelink" href="http://www.lds.org">LDS Church</a><span class="hide"> | </span>' . "\n"; edit: Oops, forgot to say that also in a very miniscule way, technically echo is faster than print, since echo does not return a result.
  4. You will not get the precise bandwidth usage for a file if all you do is multiply the times downloaded by the size of the file. This does not take into account the people who canceled the download. If you don't know PHP, you could always look into server logs, possibly even download another free software program that could parse out that information for you.
  5. It seems as if the solution is more in re-writing how you define the current working directory while you navigate instead of parsing out the required information every time. Maybe you could just keep a record (variable) of the current working directory alongside the ridiculous path string you are building? Just some ideas.
  6. with Ilya's code it should be something like: <?php $hosturl = $_POST["hosturl"]; $mtitle1 = $_POST["mtitle1"]; $content=$hosturl . "," . $mtitle1 . "\n"; $filename="yourfile.txt"; $fin=fopen($filename,"w"); fwrite($fin,$content); fclose($fin); ?> if you're still having problems with this then you don't have proper permissions to write to that file.
  7. Are you always expecting at least one result? Drop the first mysql_fetch_assoc and make your loop a while-loop
  8. <?php ob_end_flush(); ... do a bunch of stuff ... set_time_limit(30); flush(); ... ?> I use set_time_limit(30) if I suspect that the script will run longer than the defaulted time allocated for php (30 seconds). FYI, don't use this unless your script is expected to run for a long time, no script should ever run this long if it's being used publicly.
  9. replace $data = mysql_query("SELECT * FROM stock WHERE upper($field) LIKE'%$find%'"); with $find_array = explode(" ", $find); $find_sql = ""; // init foreach ($find_array as $temp) $find_sql .= "LIKE '%$temp%' OR "; $find_sql = substr($find_sql, 0, -3); // throw away last OR statement $data = mysql_query("SELECT * FROM stock WHERE upper($field) $find_sql");
  10. Re-work your logic from the beginning. Your script is working as you made it, session variables are tied to the specific host and computer in which it is calling it, so if another file is outputting session variables that were assigned in a different file, as long as its the same host/client it'll be the same values. One of the ways to fix your problem is to include the searched text on the page tabs, so it re-runs the query for every tab you choose. Or, you could have all of the pages/tabs outputted and you simply use javascript to navigate from one to the other (they would all be parsed out and unchanged that way).
  11. I'm guessing you mean IIS log files, which are in most cases flat files to begin with. You can find some good comma/tab delimiter classes around for PHP. Also, some logs can be stored directly to an SQL database so that'll just take querying that database.
  12. If you are in fact using an older version of PHP (4.0 or earlier) you'll definitely have problems. Try this code that was directly from PHP.net, it might not be the best but it should work as a more manual way of getting information about a remote file: function getimagesize_remote($image_url) { $handle = fopen ($image_url, "rb"); $contents = ""; if ($handle) { do { $count += 1; $data = fread($handle, 8192); if (strlen($data) == 0) { break; } $contents .= $data; } while(true); } else { return false; } fclose ($handle); $im = ImageCreateFromString($contents); if (!$im) { return false; } $gis[0] = ImageSX($im); $gis[1] = ImageSY($im); // array member 3 is used below to keep with current getimagesize standards $gis[3] = "width={$gis[0]} height={$gis[1]}"; ImageDestroy($im); return $gis; } Another option is to do what I do, create another script on the server that houses the images, that script is just a function that can either manipulate an image and cache it or just return the image information.
  13. You can do a full-text search (which doesn't sound like what you want) or you'll need to build the query more than what you have already. Try exploding the input and build the query like so: $find_array = explode(" ", $find); $find_sql = ""; // init foreach ($find_array as $temp) $find_sql .= "LIKE '%$temp%' OR "; $find_sql = substr($find_sql, 0, -3); // throw away last OR statement $data = mysql_query("SELECT * FROM stock WHERE upper($field) $find_sql");
  14. Is the file local? I know when considering the GD library and images in general with PHP has some problems when trying to get images from non-local machines.
  15. You'll need to use cookies. This is what I have for one of my websites that hides a layer when clicked it is clicked on: function toggleLayer(whichLayer){ if (document.getElementById){ // this is the way the standards work var style2 = document.getElementById(whichLayer).style; style2.display = style2.display? "":"none"; } else if (document.all){ // this is the way old msie versions work var style2 = document.all[whichLayer].style; style2.display = style2.display? "":"none"; } else if (document.layers){ // this is the way nn4 works var style2 = document.layers[whichLayer].style; style2.display = style2.display? "":"none"; } } function componentMinMax(the_layer){ toggleLayer(the_layer); if (getCookie(the_layer) == "no") setCookie(the_layer, "yes", 365); else setCookie(the_layer, "no", 365); } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){ c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } My button or anything really will have an onclick event such as this: <a href="javascript:void(0);" onClick="javascript:componentMinMax('browsecategories');" >click here</a> And my hidden div: <?php $component_display = ""; if ($_COOKIE["browsecategories"] == "no") $component_display = 'style="display: none"'; ?> <div id="browse" <?=$component_display?> >sometimes hidden, sometimes shown</div>
  16. Great. Keep in mind that you will not always need to strip_tags, but you should use a conditional statement to check to see if globals are activated or not. Also, mysqli_real_escape_string a return function, so it should be: $checkpassword = mysqli_real_escape_string($mysqli,$checkpassword);
  17. Looks to be fine as long as your date fields are formatted correctly. Try printing out a parsed version and run that SQL statement directly into the console (or through phpmyadmin).
  18. Perhaps it has something to do with your Windows settings. You're not signed in as an admin or you have a firewall up (turn off windows firewall). Also, make sure the permissions of the XAMPP files are r/w for you. You might also want to try to grant remote access to mysql like I mentioned before hand, just give the same IP as your computer. http://textbook.textpattern.net/wiki/index.php?title=Using_XAMPP_(Apache-MySQL-PHP-Perl)_for_Windows
  19. Not really, username/password could include a simple '; <insert malicious code here>
  20. Repost your code. I'm guessing you're using a mixed method (OOP/Procedural but I don't know.
  21. Don't put the onChange event handlers on the options themselves, just put this on the select statement: onchange="this.form.submit()"
  22. from php.net: This doesn't mean that the link will return false
  23. I just realized you're using MySQLi, so, you'll need to use the MySQLi version of real_escape_string: http://us2.php.net/manual/en/function.mysqli-real-escape-string.php
  24. It should work as long as you have only 1 javascript onload event. It's easier to just create a single onload javascript function and refer to that. Like someone said earlier, your include files shouldn't actually have headers themselves (unless you have exceptions in the php code to handle that situation).
×
×
  • 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.