Jump to content

Archived

This topic is now archived and is closed to further replies.

BlackKite

Uploads Won't Edit In Cpanel

Recommended Posts

For some reason the script I wrote up is causing the files it creates to not be editable in Cpanel. Cpanel gives the following error...
[QUOTE]a fatal error or timeout occurred while processing this directive[/QUOTE]

I really dont know if this is the script itself, the host i just moved to, or the current version of cpanel, but sice my other files i have that werent uploaded with the script work. So my guess is either the host or the script because i didnt have this problem before.
[code]        //Check for file existence;

$ourFile = $_POST['title'];

$filename = "/home/USER/public_html/$ourFile";
if (file_exists("$filename")) {
  echo "The file $filename already exists. Please hit the back button and choose a new one";
  exit();
} else {
  echo "<center> Thank you for uploading your guide $ourLinkName ($ourFile). I has been posted to the neohound site. Please click <a href=\"http://www.neohound.com/staff2\">HERE</a> to returne to the staff panel.</center>";
}

        //If it doesn't exist, login to FTP and chmod;

###########################
# ftp settings            #

$ftpServer='ftp.SITE.com'; //ftp server, without ftp://
$ftpPort=21;                //the ftp port (don't change if you don't know what it is)
$ftpUser='USER';        //ftp username
$ftpPass='PASS';        //ftp password

# end ftp settings        #
###########################

###########################
# file settings          #

$dir='public_html';
$nav='public_html/index.php';

# end file settings      #
###########################

//connect to server
$connection = ftp_connect($ftpServer, $ftpPort);
ftp_login($connection, $ftpUser, $ftpPass);

//chmod directory so that the server can create a file
ftp_chmod($connection, 0777, $dir);


        //Create file

$ourFileHandle = fopen("/home/USER/public_html/$ourFile", 'w') or die("can't open file");
fclose($ourFileHandle);

$ourFileName = $_POST['name'];

$ourLinkName = $_POST['link'];

        //Post content feild to the file created;

$myFile = "/home/USER/public_html/$ourFile";
$fh = fopen("$myFile", 'w') or die("can't open file");

$stringData = $_POST['content'];
$help = stripslashes ($stringData);
$newStringData = strip_tags($help, '<img><div></div><font></font><p></p><br></br><hr></hr><a></a><b></b><i></i><u></u>');
fwrite ($fh, $newStringData);
fclose($fh);

//reset directory permissions
ftp_chmod($connection, 0750, $dir);



        //Post navigation link on index;

//chmod directory so that the server can create a file
ftp_chmod($connection, 0777, $nav);


$SData = "<br> ยป <a href=\"http://www.neohound.com/index.php?id=$ourFileName\">$ourLinkName</a>

<!-- game -->";

$data = file_get_contents('/home/USER/public_html/index.php');

$data = str_replace ('<!-- game -->', $SData, $data);

$fp = fopen ("/home/USER/public_html/index.php", 'w');
fwrite ($fp, $data);
fclose ($fp);


//reset directory permissions
ftp_chmod($connection, 0644, $nav);

//close connection
ftp_close($connection);[/code]
Thanks,
-BlackKite

Share this post


Link to post
Share on other sites
Lol thats gay. Guess i'll be visiting the support system again. I dont even know what im asking them though. Anyone know exactly why this problem would be happening?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.