I need a quick php script done......PROGRAMMERS!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jace
    FBOP Class Of 2013
    • Jan 2004
    • 35562

    #1

    I need a quick php script done......PROGRAMMERS!!!

    I have directories with upwards of 2000 files in them

    the files all are formatted like this

    this-is-the-file.php

    what I need to be able to drop a php script in the directory and output html based on the filenames

    so if the file name is what I said above, the php script will output

    <a target="blank" href="this-is-the-file.php">this is the file</a><br>

    it need to take the words in the file name, remove the dashes, add the href tags in there, and output the html to me

    I know this is CAKE to do, I just don't have anyone to do it for me right now....how much will someone charge me?
  • Jace
    FBOP Class Of 2013
    • Jan 2004
    • 35562

    #2
    anyone?


    ...........

    Comment

    • TampaToker
      Confirmed User
      • May 2006
      • 5828

      #3
      here is a bump for you
      Icq 247-742-205

      Comment

      • jacked
        sperm tail
        • May 2004
        • 11019

        #4
        get in touch with WOJ he's reliable and does good work sure he can whip something up for you...

        www.wojfun.com
        Got Cam Models?
        icq: 361-607-616

        Comment

        • Jace
          FBOP Class Of 2013
          • Jan 2004
          • 35562

          #5
          Originally posted by jacked
          get in touch with WOJ he's reliable and does good work sure he can whip something up for you...

          www.wojfun.com
          i know woj, he is not on icq right now

          I need it done now

          Comment

          • jacked
            sperm tail
            • May 2004
            • 11019

            #6
            Originally posted by Jace
            i know woj, he is not on icq right now

            I need it done now
            bah that sucks... hope you can find someone
            Got Cam Models?
            icq: 361-607-616

            Comment

            • darksoul
              Confirmed User
              • Apr 2002
              • 4997

              #7
              Code:
              #/bin/tcsh
              foreach file (*.php)
              echo -n "<a href='$file'>";
              echo $file|sed -e 's/-/ /g'|xargs echo -n;
              echo -n "</a>";
              end
              put that in a file like makelist.csh
              upload it and run it in that dir with
              ./makelist.csh > outputfile.html
              1337 5y54|)m1n: 157717888
              BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
              Cambooth

              Comment

              • rounders
                Confirmed User
                • Sep 2003
                • 2931

                #8
                darksoul - does kon still run adultxspace?
                ICQ#: 153923840

                Comment

                • darksoul
                  Confirmed User
                  • Apr 2002
                  • 4997

                  #9
                  Originally posted by rounders
                  darksoul - does kon still run adultxspace?
                  no

                  8chars
                  1337 5y54|)m1n: 157717888
                  BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
                  Cambooth

                  Comment

                  • Jace
                    FBOP Class Of 2013
                    • Jan 2004
                    • 35562

                    #10
                    Originally posted by darksoul
                    Code:
                    #/bin/tcsh
                    foreach file (*.php)
                    echo -n "<a href='$file'>";
                    echo $file|sed -e 's/-/ /g'|xargs echo -n;
                    echo -n "</a>";
                    end
                    put that in a file like makelist.csh
                    upload it and run it in that dir with
                    ./makelist.csh > outputfile.html
                    is that in ssh or something?

                    i don't do ssh haha

                    Comment

                    • darksoul
                      Confirmed User
                      • Apr 2002
                      • 4997

                      #11
                      Originally posted by Jace
                      is that in ssh or something?

                      i don't do ssh haha
                      you're missing out
                      let me try it in php:

                      Code:
                      <?php
                      if($dir = opendir(".")) {
                         while (($file = readdir($dir) !== false) {
                             if ($file != "." && $file != "..") {
                                $text .= "<a href=\"$file\">.str_replace("-"," ",$file)."</a><br>";
                             }
                          }
                      }
                      $fd = fopen("outputfile.html",w);
                      fwrite($fd,$text);
                      fclose($fd);
                      ?>
                      I haven't tested this but should work.
                      1337 5y54|)m1n: 157717888
                      BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
                      Cambooth

                      Comment

                      • Jace
                        FBOP Class Of 2013
                        • Jan 2004
                        • 35562

                        #12
                        Originally posted by darksoul
                        you're missing out
                        let me try it in php:

                        Code:
                        <?php
                        if($dir = opendir(".")) {
                           while (($file = readdir($dir) !== false) {
                               if ($file != "." && $file != "..") {
                                  $text .= "<a href=\"$file\">.str_replace("-"," ",$file)."</a><br>";
                               }
                            }
                        }
                        $fd = fopen("outputfile.html",w);
                        fwrite($fd,$text);
                        fclose($fd);
                        ?>
                        I haven't tested this but should work.
                        hm...almost


                        Parse error: syntax error, unexpected '{' in /usr/home/keywords.php on line 3

                        Comment

                        • darksoul
                          Confirmed User
                          • Apr 2002
                          • 4997

                          #13
                          ia
                          I forgot to close something should be:
                          Code:
                          while (($file = readdir($dir)) !== false) {
                          1337 5y54|)m1n: 157717888
                          BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
                          Cambooth

                          Comment

                          • Tempest
                            Too lazy to set a custom title
                            • May 2004
                            • 10217

                            #14
                            If you want to just drop it in a directoty and browse to that file, call it something like "listfiles.php" and change these 3 lines:

                            $fd = fopen("outputfile.html",w);
                            fwrite($fd,$text);
                            fclose($fd);

                            to simply

                            echo $text;

                            then in your browser just:

                            http ://www.yourdomain.com/pathto/listfiles.php

                            Comment

                            • darksoul
                              Confirmed User
                              • Apr 2002
                              • 4997

                              #15
                              I just spotted a few things I missed there
                              let me redo it.
                              1337 5y54|)m1n: 157717888
                              BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
                              Cambooth

                              Comment

                              • Jace
                                FBOP Class Of 2013
                                • Jan 2004
                                • 35562

                                #16
                                Originally posted by darksoul
                                ia
                                I forgot to close something should be:
                                Code:
                                while (($file = readdir($dir)) !== false) {
                                haha, now I got

                                Parse error: syntax error, unexpected '"' in /usr/home/keywords.php on line 5

                                Comment

                                • Jace
                                  FBOP Class Of 2013
                                  • Jan 2004
                                  • 35562

                                  #17
                                  Originally posted by darksoul
                                  I just spotted a few things I missed there
                                  let me redo it.
                                  has anyone ever told you that you rule?

                                  Comment

                                  • Tempest
                                    Too lazy to set a custom title
                                    • May 2004
                                    • 10217

                                    #18
                                    Originally posted by Jace
                                    haha, now I got

                                    Parse error: syntax error, unexpected '"' in /usr/home/keywords.php on line 5
                                    Code:
                                    $text .= "<a href=\"$file\">".str_replace("-"," ",$file)."</a><br>";

                                    Comment

                                    • munki
                                      Do Fun Shit.
                                      • Dec 2004
                                      • 13393

                                      #19
                                      You silly php peoples...

                                      I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde

                                      Comment

                                      • darksoul
                                        Confirmed User
                                        • Apr 2002
                                        • 4997

                                        #20
                                        Originally posted by Tempest
                                        Code:
                                        $text .= "<a href=\"$file\">".str_replace("-"," ",$file)."</a><br>";
                                        thats what I get for coding directly into the browser
                                        1337 5y54|)m1n: 157717888
                                        BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
                                        Cambooth

                                        Comment

                                        • Jace
                                          FBOP Class Of 2013
                                          • Jan 2004
                                          • 35562

                                          #21
                                          Originally posted by Tempest
                                          Code:
                                          $text .= "<a href=\"$file\">".str_replace("-"," ",$file)."</a><br>";

                                          PERFECT!

                                          it workjs like a charm!

                                          Comment

                                          • Jace
                                            FBOP Class Of 2013
                                            • Jan 2004
                                            • 35562

                                            #22
                                            shit, hold up, it is leaving the .php on the end of link

                                            Comment

                                            • Jace
                                              FBOP Class Of 2013
                                              • Jan 2004
                                              • 35562

                                              #23
                                              Originally posted by munki
                                              You silly php peoples...
                                              didn't know you were awake, I would have bugged you....hahahaha

                                              Comment

                                              • darksoul
                                                Confirmed User
                                                • Apr 2002
                                                • 4997

                                                #24
                                                Here it is
                                                Code:
                                                <?php
                                                if($dir = opendir(".")) {
                                                	while (($file = readdir($dir)) !== false) {
                                                		if($file != "." && $file != ".." &&
                                                		   $file != basename(__file__) &&
                                                		    preg_match("/^.*\.php$/",$file)) {
                                                			$text .= "<a href=\"$file\">";
                                                			$text .= str_replace("-"," ",str_replace(".php","",$file));
                                                			$text .= "</a><br>\n";
                                                		}
                                                	}
                                                }
                                                $fd = fopen("outputfile.html","w");
                                                fwrite($fd,$text);
                                                fclose($fd);
                                                echo "Job done";
                                                ?>
                                                Modifyed it to only look for .php files and exclude itself
                                                also removed the ".php" from the title
                                                1337 5y54|)m1n: 157717888
                                                BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
                                                Cambooth

                                                Comment

                                                • Tempest
                                                  Too lazy to set a custom title
                                                  • May 2004
                                                  • 10217

                                                  #25
                                                  Originally posted by Jace
                                                  shit, hold up, it is leaving the .php on the end of link
                                                  Code:
                                                  str_replace("-"," ",substr($file,0,-4))

                                                  Comment

                                                  • Jace
                                                    FBOP Class Of 2013
                                                    • Jan 2004
                                                    • 35562

                                                    #26
                                                    you all rock so much

                                                    anyone who helped me in this thread if you have any links you want across about 50,000 seo'ed pages for the next month or so, let me know

                                                    not much traffic, but it will help ya gain some se rankings

                                                    Comment

                                                    Working...