GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   I need a quick php script done......PROGRAMMERS!!! (https://gfy.com/showthread.php?t=681752)

Jace 11-29-2006 01:39 AM

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 11-29-2006 02:15 AM

anyone?


...........

TampaToker 11-29-2006 02:18 AM

here is a bump for you :thumbsup

jacked 11-29-2006 02:20 AM

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

www.wojfun.com

Jace 11-29-2006 02:21 AM

Quote:

Originally Posted by jacked (Post 11413027)
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

jacked 11-29-2006 02:23 AM

Quote:

Originally Posted by Jace (Post 11413032)
i know woj, he is not on icq right now

I need it done now

bah that sucks... hope you can find someone :thumbsup

darksoul 11-29-2006 02:27 AM

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

rounders 11-29-2006 02:29 AM

darksoul - does kon still run adultxspace?

darksoul 11-29-2006 02:30 AM

Quote:

Originally Posted by rounders (Post 11413054)
darksoul - does kon still run adultxspace?

no

8chars

Jace 11-29-2006 02:32 AM

Quote:

Originally Posted by darksoul (Post 11413048)
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

darksoul 11-29-2006 02:39 AM

Quote:

Originally Posted by Jace (Post 11413065)
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.

Jace 11-29-2006 02:49 AM

Quote:

Originally Posted by darksoul (Post 11413090)
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

darksoul 11-29-2006 02:52 AM

ia
I forgot to close something should be:
Code:

while (($file = readdir($dir)) !== false) {

Tempest 11-29-2006 03:01 AM

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

darksoul 11-29-2006 03:03 AM

I just spotted a few things I missed there
let me redo it.

Jace 11-29-2006 03:08 AM

Quote:

Originally Posted by darksoul (Post 11413123)
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

Jace 11-29-2006 03:09 AM

Quote:

Originally Posted by darksoul (Post 11413144)
I just spotted a few things I missed there
let me redo it.

has anyone ever told you that you rule?

Tempest 11-29-2006 03:12 AM

Quote:

Originally Posted by Jace (Post 11413152)
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>";

munki 11-29-2006 03:13 AM

You silly php peoples...

darksoul 11-29-2006 03:14 AM

Quote:

Originally Posted by Tempest (Post 11413161)
Code:

$text .= "<a href=\"$file\">".str_replace("-"," ",$file)."</a><br>";

thats what I get for coding directly into the browser :)

Jace 11-29-2006 03:17 AM

Quote:

Originally Posted by Tempest (Post 11413161)
Code:

$text .= "<a href=\"$file\">".str_replace("-"," ",$file)."</a><br>";


PERFECT!

it workjs like a charm!

Jace 11-29-2006 03:19 AM

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

Jace 11-29-2006 03:19 AM

Quote:

Originally Posted by munki (Post 11413165)
You silly php peoples...

didn't know you were awake, I would have bugged you....hahahaha

darksoul 11-29-2006 03:22 AM

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

Tempest 11-29-2006 03:23 AM

Quote:

Originally Posted by Jace (Post 11413182)
shit, hold up, it is leaving the .php on the end of link

Code:

str_replace("-"," ",substr($file,0,-4))

Jace 11-29-2006 03:27 AM

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


All times are GMT -7. The time now is 04:03 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123