Tech Sharing Blog

Computer knowledge, news, product, SEO, earn money online sharing place

Advertisement

Archive for the ‘ Programming ’ Category


That’s nothing perfect in the world, no matter how good the application and web site is, that’s still some hole that we may need to handle. By handling that kind of hole, we try to make our application close to perfect.


This powerpoint show that Why we need the error handling, What are error, how the error being handled, type of error, type of error handling.


Advanced ColdFusion - Error Handling (192)


Error Catching with CFERROR and CFCATCH (176)

Popularity: 4% [?]

Here is the presentation slide by Pete Freitag, Principal Consultant from Founeo Inc.

In the presentation slide show it will cover the following topic include:

  • Uchecked input
  • File Uploads
  • XSS-Cross Site Scripting
  • SQL Injection
  • Cross Site Request Forgery
  • CRLF Injection
  • Session Hijacking


Secure your Coldfusion application (162)

Popularity: 4% [?]


Google for long time regarding how to hide the HTTP header for IIS in order to mask the server identity and finally found out this tools call URLScan.
Basically URLScan is an ISAPI filter that allows Web site administrators to restrict the kind of HTTP requests that the server will process. By blocking specific HTTP requests, the URLScan filter prevents potentially harmful requests from reaching the server and causing damage.
Actually most of the features that provided by URLScan are included in IIS but not the Remove Server Header features as microsfot find out that this is not an important issue that that’s no real security benefit of include in IIS. But that’s some marketing purposes why microsoft not encourage web master to hide the identity.

