Archive for December, 2007

Use the (Unlimited web hosting) location of your apache installation s htpasswd

Tuesday, December 11th, 2007

Use the location of your apache installation s htpasswd command, if not located in /usr/local/apache2/bin. b. You will be prompted to enter john s password; enter it as doe. You will then be required to re-enter the password for confirmation. That s it; your Linux htaccess installation is complete. For Windows htaccess installation: a. To run htpasswd, go to Start . Run and type cmd to run commands from the command prompt. The command prompt should look like Figure 12-1. Figure 12-1 b. Navigate to the C:Program FilesApache groupApache2bin directory (or wherever your htpasswd.exe program resides) using the cd command and run htpasswd with the following syntax at the prompt: C:>cd C:Program FilesApache groupApache2bin C:Program FilesApache groupApache2bin>htpasswd -c userauth john c. At the prompt to enter john s password, enter it as doe; you will then be required to reenter the password for confirmation. That s it; your Windows htaccess installation is complete. 5. Navigate to a file in your protected directory, and you should see a screen similar to Figure 12-2. 367 User Logins, Profiles, and Personalization
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Try It Out Creating htaccess and htpasswd Files (Multiple domain web hosting)

Monday, December 10th, 2007

Try It Out Creating htaccess and htpasswd Files In this exercise, you ll protect a folder so that when a user visits a page in that directory, a dialog box pops up requiring that a username and password be entered. Take a look at your Apache configuration file, httpd.conf. The Linux example is located in something similar to /usr/local/apache2/conf, and the Windows example is located in something similar to C:Program FilesApache group Apache2conf. Follow these steps: 1. Open the httpd.conf file and look for the following lines around line 270 or so. By default the lines are likely to look like this and will reside in the section that contains your Web root: # # AllowOverride controls what directives may be placed in .htaccess files. # It can be All , None , or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # 2. For htaccess capabilities, change the lines to look like this: # # AllowOverride controls what directives may be placed in .htaccess files. # It can be All , None , or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride AuthConfig # 3. Create a text file named .htaccess in the directory that you want to restrict access to. This file will require only the following lines to function correctly: AuthType Basic AuthUserFile /usr/local/apache2/htdocs/userauth #or your windows path AuthName Restricted require valid-user 4. Now, when creating the password file and adding your first user, you need to separate the installation based on your operating system selection. Create your password file in your main login directory by completing these steps: For Linux htaccess installation: a. Go to your command prompt and type the following: /usr/local/apache2/bin/htpasswd -c /usr/local/apache/htdocs2/userauth john 366 Chapter 12
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

12 User Logins, Profiles, and Personalization In this (Database web hosting)

Sunday, December 9th, 2007

12 User Logins, Profiles, and Personalization In this chapter, you ll learn to manipulate Web pages with user logins, profiles, and personalization using PHP s session and cookie functions. You ll create a useful login and personalization application that you can use in conjunction with the applications you have created thus far. Session and cookie functions are two of the most fundamental, important, and useful functions you will encounter in the PHP programming language. Not convinced about the value of these yet? Think about it this way: You wouldn t want just anyone guessing where you have your important files and messing with information to change your Web site in any way he or she wanted, would you? Well, with htaccess, and better yet, PHP sessions, you can combat hackers or the general public from stumbling onto your sensitive files and directories. Specifically, you learn how to do the following: . Restrict access to files and directories via htaccess . Use PHP to accomplish the same function as htaccess, but with more control and functionality . Store user and admin information in a database to utilize database-driven logins . Create a registration system with required and optional fields for users to sign up . Use cookies to keep login information between sessions . Create a navigation system dependent on whether or not a user has logged in The Easiest Way to Protect Your Files Using htaccess is a simple and quick solution to restricting access to files or directory structures. Some Web sites contain sensitive information that you don t want the public to access. Or perhaps you have an administration section where administrators can change the content of the public site, such as in a news or upcoming events section; you don t want just anybody to change that content.
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

You ve experienced user interaction in this (Web site domain) chapter by

Saturday, December 8th, 2007

You ve experienced user interaction in this chapter by requiring that the user click a link in a confirmation e-mail before sending the postcard. In the next chapter, you ll take the interaction a step further as you learn how to let the user create an account on your site. With this feature, you can keep track of your users, and present custom information based on each user s preferences. Exercises See how you might accomplish the following tasks: 1. Create code to send a message to an e-mail account, and blind carbon-copy (Bcc) yourself or another account. 2. Create a simple Web form that e-mails comments or suggestions to an account of your choosing. 363 Sending E-mail
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

$postcard->body = This is the text part (Free php web host) of

Friday, December 7th, 2007

