Thursday, July 26

SESSION OR COOKIES LOST WHEN HEADER REDIRECT LOST [SOLVED]

After three days of headache, finally I found what php.ini setting to need to be change. You must set
session.cookie_path = /

Friday, July 13

Call to undefined function: html_entity_decode

If you are using php version below than 4.3, html_entity_decode it's not available for this version. Then you should employ this lines of codes to make it works

function html_entity_decode ($string, $opt = ENT_COMPAT) {

$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);

if (
$opt & 1) { // Translating single quotes

// Add single quote to translation table;
// doesn't appear to be there by default
$trans_tbl["'"] = "'";
}

if (!(
$opt & 2)) { // Not translating double quotes

// Remove double quote from translation table
unset($trans_tbl["""]);
}

return
strtr ($string, $trans_tbl);
}
}

// Just to be safe ;o)
if (!defined("ENT_COMPAT")) define("ENT_COMPAT", 2);
if (!
defined("ENT_NOQUOTES")) define("ENT_NOQUOTES", 0);
if (!
defined("ENT_QUOTES")) define("ENT_QUOTES", 3);

This will saves your time

Call to undefined function: mssql_connect() on IIS

I check my php.ini setting but the mssql function doesn't appear. So follow this step to make it working
  1. Edit your php.ini file and uncomment (remove the semicolon from) the following line of code. If this line is missing in your php.ini, you must manually add it in:
    extension=php_mssql.dll

  2. The php_mssql.dll file can be obtained in the PHP downloads for Win32. You must make sure that you place the dll in both the /extensions and /WINNT/system32 folder.

  3. Restart the Web server.

But I still can't make my application sucessfully connect to MSSQL 7.0. I configured SQL Server Client Network Utility and enable the TCP/IP.

And I test

Test SQL Server's connections: You can verify that SQL Server is accepting
connections using telnet. In a command window, type the following:telnet 1433If you get an error message such as "Could not open a connection to host on port 1433: Connect Failed…" then you should open the SQL Server Enterprise Manager and check the server and port setting. This problem can also be caused by a firewall or if the SQL Server service has been stopped unexpectedly. If you get a blank screen, it means that SQL Server is accepting incoming connections.

Ok...I get the blank screen and that's mean the connection is ready on port 1433

Monday, July 9

How to pass URL Parameter to Flash


  1. Learn what is FlashVars

  2. Add this code to your html when adding Flash object
  3. codebase=""http://macromedia.com/cabs/swflash.cab#version=6,0,0,0""
    WIDTH="250" HEIGHT="250" id="flaMovie1" ALIGN="CENTER">

    FlashVars VALUE="imageFilename=images%2Fimage1%2Ejpg">


    FlashVars="imageFilename=images%2Fimage1%2Ejpg"
    quality="high" bgcolor="#FFFFFF" WIDTH="250" HEIGHT="250"
    NAME="flaMovie1" ALIGN TYPE="application/x-shockwave-flash"
    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
  4. Open Flash file (*.fla)

  5. Example use of query-string

  6. on (press)
    {
    getURL("page.php?catID="+_root.catID+"&state=KELANTAN&subcatID="+_root.subcatID);
    }

  7. catID was appended on the URL string

Using Swift Mailer for Effective PHP mailing

Many newbie in PHP programming when starting to send email from php using php native email function may find it hard to configure to send a simple email. But I have found another way by using classes from swift mailer. Luckily it's free.

It has all the basic function including attachment, send batch email, send mass email, HTML email, and HTML/plain email. Yet, I haven't fully explored all the other features.

Another interesting is, Swift mailer handle basic email checking. That means, when you send out using batch send, it can check every email address provided and you'll be able to list those email.

Swift supports event-driven plugins which offer you the opportunity to really take control of the library and set this mailer apart from everything else that's out there. Over time, and from previous versions, the library has been steadily refactored and is now usable for more than just the blind sending of emails. It can compose RFC 2822 compliant messages for use elsewhere too. I'm looking at offering the reverse and parsing real emails into the message object format used in the library.
This one is another features I haven't yet explored and maximise the potential of this classes. I'm hoping if someone out there could share with me what can be done and achieve this Swift Mailer

Tuesday, July 3

ERROR 1005 (HY000): Can't create table (errno: 13)

I can't alter table (eg: add table, edit field attributes) in mysql as it produce error

ERROR 1005 (HY000): Can't create table (errno: 13).

The solution is to change the chmod of the folder in /var/lib/mysql/foldername