How to hide the IIS identity:

  1. download the URL scan
  2. Install the URL scan in your server.
  3. go to the URLScan config file at C:\WINDOWS\system32\inetsrv\urlscan\UrlScan.ini
  4. Change RemoveServerHeader=1 (by default is 0)
  5. Save the file
  6. Restart your IIS
  7. Check on your header (http://www.rexswain.com/httpview.html)
For more detail on the URLScan and the features, you may easily get a lot of information by Google on URLScan



Popularity: 1% [?]

SQLInjection1 1 Possible injection use keyword

All the web developer, web admin, as well as DB admin are always facing the attacking from all around the world toward their web site, but how to prevent it?


Some may use the 3th party software to prevent it, some may just filter all the possible keyword enter by the user, some will use the database store procedure to prevent it. The following are some of the keyword that you may need to take care of when you allow your user to enter any input to your system.


Web site injection attack keyword (204)

Popularity: 4% [?]

the following example use the javascript regular express to validate the value where Chinese charecter is not allow.


<script   language=javascript>   
    
  function   checkChinese(){   
    
      var   re   =   /[\u4E00-\u9FA0]+/;   
    
      if   (re.test(form1.tjiccode.value))   
    
      {   
    
          alert(“不允许输入中文!”);   
    
  return   false;   
    
      }   
    
  }   

Popularity: 1% [?]

Because of I need to handle a project in my comany which include the forum features, but the language is Chinese Simplify, so I manage to find out this 9 years old product.


phpBB is a free and open source forum application. phpBB was created in June 2000 as UBB-like forum solution using the PHP language and the latest version up to today is phpBB 3.0 ‘Olympus 3.5′ (Release at 31 May 2009). phpBB is available at no cost, released under the GNU General Public License.


I choose this as my forum in the new project is because it come with an intuitive adminstration system and extensive customisation capabilities. Besides that, it is capable to supporting hundreds of million of discussions in any language and boatst some of the largest forum communities on the Internet. phpBB is developed by six core developers, more than forty team members and is supported by a community of almost 300,000 users and developers up to today.


The lastest version support the UTF-8 encoding including the Simplify chinese , tranditional chinese encoding, Russian, Thai, Turkish and more. Besides that, it support most of the most common database in market such as MSSQL, MySQL, PostgreSQL, Oracle, Firefird, SQLList. The release of phpBB 3.0 is come with nearly 500 enhancements, modification and extenstion compare to the previous version.


phpBB also is a highly recomended forum application for those who like to customize and quickly integrate into any content management system or static web site because it come with very flexible framework, documented Application Programming Interfaces (APIs).


Click here for more phpBB forum features list
Click here to go to phpBB forum official page
Click here to go to phpBB forum download page


phpbb sample forum home page phpBB open source forum application

phpBB forum home page

phpbb sample forum backend admin phpBB open source forum application

phpBB sample forum backend admin control paner


Popularity: 11% [?]

Just working out on the phpBB3.0 on the user registration integration with the main web site. Because of I plan to write the main web site using the coldfusion + MS SQL, so the only way as I may thinking of to do the integration is write a web service a like page for my coldfusion application to call.


After read through some forum, blog, web site and finally find out the way for the integration and here to share my simple PHPBB 3.0 user registration integration code.


  < ?PHP
  define('IN_PHPBB', true);
  /* set scope for variables required later */
  global $phpbb_root_path;
  global $phpEx;
  global $db;
  global $config;
  global $user;
  global $auth;
  global $cache;
  global $template;

  # your php extension
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  $phpbb_root_path = "../";

/* includes all the libraries etc. required */
  require($phpbb_root_path ."common.php");
  require($phpbb_root_path ."includes/functions_user.php");
  $use-->session_begin();
  $auth->acl($user->data);

// username of the user being added
$username = 'david';

// the user’s password, which is hashed before inserting into the data base
$password = 'password';

// an email address for the user
$email_address = 'admin@david-cheong.com';

// since group IDs may change, you may want to use a query to make sure you are grabbing the
// right default group...
$group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
$sql = 'SELECT group_id
        FROM ' . GROUPS_TABLE . "
        WHERE group_name = '" . $db->sql_escape($group_name) . "'
            AND group_type = " . GROUP_SPECIAL;

$result = $db->sql_query($sql);

$row = $db->sql_fetchrow($result);

$group_id = $row['group_id'];

// timezone of the user... Based on GMT in the format of '-6', '-4', 3, 9 etc...
$timezone = '8';

$language = 'zh_cmn_hans';

// here if the user is inactive and needs to activate thier account through an activation link
// sent in an email we need to set the activation key for the user... (the goal is to get it about
// 10 chars of randomization) you can use any randomization method you want, for this example,
// I’ll use the following...
$user_actkey = md5(rand(0, 100) . time());
$user_actkey = substr($user_actkey, 0, rand(8, 12));

// IP address of the user stored in the Data base.
$user_ip = $user->ip;

// registration time of the user, timestamp format.
$registration_time = time();

// time since the user is inactive. timestamp.
$user_inactive_time = time();

$user_row = array(
    'username'              => $username,
    'user_password'         => phpbb_hash($password),
    'user_email'            => $email_address,
    'group_id'              => (int) $group_id,
    'user_timezone'         => (float) $timezone,
    'user_dst'              => $is_dst,
    'user_lang'             => $language,
    'user_type'             => '0',
    'user_actkey'           => $user_actkey,
    'user_ip'               => $user_ip,
    'user_regdate'          => $registration_time,
	'user_dateformat'   	=> 'D M d, Y g:i a'
);

$user_id = user_add($user_row);

echo 'userid' . $user_id;

?>

Click here for PHP Cross Reference of Architecture PHPBB3

Popularity: 12% [?]

Check the page’s last update date

  1. Go to any web site as you like
  2. Delete the content in the URL address bar
  3. Enter the following script javascript:alert(document.lastModified)
  4. Press Enter
  5. This code will display any web page’s last update including the specific time, so by using the this script, you will know that the content you get is that the latest or not

tech share latest update URL Hidden Tricks to check pages last update

Tech share latest update is 11 Oct 2009 16:36:23


Popularity: 1% [?]

HTML table word wrap

By on September 21, 2009

I created a table to display a link which consist of a long verification code plus some variable to pass to the web site. There is no any space within the long url and query string. This is not the problem, the problem is on my table, because of the link is in one long string without any space, so when it display on the screen, the table is expanded.


I come across few solution, some people suggest that using the javascript to split the string in to 2 or more row when it excess the string lenght limit. I don’t think this is the best solution, and finally get the solution of control the table using the CSS.


WORD-BREAK:BREAK-ALL;

Syntax:

<table style=”word-wrap: break-word;” width=100>
     <tr>
          <td>long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_long_string</td>
    </tr>
</table>

Popularity: 1% [?]

Get the array lenght in Coldfusion

By on September 4, 2009

When dealing with array, we cannot run away for looping. Because only with looping, you can cut short your hard coded script to read the value from array. And also you no need to worry about the dynamic of array.


Arraylen is the function that determines the number of elements in an array.


The syntax is ArrayLen(array)


Code

<!— Assigning value into 3D array —>

<cfset ResultsArray[1][1][1] = ‘a’>
<cfset ResultsArray[1][1][2] = ‘b’>

<cfset ResultsArray[1][2][1] = ’3′>
<cfset ResultsArray[1][2][2] = ’4′>

<cfset ResultsArray[2][1][1] = ‘z’>
<cfset ResultsArray[2][1][2] = ‘x’>

<cfset ResultsArray[2][2][1] = ‘m’>
<cfset ResultsArray[2][2][2] = ‘p’>

<cfset ResultsArray[3][1][1] = ‘ww’>
<cfset ResultsArray[3][1][2] = ‘xx’>

<cfset ResultsArray[3][2][1] = ’22′>
<cfset ResultsArray[3][2][2] = ‘cc’>


<!— Read the array lenght for 1st D, 2nd D, and 3th D —>
<cfoutput>
#ArrayLen(ResultsArray)#<br> <!— Get the lehgth of 1st D —>
#ArrayLen(ResultsArray[1])#<br><!— Get the lehgth of 2nd D —>
#ArrayLen(ResultsArray[1][1])#<br><!— Get the lehgth of 3th D —>
</cfoutput>



Popularity: 1% [?]

SEO Powered by Platinum SEO from Techblissonline