Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. I assume $list is a built up array then just before you output your adding $list[0]=$leadrow; have you tried adding $list[0]=$leadrow; before building the array ?
  2. turn on error_reporting, error_reporting(E_ALL); did you submit the form?
  3. I have posted code that's wrong, I think most of us have, but we try not to repeat that mistake, the fact the exact same code (above) has been proven to be wrong in many post, kinda makes us wonder why you keep posting it!
  4. Just use single quotes to stop the parsing $target_path = 'images\cat\images'; in anycase the path should be $target_path = 'images/cat/images';
  5. basically use the force download the script should be in an accessible folder but it should be set to read from the inaccessible folder
  6. The results seam kinda weird as $userfile = $_POST['userfile']; echo "1".$userfile; shouldn't give you the file path! try this <FORM ENCTYPE="multipart/form-data" ACTION="" METHOD=POST>Upload your photo: <INPUT NAME="userfile" TYPE="file"> <input type="submit"> </form> <?php $userfile = $_FILES['userfile']['name']; echo "1".$userfile; if((!empty($_FILES["userfile"])) && ($_FILES['userfile']['error'] == 0)) { //Check if the file is JPEG image and it's size is less than 350Kb $filename = basename($_FILES['userfile']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($ext == "jpg") && ($_FILES["userfile"]["type"] == "image/jpeg") && ($_FILES["userfile"]["size"] < 350000)) { //Determine the path to which we want to save this file $newname = dirname(__FILE__).'/upload/'.$filename; //Check if the file with the same name is already exists on the server if (!file_exists($newname)) { //Attempt to move the uploaded file to it's new place if ((move_uploaded_file($_FILES['userfile']['tmp_name'],$newname))) { echo "It's done! The file has been saved as: ".$newname; } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["userfile"]["name"]." already exists"; } } else { echo "Error: Only .jpg images under 350Kb are accepted for upload"; } } else { echo "Error: No file uploaded"; echo "2".$filename; } ?>
  7. Okay first remove all of the $thisPage= (not from the IF's just anywhere your setting it then add this to the start of the blog.php, services.php etc etc etc <?php $thisPage=substr(basename(__FILE__), 0, -3);?> that will set $thisPage to blog or services etc etc etc Now when you include nav.php it will read $thisPage correctly
  8. well the matches should be okay, could you echo out a full header and from line, and post it here
  9. Okay lets echo it just before we use it <?php echo "*****'$thisPage'****"; if($thisPage=='blog'){ echo '<span class="current">blog</span>'; }else{ echo '<a href="blog.php">services</a>'; } if($thisPage=='services'){ echo '<span class="current">services</span>'; }else{ echo '<a href="services.php">services</a>'; } if($thisPage=='about'){ echo '<span class="current">about</span>'; }else{ echo '<a href="about.php">about</a>'; } if($thisPage=='contact'){ echo '<span class="current">contact</span>'; }else{ echo '<a href="contact.php">contact</a>'; } if($thisPage=='policy'){ echo '<span class="current">policy</span>'; }else{ echo '<a href="policy.php">policy</a>;'; } ?> Also from your live page <div class-"formShell"> should be <div class="formShell">
  10. your nav.php page doesn't seam to have any closing php tags (?>) but lots of opening one!
  11. $ifile = an array. so that file won't exist
  12. That code doesn't make much sense! convert newline to Break, then convert break to newline! does $row['text'] have the \n in ? try echo "<textarea>{$row['text']}</textarea>"; and post back what you get
  13. it sounds like your creating a login system, if so then your need to control the access level via permissions you setup in the database, please note this is not the same as the filesystem permission, as all users will be using the same account name for accessing the files via PHP,
  14. Can't you just used something like this <?php // Checks if string is a URL // @param string $url // @return bool function isURL($url = NULL) { if($url==NULL) return false; $protocol = '(http://|https://)'; $allowed = '[-a-z0-9]{1,63}'; $regex = "^". $protocol . // must include the protocol '(' . $allowed . '\.)'. // 1 or several sub domains with a max of 63 chars '[a-z]' . '{2,6}'; // followed by a TLD if(eregi($regex, $url)==true) return true; else return false; } ?>
  15. try this Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} ^.+-(\d+?)-.*?\.html$ [NC] RewriteRule ^.+-(\d+?)-.*?\.html$ myfile.php?hid=$1 [NC]
  16. Just tested my code.. worked fine on WinXP (not saying much I know) no errors
  17. The + & * in the $allowed are messing it up, maybe change it to ([a-z0-9]([-a-z0-9]*?[a-z0-9])?) i'll move this to RegEx section
  18. can you post your .htaccess file
  19. in the manual. Yes the function the user defined!, being the second parameter! of course this "should" work! <?php $files = glob('200_*.jpg'); array_walk($files,'myunlink'); function myunlink($t) { unlink($t); } ?>
  20. try RewriteRule ^.+-(\d+?)-.*?\.html$ myfile.php?hid=$1 [NC]
  21. Where did you read that ? ToonMariner function looks sound to me (not a Glob fan.. but I am starting to be )
  22. no, but it shouldn't be too hard should **totally untested** <?php function RecursiveUnlink($dir,$regEx='200_') { if(!$dh = @opendir($dir)) { return; } while (false !== ($obj = readdir($dh))) { if($obj == '.' || $obj == '..') { continue; }elseif(preg_match('/^'.$regEx.'*?\.jpg$/i', $obj)) { unlink($obj); } } closedir($dh); return; } ?>
  23. welcome Can you click topic solved please (bottom left)
  24. Can you click topic solved please (bottom left)
×
×
  • 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.