WebDev Masters

Web Development & Webmaster Resources

Browsing Posts tagged Change

Sometimes it’s useful to enable visitors to your site to upload content, for example, photos, which can then be displayed on the site.

Folders on a website, for example, an images folder will typically have permissions of 755, which means that normal visitors to the site will be unable to upload content into the folder. They will receive an error message if they try to do so.

In order to allow a file upload, one solution is to temporarily change the permissions on the folder to 777 before the upload is made, and then to change them back to 755 after the upload has been made.

The following PHP script shows how you can do this using PHP’s ftp_site command. This script only changes the permissions one way (to 777), it doesn’t change them back. You would need to extend the script or write another one to do this. The line that reads $mod = ’0777′; // permissions to be set is the one that determines what the permissions are going to be set to.

Note: Please note that for display purposes, I have used square brackets ‘[' instead of angle brackets for tag names. In order to use the script you will need to change the square brackets back to angle brackets.

[?php

// Set up variables
$host = 'www.xyz.com'; // host (website) that contains the folder you want to change
$user = 'username'; // username to log onto the host
$password = 'password'; // password to log onto the host
$folder = 'public_html/test/'; // folder name to change
$mod = '0777'; // permissions to be set

// connect to FTP site
$conn = ftp_connect("$host");
if (!$conn)
{
echo 'Error: Could not connect to ftp server';
exit;
}

// log in to FTP site
@ $result = ftp_login($conn, $user, $password);
if (!$result)
{
echo "Error: Could not log on as $user";
ftp_quit($conn);
exit;
}

// try to change the permissions on the directory
if (ftp_site($conn, 'CHMOD '.$mod.' '.$folder)) {
echo "Successfully changed permissions";
}
else {
echo "There was a problem changing the permissions";
ftp_quit($conn);
exit;
}

// close the connection
ftp_close($conn);

?]

The script is fairly straight forward. You initially set up a few variables for the host name and stuff like that, you then connect to the FTP site, log on to the site, change the permissions of the folder, and then finally log off.

The path to the folder (assigned to $folder) will be something like ‘public_html/…/’. Check with your ISP if you’re not sure what this is.

John Dixon is a web developer working through his own company John Dixon Technology. As well as providing web development services, John’s company also provides free open source accounting software written in PHP and MySQL.

If youâ??re looking to customize your MySpace pages and you have absolutely no idea how to code them using HTML, you can still go about it by making use of the pre-made layouts and backgrounds which are available freely on the internet. You can then use the provided HTML codes for MySpace to change and customize your profile pages.

There is no hard and fast rule saying that you must change your MySpace pages, but you know that the better you make your profile pages look, the more people who will look over it, and the more your friends and family will also be attracted to it, (if thatâ??s what you want of course!).

And since not every one of the forty million plus members currently to be found on the MySpace pages will be able to code using HTML, the use of these readymade layouts and such can be somewhat heaven sent, to many people.

Added to that, you will find that itâ??s also quite simple to add these free HTML codes for MySpace, and that you can change the look of your pages quite frequently if you want to, as well. All you need to do is to follow the provided instructions on how to go about using the provided free HTML codes for MySpace, and you will be able to easily and simply place the code into the correct place.

This is normally accomplished by going through the Edit Profile section, where funnily enough, you will find that you have at your disposal everything that you need to edit, change and update your profile.

You will then be able to customize your MySpace pages using not only the HTML codes for MySpace backgrounds, and layouts, but also HTML codes for MySpace page graphics, icons and even pictures.

And if you search a little bit more you will even come across HTML codes for MySpace games, as well as HTML codes for MySpace music and music video uploads. Although the later can be accomplished quite easily if you use the music and the music videos provided on the MySpace Music pages, the HTML codes for MySpace games needs to be taken from these websites.

And after that, itâ??s all a hop, skip and a jump to customize your MySpace pages to reflect your personal tastes and characteristics. All of these can of course, for the most part be accomplished without having to use any of the pre-made layouts etc. and their HTML codes for MySpace, but in the long run, it can be very much easier on you to use them.

Muna wa Wanjiru is a Web Administrator and Has Been Researching and Reporting on Myspace for Years. For More Information on Html Codes For Myspace, Visit His Site at Html Codes For Myspace