Jump to content

Uploads Won't Edit In Cpanel


BlackKite

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.