<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ask Your Question &#187; Tutorial</title>
	<atom:link href="http://askbahar.com/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://askbahar.com</link>
	<description>Lets Talk</description>
	<lastBuildDate>Fri, 30 Jul 2010 04:34:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to generate getter/setter in PHP easily</title>
		<link>http://askbahar.com/2010/07/14/generate-getter-setter-in-php-easily/</link>
		<comments>http://askbahar.com/2010/07/14/generate-getter-setter-in-php-easily/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 04:21:16 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[get-set]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=70</guid>
		<description><![CDATA[For one of my current project I need to write getter/setter functions for 20+ variables. You know, how annoying it is! Well, I can use magic quotes, but I don&#8217;t like it. More over getter setter will help you later to use the class when your IDE (in my case Netbeans) supports auto complete suggestion.]]></description>
			<content:encoded><![CDATA[<p>For one of my current project I need to write getter/setter functions for 20+ variables. You know, how annoying it is! Well, I can use magic quotes, but I don&#8217;t like it. More over getter setter will help you later to use the class when your IDE (in my case <a title="Netbeans IDE" href="http://netbeans.org" target="_self">Netbeans</a>) supports <em>auto complete suggestion</em>. Though all Java development environments allow to generate getter and  setter code automatically.<br />
Then I started coding a php script for generating getter/setter for supplied variables, but I was lucky as suddenly I thought &#8220;why don&#8217;t I look for something like this online&#8221; <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And here is the link I got, its quite good. <a title="PHP Getter Setter Generator" href="http://www.icurtain.co.uk/getset.php" target="_blank">http://www.icurtain.co.uk/getset.php</a>, It saved my time.</p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/07/14/generate-getter-setter-in-php-easily/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to enable Apache HTTP Authentication using PHP</title>
		<link>http://askbahar.com/2009/11/11/enable-apache-http-authentication-using-php/</link>
		<comments>http://askbahar.com/2009/11/11/enable-apache-http-authentication-using-php/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 09:24:39 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Authentication]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=48</guid>
		<description><![CDATA[The easiest way to password-protect a site is to use HTTP Authentication, where if a browser’s request for a protected page is not accompanied by the correct username and password, the Web server replies with an HTTP 401 error – which means “Unauthorized Access” – and an invitation for the browser to re-submit the request]]></description>
			<content:encoded><![CDATA[<p>The easiest way to password-protect a site is to use HTTP Authentication, where if a browser’s request for a protected page is not accompanied by the correct username and password, the Web server replies with an HTTP 401 error – which means “Unauthorized Access” – and an invitation for the browser to re-submit the request with a proper username and password. From the user’s point of view, most of this dialogue is hidden. Following that first failed request, the browser prompts the user (in a dialog box) for a username and password, and then re-submits the request, this time with the authentication information attached. Assuming the username/password combo is on the list of allowed users, the Web server then sends the page requested. The Web browser will likewise continue to send that username/password with all subsequent requests.</p>
<p>Look at the following code:<br />
<span id="more-48"></span></p>
<pre>
<code>
<?php
/*
    Document   : auth
    Created on : Nov 11, 2009, 9:08:32 AM
    @author    : Bahar
    Email      : bahar@progmaatic.com
    Copyright  : http://progmaatic.com

    Description: Authenticate user
*/

require_once 'settings.php';

$failure_msg = " <HTML>
 <HEAD><TITLE>Authorization Failed</TITLE></HEAD>
 <BODY>
 <H1>Authorization Failed</H1>
 <P>Without a valid username and password,
    access to this page cannot be granted.
    Please click 'reload' and enter a
    username and password when prompted.
 </P>
 </BODY>
 </HTML>";

if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER']!==$site_user || $_SERVER['PHP_AUTH_PW']!==$site_pass)
   {
       header("WWW-Authenticate: Basic realm=\"Protected Page: Enter your username and password for access.\"");
       header("HTTP/1.0 401 Unauthorized");
       exit($failure_msg);
   }

?>
</code>
</pre>
<p>For each page, you want to authenticate user, each page must have the above code. You can save this code to a script (for example <em>auth.php</em>) and include <em>auth.php</em> to any page, hence save yourself from rewriting the code for each page.</p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2009/11/11/enable-apache-http-authentication-using-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
