Current location: Hot Scripts Forums » Programming Languages » PHP » can someone help with htaccess and php problem


can someone help with htaccess and php problem

Reply
  #1 (permalink)  
Old 04-28-04, 07:12 AM
tigherrdk tigherrdk is offline
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>&nbsp;\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?
Reply With Quote
  #2 (permalink)  
Old 03-08-09, 03:26 AM
superdannyhell superdannyhell is offline
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 ..
Reply With Quote
  #3 (permalink)  
Old 03-08-09, 04:49 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
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?
Reply With Quote
  #4 (permalink)  
Old 03-08-09, 06:48 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
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.
Reply With Quote
  #5 (permalink)  
Old 03-08-09, 07:35 PM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
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 View Post
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.
Reply With Quote
  #6 (permalink)  
Old 03-08-09, 08:54 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
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.

Looking at the script, it looks like it is creating a whole lot of pages, which consist of links, and keywords, or of pages that only vary by links and keywords.

Listed below are some resources:

Keywords: http://google.com/support/webmasters...y?answer=66358
Links: http://google.com/support/webmasters...y?answer=66356
Duplicate content: http://google.com/support/webmasters...y?answer=66359
General guidelines: http://google.com/support/webmasters...y?answer=35769

I'm sure equivalent resources are available for the other major search engines, I used Google because I'm familiar with it.
Reply With Quote
  #7 (permalink)  
Old 03-09-09, 02:28 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
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.
...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with PHP/.htaccess script, when using Internet Explorer digioz PHP 7 07-26-07 11:17 PM
HELP! Php to login to HTACCESS? godfather PHP 4 03-06-04 12:03 AM
How to convert php generated pages to SE friendly HTML or PHP(SE friendly) -CLASS 101 crippled PHP 1 11-16-03 06:37 AM
Search Engine URL: htaccess, dynamic php, & Frontpage ext. cebuy PHP 5 11-12-03 11:45 PM
htaccess client area mdittrich Script Requests 2 10-01-03 01:57 PM


All times are GMT -5. The time now is 10:30 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.