Can't get any PHP to work

software development

#1

Hey everybody. i’m very limited in PHP knowledge and the reason is related to this question. 99.9% of all the scripts i upload get an error like: Parse error: parse error in /home/.paddle/wesleym/nurturedfutility.com/data/update.php on line 10. And the line number is always the line number that the PHP script starts on. Here is an example of the code i got the above error from, and a link to the file:

<?php //Check to see if $PHP_AUTH_USER already contains info if (!isset($PHP_AUTH_USER)) { //If empty send header causing dialog box to appear header('WWW-Authenticate: Basic realm="Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization required.'; exit; } //If not empty, do something else else { //Try to validate the values of $PHP_AUTH_USER and //$PHP_AUTH_PW against hard-coded values //please change login and password to whatever you want if (($PHP_AUTH_USER == "login") && ($PHP_AUTH_PW == "password")) { echo " Enter Your Title Here

Header

Please be very careful when editing these files. Be particularly careful when editing the PHP files.

Choose a page to edit and then hit the submit button.

\n \n "; $handle=opendir('.'); while (false!==($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "update.php" && $file != "write.php" && $file != "modify.php") { $filename = str_replace("_"," ",$file); $fTime = filemtime($file); $today = getdate($fTime); $month = $today['month']; $mday = $today['mday']; $year = $today['year']; echo "\n "; } } closedir($handle); echo "
Pick File Name Last Edited or Uploaded
$filename $month $mday, $year
\n"; echo "

"; echo ""; echo " "; } else { echo "You are not authorized!"; } } ?>

the url is: http://www.nurturedfutility.com/data/update.php
Heck, here’s the link to the tutorial i got the code from: http://codewalkers.com/getcode.php?id=104

Now if someone can tell me why it doesn’t work i would be extremely greatful.

Thanks alot! :slight_smile:


#2

thanks alot for your help. Like i said, i’m pretty green with PHP, so making all those modifications scared me a little, but i’m going to give it a try. Where do i go to change permissions and AddType php-cgi .php in .htaccess file in data directory? According to my web panel, PHP already runs as CGI. Thanks alot again.