can someone help with htaccess and php problem

04-28-04, 07:12 AM
|
|
New Member
|
|
Join Date: Apr 2004
Location: Ramsgate, Kent, UK
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
can someone help with htaccess and php problem
hi
ok, i admit to knowing nothing about php yet, as i have not needed to learn it up to this point, although seemingly this situation has changed.
i have a cashflow problem, and i have been given a set of programs to help me solve this quite quickly, but i dont have sufficient knowledge of them to do a proper debug.
the programs are called install.php, keywords.php (this is actually an html file with just a few bits of php bracketing it, pretty much), htaccess.txt and a file full of keywords (cleaned up) called keywords.txt.
i was told to stick these on the server, chmod the folder i put them in to 777 and run install.php. what is supposed to happen is that for each 150 keywords in the txt file, a folder is created, the 150 keywords copied over in a truncated keywords.txt file (i think) and also the htaccess goes in there (but should be invisible). Well, it gets as far as creating the folders...
i know the folders are empty, as i can delete them.
is anyone familiar with this little package? the code in install.php is as follows:
----------------------------------------------------------------------------
<?
//Rename keyword file to keywords.txt
//Upload keywords.txt,install.php,keywords.php to folder you want to create the
//sub folders in
//Set permissions on this folder to 777
$path = str_replace("/install.php","",$_SERVER["PATH_TRANSLATED"]);
$dir = @opendir($path);
while (($file = readdir($dir)) !== false)
{
if(is_dir($path . "/" . $file) && $file != "." && $file != ".." && strstr($file,"cars"))
{
$dir1 = @opendir($path . "/" . $file);
while (($file1 = readdir($dir1)) !== false)
{
if(is_dir($path . "/" . $file . "/" . $file1))
{
}
else
{
unlink($path . "/" . $file . "/" . $file1);
}
}
rmdir($path . "/" . $file);
}
}
$file = $path . "/keywords.txt";
$array_txt = array_unique (file($file));
sort($array_txt);
$keywords = $array_txt;
$handle = fopen ("$path/keywords.php", "r");
$keywords_php = fread ($handle, filesize ("$file"));
fclose ($handle);
$handle = fopen ("$path/htaccess.txt", "r");
$htaccess = fread ($handle, filesize ("$file"));
fclose ($handle);
//eywords = split("\n",$contents);
$foldercount = round(count($keywords)/150);
if($foldercount==0)
{
$foldercount = 1;
}
$offset = intval(count($keywords)/$foldercount);
$j = 0;
$carscount = 1;
for($i=0;$i<count($keywords);$i++)
{
$html = str_replace(" ","_",$keywords[$i]);
$html = str_replace("\n","",$html);
$words .= "<b>»</b> <a href=" . $html . ".html>" . $keywords[$i] . "</a> \n";
if(($j==$offset && $carscount < $foldercount) || $i+1 ==count($keywords)) //NEW FOLDER
{
mkdir("$path/cars$carscount",0777);
$htaccessInfo = str_replace("%%PATH%%",$path . "/cars$carscount/",$htaccess);
$handle1 = fopen ("$path/cars$carscount/.htaccess", "w");
fwrite($handle1,$htaccessInfo);
fclose ($handle1);
$handle1 = fopen ("$path/cars$carscount/keywords.php", "w");
$keywords_php1 = str_replace("%%KEYWORDS%%",$words,$keywords_php);
fwrite($handle1,$keywords_php1);
fclose ($handle1);
$j=0;
$carscount++;
$words = "";
}
$j++;
}
?>
done
-----------------------------------------------------------------------------
this will create folders called cars1 cars2 and so on...
can anyone help on why this is not working?
|

03-08-09, 03:26 AM
|
|
Disabled
|
|
Join Date: Mar 2009
Location: Madagascar
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
hii world
hii..this is a test message ..
|

03-08-09, 04:49 AM
|
 |
Aspiring Coder
|
|
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Add this to top of the file and note any errors that surface:
error_reporting(E_ALL);
ini_set('display_errors', true);
I generally see what it's trying to do...
It looks like it's trying to regenerate .htaccess files for the individual cars folders,
but it's so obscure, that it's hard to tell.
Maybe if you provided some of what's in the keywords.txt and htaccess.txt files, we could help further.
It also appears to just try this under the root directory of the web server, unless there is a mod_rewrite active or virtual server mappings.
I hate to ask the obvious, what programming skills do you have?
|

03-08-09, 06:48 PM
|
 |
-
|
|
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
|
|
If your cashflow problem is a genuine need for money, and you're relying on this code to solve it, don't.
It looks like an SEO scheme, and most search engines aren't fooled by these schemes, some will penalize you for them. It also has security issues, 777 is a very risky permission set.
Stick to projects you enjoy and do well. If you need more work you may find some at elance.com or craigslist.org.
Good luck.
|

03-08-09, 07:35 PM
|
 |
Aspiring Coder
|
|
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey wirehopper,
I'm not that familiar with SEO stuff and it appears that you are.
Why did you make the comment: "It looks like an SEO scheme...fooled by these..."?
How would a search engine be fooled by this and more generally, since you made the comment that is has to do with SEO, what's the script trying to accomplish in that regard?
Quote:
Originally Posted by wirehopper
If your cashflow problem is a genuine need for money, and you're relying on this code to solve it, don't.
It looks like an SEO scheme, and most search engines aren't fooled by these schemes, some will penalize you for them. It also has security issues, 777 is a very risky permission set.
Stick to projects you enjoy and do well. If you need more work you may find some at elance.com or craigslist.org.
Good luck.
|
|

03-09-09, 02:28 AM
|
 |
Aspiring Coder
|
|
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Thanks for the info wirehopper...
[QUOTE=wirehopper;169858]The reason I am assuming it is an SEO scheme is the term 'keywords'. There is a meta tag that can be used to define keywords, which was used by search engines to help classify the content on pages.
...
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|