$postcard->body = This is the text part of the email! ; $postcard->htmlbody = This is the HTML part of the email! ; $postcard->send_html = TRUE; No extra effort is needed to send a Multipart message, other than turning on HTML sending. How simple is that! In the final example, you use the basic emulation of PHP s mail() function the class provides. Witness the short and sweet mail_quick.php: send( youremail@yourhost.com , Quick message test , This is a test using SimpleMail::send! )) { echo Quick message sent successfully! ; } ?> All you had to do was include the class file, and call the send method using the three required parameters! Summary In this chapter, you ve looked at PHP s mail() function and learned how to use it by creating a postcard application. You may have seen similar applications at Hallmark s or Yahoo! s Web sites. Your application is not as complex as theirs, but with a little bit more work, it shouldn t be too difficult to offer users some terrific features. You ve also created a simple mail-sending PHP class that can be reused in applications that need basic mail functionality, and you won t have to recode those messy Multipart e-mail messages each time! Keep your eyes peeled in future chapters, because it will be popping up from time to time to lend a hand. The mail() function gives PHP the capability to communicate with the outside world, whether it be with users of the Web site, Web site or server administrators, or even another server. There are many opportunities to use mail(): A simple form on the Web page that a user fills out to describe a technical problem can be immediately mailed to a tech support person, for example. Or, the PHP server can send the Web site administrator an e-mail any time a Web page displays a fatal error. Complicated workflow applications can be created, such as content management applications. 362 Chapter 11
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

4. Next, create a file that will (Web space) demonstrate

Tuesday, December 4th, 2007

4. Next, create a file that will demonstrate Multipart e-mails, and the rest of the bells-and-whistles that make up the headers. Again, change the e-mail addresses accordingly, and save this file as mail_multipart.php. to = youremail@yourhost.com ; $postcard->from = fromaddress@yourhost.com ; $postcard->cc = ccaddress@yourhost.com ; $postcard->bcc = bccaddress@yourhost.com ; $postcard->subject = Testing Multipart email ; $postcard->body = This is the text part of the email! ; $postcard->htmlbody = This is the HTML part of the email! ; $postcard->send_html = TRUE; if ($postcard->send()) { echo Multipart email sent successfully! ; } ?> 5. Last, create a file to demonstrate the quick-message functionality in the SimpleMail class. Save this file as mail_quick.php. send( youremail@yourhost.com , Quick message test , This is a test using SimpleMail::send! )) { echo Quick message sent successfully! ; } ?> 6. Load up mail_text.php, mail_html.php, mail_multipart.php, and mail_quick.php in your browser. Assuming everything was typed carefully, all four success messages will appear. How It Works As you might have already discovered, using a PHP class for encapsulating functionality can be a great way to save coding time later on. Looking at class.SimpleMail.php, you start out by defining the class and its properties: Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Photography web hosting - $this->message .= $this->htmlbody . n ; $this->message .= –$_boundary– ;

Monday, December 3rd, 2007

$this->message .= $this->htmlbody . n ; $this->message .= –$_boundary– ; } } if (!mail($this->to,$this->subject,$this->message,$this->headers)) { throw new Exception( Sending mail failed. ); return FALSE; } else { return TRUE; } } } ?> 2. Next, create the file that will be used to demonstrate plain-text functionality, mail_text.php. Make sure you change the e-mail address to reflect the account to which you want to send the mail. to = youremail@yourhost.com ; $postcard->subject = Testing text email ; $postcard->body = This is a test using plain text email! ; if ($postcard->send()) { echo Text email sent successfully! ; } ?> 3. Now, create a file to send HTML-format e-mails. Remember to change the e-mail account as you desire, like you did in the previous step. Save this file as mail_html.php. to = youremail@yourhost.com ; $postcard->subject = Testing HTML email ; $postcard->htmlbody = This is a test using HTML email! ; $postcard->send_html = TRUE; $postcard->send_text = FALSE; if ($postcard->send()) { echo HTML email sent successfully! ; } ?> 357 Sending E-mail
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Until now, nothing has been sent to the (Web design course)

Saturday, December 1st, 2007

Until now, nothing has been sent to the browser. That is a good thing. For example, if you had received any errors, and wished to use the header() function to redirect the user to a different page, it only works if no text has already been sent to the browser. The lesson here is: Don t put your (and other) tags in the code until you are ready to send text to the user s browser.

; echo To: $to
; echo From: $from
; echo Subject: $subject
; echo Message:
; echo $html_msg; } else { echo There was an error… ; } ?> Creating a Reusable Mail Class Now that you ve seen how to perform basic mail functions using PHP, it s time to take what you ve learned and make a nice block of easily reusable code, right? Hopefully you were paying attention previously in the book when PHP objects and classes were discussed. If not, it might be a good idea to go back and brush up on the basics before you continue. Try It Out Creating a Reusable Mail Class You are going to be creating a very handy file, class.SimpleMail.php. This file is going to contain a PHP class that will help you reuse the simple mail functionality and help keep your source code clean where you use it. 1. Open your favorite PHP editor and create a new PHP file called class.SimpleMail.php: Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.