Java script error in my cpanel being recognised by my admin panel
I am getting an error in my admin panel to my website and therefore it wont let me compile my changes that I am making to other pages. In my cpanel, I have located the area of the error, but I am not very good at java script. Can someone please look at this cpanel script to see what is wrong:
PHP Code:
{
$resKeysStrings = db_res("
SELECT `LocalizationKeys`.`Key` AS `Key`,
`LocalizationStrings`.`String` AS `String`
FROM `LocalizationStrings` INNER JOIN
`LocalizationKeys` ON
`LocalizationKeys`.`ID` = `LocalizationStrings`.`IDKey`
WHERE `LocalizationStrings`.`IDLanguage` = {$arrLanguage['ID']}");
$handle = fopen("{$dir['root']}langs/lang-{$arrLanguage['Name']}.php", 'w');
if($handle === false) return false;
$fileContent = "<?{$newLine}\$LANG = array(";
while($arrKeyString = mysql_fetch_assoc($resKeysStrings))
{
$langKey = str_replace("\\", "\\\\", $arrKeyString['Key']);
$langKey = str_replace("'", "\\'", $langKey);
$langStr = str_replace("\\", "\\\\", $arrKeyString['String']);
$langStr = str_replace("'", "\\'", $langStr);
$fileContent .= "{$newLine}\t'$langKey' => '$langStr',";
}
The following is the admin panel error message:
Warning: fopen(/home/sexiestf/public_html/langs/lang-English.php) [function.fopen]: failed to open stream: Permission denied in /home/sexiestf/public_html/inc/languages.inc.php on line 159
Language file(s) has NOT been compiled due to an error.
Re: Java script error in my cpanel being recognised by my admin panel
Re: Java script error in my cpanel being recognised by my admin panel
That's not JavaScript. That's PHP.
The first thing to do is to go and
1) check that "/home/sexiestf/public_html/langs/lang-English.php" exists.
2) check what permissions are set for the file (if you're using cPanel, they'll be somewhere)
3) If the permissions are set to (d*mn, I've forogtten the permission settings, but I think it's) 755, Look at the php settings (if you can't access them directly, make a page like this:
PHP Code:
<?php
phpinfo();
?>
Look for anything which may stop you opening files (I'm in a web cafe currently, so I can't look things up easily)
4) Try a relative path. Here I'm assuming it's to do with the path you using. If you're call from inc/languages.php, then try:
PHP Code:
fopen("../langs/lang-{$arrLanguage['Name']}.php", 'w');
Hope that helps.
Re: Java script error in my cpanel being recognised by my admin panel
Re: Java script error in my cpanel being recognised by my admin panel
PHP's fopen is highly restricted when PHP is running in safe mode. I would check to see if it is first. Then worry about it being other problems.