Categories
Article Operating System PHP Server Configuration

Finally wordpress permalinks works

After a long time, finally Microsoft add the ability to work with URL Rewriting in IIS, finally Godaddy start supporting it with their hosting, and finally I try the service to found it working first shot.

You will find detail guides at

http://learn.iis.net/page.aspx/466/enabling-pretty-permalinks-in-wordpress/   (IIS official article)

http://codex.wordpress.org/Using_Permalinks (WordPress official Article)

My unofficial web.config content

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”Main Rule” stopProcessing=”true”>
<match url=”.*” />
<conditions logicalGrouping=”MatchAll”>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
</conditions>
<action type=”Rewrite” url=”index.php” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Hope it helps other.
Categories
Article PHP

WordPress on Godaddy Windows Server

I have been using GoDaddy Windows server from last 18 months. I have my blog runnin here as well. However initially i got some problem with my wordpress installation, as Godaddy doesn’t support PHP well on windows. (I guess they need new techincal brains, who realize that php is similarly safe on windows as on linux).

But, by making some modification in installation script of wordpress I am able to make it run. It runs fine for me except URL rewriting to make a good looking url. For this I am not much concern as my site is site searchable and people come searching it.

Soon my good works seems falling as I was unable to update my blog from 2.2 version to 2.5 or later. hmm, I again recalled the changes of installation script and it make upgrade possible. But … it disable the themes and plugin page for admin. Now, that version 2.2 was working fine with those two page but not 2.5, it means there is some problem with PHP code as they get updated. I check those and found that corresponding Directory reading function of Theme and plugin are changed (from PHP function dir to opendir etc..). Now what I simply use my backup copy and change the part of those routine in PHP code and make it working 🙂

I lost a good link where a person define the step which I too perform (without reading those as I install my wordpress years ago before I found that link ..). It define where you need to make code change in getting wordpress to work for very normal blog requirement. Maybe someday I get enough time to write that part.

BUT WordPress can run on GoDaddy’s windows server…

Categories
Javascript PHP Programming

Spell Checker for Web Application (PHP on Linux )

Well try this http://activecampaign.com/activespell/ free spell checker, it use backend pSpell component installed on PHP to work, but is very good spell checker for your HTML editors and TextArea boxes. I have used it in past and found it easy to install.

Categories
PHP Programming

PHP: ob_start and header redirect … use it with care

Today, I found a interesting bug in code. This bug has cause our customer to lose data at least 3-4 times in recent past, we read logs and try to find the stories that are causing data loss. But everytime we found no good stories from fact. But today we found the cause of error. Let me explain the problem …

In 5-6 days, we got about 100 records (display per page) from secure admin section of a website. Strangely enough it always delete 100 records (It still remain mystery, why only hundred out of 150 records)..

Why it is happening?

Whenever Alexa craws our website, it delete our records. Now question is why Alexa crawling delete our records. Answer, is we have delete url as http://www.example.com/admin/listing.php?del_id=123. So if you change the 123 with your record id, page will delete that record. However, it has a clause attach, i.e., you need to be logged in system before you do that. Now considering this, how Alexa gain access to password secure area?

Answer to above question: Technical background of page, it use ob_start() as first line of code to execute whenever a secure page is called, then it check the Session if user is logged in or not, if it is not it call the header() function with Location parameter to redirect user to index.php page. Well good enough, if session check if done, it call next line which is not in the ELSE part of Session check. Here it has code that check the $_GET[‘del_id’] and if found delete the record with this id.

Seems fair enough, as in http://www.php.net/ob_start  : “This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers),

So, where is the problem.. well the problem is that when a developer call header function it doesn’t break the execution of page… this result in PHP to send the header before hand, but it also execute the complete page. So, it does the check and doesn’t display the page to client with success message of deletion, and show login form, but it does delete the record from database. Fair enough.

So, some guide to avoid these:

1) Always put code in Else part so if login check successed it execute code.

2) Break you script execution after call to Redirect header, so no further execution take place.

3) Try to cross check delete request, before actually deleting record from database.

4) Put meta header for noindex, and nofollow for admin section.

5) Put robots.txt so NO ONE crawl your website if you don’t want to do so.

Hope that explain the small issue.

Categories
Bookmarked Links PHP

POP3 Mail accessing with SSL

I have lately create an class in PHP 4 to connect and do POP3 mailbox handling. However, that class is not able to utilize the SSL connection and hence it fails when I have to access my Gmail (Now Google Mail ) account which use SSL connection for the purpose. For this I found another great work yet again from SourceForge.NET (http://www.sourceforge.net). This Class is known as XPertMailer and yes it is an XPertMailer

you can found more info about it here

http://sourceforge.net/projects/xpertmailer/

Hope you like it.

Categories
Links PHP Programming

XML-RPC client Class for PHP

I was looking to various classes available on net, just to learn something new and found this one really good to make a script that can work as XML-RPC client. You can use this XML-RPC client for Blooger.com, other blogging software, booking.com XML-RPC call or virtually to any XML-RPC server call.

http://keithdevens.com/software/xmlrpc

I use this script myself and really its just 10 line of code and I have my XML Function call start working. Its really very good.

Although the version i use doesn’t have HTTP Authorization (or I didn’t found that in class library) but modifing 2 lines give me that control too. I have requests Keith on HTTP Authorization, if he doesn’t add that in next few days I will post my modification for all.

Must use class.

Categories
Links PHP Programming Server Configuration

How to enable CURL in Xampp

Well the easiest post to read 🙂

Just enable it in all PHP.ini and PHPx.ini you find it Xampp installation …

Read original post at http://www.menyhart.net/blog/developer-stuff/enabling-curl-on-xampp/

—  Sumit Gupta