Jump to content

uppercasefive

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

uppercasefive's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Not quite what I was looking for. It's supposed to be an index page for an archive of cached newsletters.
  2. This bloated jumble of code needs some simplification, but I do not know of a way to do it. The directory structure won't change, which is why I did it this way. $handle = opendir($base_url); while($dir = readdir($handle)) // read /news { if($dir != "." && $dir != "..")// && is_dir($dir)) { $dirs[] = $dir; $code .= "<li><a href=\"#\" class=\"news\" id=\"$dir\">$dir</a><ul class=\"sublist\">"; $handle2 = opendir($base_url . $dir . "/"); while($dir2 = readdir($handle2)) // read /news/newslettername { if($dir2 != "." && $dir2 != "..")// && is_dir($dir2)) { $dirs[] = $dir2; $code .= "<li><a href=\"#\" class=\"news\" id=\"$dir2\">$dir2</a><ul class=\"sublist\">"; $handle3 = opendir($base_url . $dir . "/" . $dir2 . "/"); while($dir3 = readdir($handle3)) // read /news/newslettername/year { if($dir3 != "." && $dir3 != "..")// && is_dir($dir3)) { $dirs[] = $dir3; $code .= "<li><a href=\"#\" class=\"news\" id=\"$dir3\">$dir3</a><ul class=\"sublist\">"; $handle4 = opendir($base_url . $dir . "/" . $dir2 . "/" . $dir3 . "/"); while($file = readdir($handle4)) // read /news/newslettername/year/month { if($file != "." && $file != "..")// && is_dir($dir4)) $code .= "<li><a href=\"http://domain/news/$dir/$dir2/$dir3/$file\" target=\"_new\">$file</a></li>"; } $code .= "</ul></li>"; } } $code .= "</ul></li>"; } } $code .= "</ul></li>"; } } $code .= "</ul>"; This does work, I just have a feeling that there is an easier way to do it, just don't know what that is... Got ideas?
  3. I figured it out... somewhat. TY Alex for the help for($i = 0; $i < 6; $i++) { $x = rand(0, 2); if($x == 1) $code .= $this->letters[rand(0, 13)] . $str[$i]; else if($x == 2) $code .= $str[$i] . $this->letters[rand(0, 13)]; else $code .= $str[$i]; }
  4. Could I use preg_replace(..) to just add things every x characters or so? edit: ahh crap meant to hit edit /sigh
  5. So I've got a string $string = "1234567"; I want to randomly pad it with random characters from an array, example: $string = "12xa3b45ds67"; I can't think of a good way to accomplish this, at least not without excessive code. Is there a PHP function to do this, or will I have to find one?
×
×
  • 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.