Jump to content

unkwntech

Members
  • Posts

    447
  • Joined

  • Last visited

Everything posted by unkwntech

  1. IDK but thats what I get. I'm still having trouble with my script though.
  2. You will need to add an exception for the images folder, because now it is trying to make /images/ forward to your index
  3. You have to use exact paths to images because the browser is stupid it thinks that it should look for images under doamin.tld/home/image.ext
  4. @Andy-H: The following: <?php $array = range(0, 100000); $start1 = microtime(TRUE); for($i=0;$i<count($array);$i++) { //do something } $time1 = microtime(TRUE) - $start1; $start2 = microtime(TRUE); $count = count($array); for($i=0;$i<$count;$i++) { //do something } $time2 = microtime(TRUE) - $start2; echo 'Time 1: ' . $time1 . ' Time 2: ' . $time2; ?> outputs the following on my system: So indeed my way was faster. I don't mean this to be argumentative, I just wanted to verify what you said and these are the results.
  5. The most common way of doing it is with mod-rewite which can give you: doamin.tld/page/myvar I wrote something up for a client that did not have access to mod-rewrite: $pages = array('home', 'products', 'services'); //This is actually an SQL query but for the sake of example. $parts = $_SERVER['REQUEST_URI']; $parts = preg_replace('%\/index\.php%', '', $parts); $parts = preg_split('%/%', $parts); foreach($parts as $part) { if(!(is_null($part) || strlen($part) < 1)) { $uriParts[] = $part; } } if(in_array(strtolower($uriParts[0], $pages))) { $sql = "SELECT title, text FROM content WHERE name='" . mysql_real_escape_string($uriParts['0']) . "' AND published='1'"; //query.... } With this the links look like domain.tld/?/home or domain.tld/index.php?/home/
  6. I'm not calling count() inside the loop.
  7. The copy of the array that I pasted was from a print_r after the loop.
  8. This is IMPOSSIBLE with PHP, however JavaScript is perfect for it, and you can find the JavaScript forum right http://www.phpfreaks.com/forums/index.php/board,6.0.html
  9. I'm beating my head against the desk with this one. I have an array, the end of the array looks like this: [2389] => 127.0.0.1 zanox.com [2390] => 127.0.0.1 zeads.com [2391] => 127.0.0.1 zedo.com [2392] => 127.0.0.1 zencudo.co.uk [2393] => 127.0.0.1 zenzuu.com [2394] => 127.0.0.1 zeus.developershed.com [2395] => 127.0.0.1 zintext.com [2396] => 127.0.0.1 zmedia.com [2397] => [2398] => [2399] => [2400] => [2401] => [2402] => [2403] => I have this code, that is processing the array before it is outputted: for($i=0;$i<count($file);$i++) { if(strlen($file[$i]) < 1) { unset($file[$i]); } } If I echo strlen($file[2403]) I get zero, but obviously the above loop should be removing it.
  10. yahoo.com, the #1 most common home page on the net. facebook.com and quite a few others, these to come to mind.
  11. 1st - When you post code please place it between [ code] and [/ code] 2nd - change: else { echo "ERROR"; } with else { echo "ERROR:" . mysql_error(); } Then tell us what it says.
  12. As its been pointed out this is a better solution the using % if($_POST['neighborhood'] == 'all') { $sql = "SELECT * FROM `apt_data` WHERE weeklyRate <= 400"; } else { $sql = "SELECT * FROM `apt_data` WHERE neighborhood = '$neighborhood' AND weeklyRate <= 400" }
  13. @cooldude832 - that is true, but I still stand by what I said.
  14. I said that because I send email to hotmail accounts with mail() without any problems, but I have the SPF records set properly in the DNS to allow my PHP host.
  15. If you have a field for 'all' as opposed to a specific neighborhood, (i.e. a real estate search, where I dont care what neighborhood as long as its in the correct city) then just set $neighborhood to '%'
  16. Weather or not a mail provider marks your mail as spam has no bearing on how you use mail. Likely the content being caught by the filter, or it is checking SPF records and your PHP host is not listed.
  17. @jordanwb - you seem to be lost. @dunnsearch - There is going to need to be some API that you can post the link to and have the anonomyzed link sent back.
  18. Dark Water is correct, as is your example. I don't see the problem.
  19. Just use javascript, use document.write('<php echo $contentToHide; ?>')
  20. //$str the string to be shortened //$n the desired length function shot_desc($str, $n, $delim='…') { $len = strlen($str); if ($len > $n) { preg_match('/(.{' . $n . '}.*?)\b/', $str, $matches); return rtrim($matches[1]) . $delim; } else { return $str; } }
  21. I wrote this script but it is not working as expected, If should read http://pubredirect.servercommand.org/cod4/usermaps/ then for each folder it should get each file inside those folders and download it to a local directory. However each file in the directories is being written as the same file, so I end up with 3 files of the same size and content. <?php ini_set('allow_url_fopen', '1'); $root = 'pubredirect.servercommand.org/cod4/usermaps/'; $localFolder = 'C:\Program Files\Activision\Call of Duty 4 - Modern Warfare\usermaps'; $f = file('http://' . $root); $f = preg_replace('/\<br\>/i', "\n", $f['2']); preg_match_all('%/cod4/usermaps/.*?/%i', $f, $dirs); $numFiles = count($dirs['0']); echo "There are " . $numFiles . " maps to download.\nThis will take some time.\n\nThis was built for ->TYL<-\n\t\thttp://tyl.clanservers.com\n"; $curFile = 1; foreach($dirs['0'] as $folder) { echo "Now downloading map " . $curFile . "/" . $numFiles . " Map Name: "; $folder = preg_replace('%/cod4/usermaps/%', '', $folder); $folder = preg_replace('%/%', '', $folder); $remoteRoot = $root . $folder . '/'; $subF = file('http://' . $remoteRoot); $subF = preg_replace('/></i', ">\n<", $subF['2']); $subF = explode("\n", $subF); foreach($subF as $line) { if(preg_match('/<br>\s*?[a-z]{6,9},\s[a-z]{3,9}\s[0-9]{2},\s200[0-9]{1}\s*?[0-9]{1,2}:[0-9]{2}\s*?(?:a|p)m\s*?[0-9]*?\s*?<a href="/i', $line)) { $line = preg_replace('/<br>\s*?[a-z]{6,9},\s[a-z]{3,9}\s[0-9]{2},\s200[0-9]{1}\s*?[0-9]{1,2}:[0-9]{2}\s*?(?:a|p)m\s*?[0-9]*?\s*?<a href="/i', '', $line) . "\n"; $line = preg_replace('%">.*?</a>%i', '', $line); $files[] = $line; } } $i=0; foreach($files as $file) { $gets[$i]['filename'] = preg_replace('%/cod4/usermaps/.*?/%i', '', $file); $gets[$i]['filename'] = preg_replace('/\n/', '', $gets[$i]['filename']); $mapName = preg_replace('/\..{2,3}/', '', $gets[$i]['filename']); echo $mapName . "\n"; $noPath = preg_replace('%/cod4/usermaps/%i', '', $file); $noPath = preg_replace('%/%', '\\', $noPath); $gets[$i]['localDir'] = $localFolder . '\\' . preg_replace('/[a-z0-9_]*?\..{2,3}/i', '', $noPath); $gets[$i]['localDir'] = preg_replace('/\n/', '', $gets[$i]['localDir']); $gets[$i]['remoteDir'] = $root . preg_replace('%/cod4/usermaps/%i', '', preg_replace('/[a-z0-9_]*?\..{2,3}/i', '', $file)); $gets[$i]['remoteDir'] = preg_replace('%//%i', '/', $gets[$i]['remoteDir']); $gets[$i]['remoteDir'] = preg_replace('/\n/', '', $gets[$i]['remoteDir']); $i++; } foreach($gets as $map) { if(!file_exists($map['localDir'])) { $command = "mkdir " . '"' . $map['localDir'] . '"'; passthru($command, $r); } $fileToGet = 'http://' . $map['remoteDir'] . $map['filename']; $remoteFH = fopen($fileToGet, 'r'); while(!FEOF($remoteFH)) { $data .= fgets($remoteFH); } fclose($remoteFH); $localFile = $map['localDir'] . '\\' . $map['filename']; $localFH = fopen($localFile, 'w'); fwrite($localFH, $data); fclose($localFH); } $curFile++; } ?>
×
×
  • 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.