June 1st, 2009 by vishal.shukla §
We have our small menu ready now, we know what all we are going to serve in Objectville. Oops, it may seem strange if you are new here in Objectville. New readers, just have a look at New Restaurant In Town and continue here. Lets prepare class for each item
Classes we need to create:
DoubleCheesePizza
ItalianPizza
FreshVeggiePizza
Vegetable Sandwich
Cheese Sandwich
Aalu-matar Sandwich
We also need to take care of our ordering system in hotel so we need one attribute called “cost” in all of the above classes. We will have descriptions of each item. Keeping in mind likings of customers, we need to have thin crust pizzas, as well as thick crust pizza. So lets have a look at these classes.
Read More >>
May 30th, 2009 by vishal.shukla §
Hi again,
After thinking for quite a while for what to post in the blog, I thought its not bad to go in Kathy’s way.
If you didn’t ever try then just have one eye on any book of Kathy Sierra or you can say synonym of Kathy is “Head First” books. Just google out any of the “Head First” book and you will surely get “never read before” books.
So I finally decided that I will open one restaurant Objectville soon. But to make Objectville rock in the town, we will be serving very few fastfood only in the initial stage, however, we want to go long way so we need system with strong architecture. But we don’t even want to increase complexity of the system unnecessarily by just piling up different patterns without thinking whether its needed.
Read More >>
May 29th, 2009 by vidyadhar.yagnik §
In some website there is need of downloading functionality of multiple files. In that case it is headache for PHP developer that how to give option for download multiple file in single click with lower bandwidth. So, the solution is here: just create zip file containing all the files and give one link for download the zip files.
createZip.inc.php is a class which creates zip file from different files stored on various directories on server and output the necessary request response headers to serve the generated ZIP archive for download.
Example Code Snippet:
include_once("createZip.inc.php");
$createZip = new createZip;
$directoryName = "DownloadImages/";
$createZip -> addDirectory($directoryName); // Adding Directory to ZIP file
$file1ToZip = “image1.jpeg”; // filename1 which is to be added in zip
$fileContents=file_get_contents($file1ToZip);
$createZipFile->addFile($fileContents, $directoryName.$file1ToZip);
$file2ToZip = “image2.jpeg”; // filename2 which is to be added in zip
$fileContents=file_get_contents($file2ToZip);
$createZipFile->addFile($fileContents, $directoryName.$fileToZip);
$outputDir = “./”;
$outputFile = $outputDir.”Images.zip”; // Zip file name
$fd = fopen ($outputFile, “wb”); // Temporary Creating file on disk
$out = fwrite ($fd, $createZip -> getZippedfile()); // Writing zip contents to temporary file
fclose ($fd);
$createZip -> forceDownload($outputFile); // stream the generated ZIP archive for download
@unlink($outputFile); // unlink temporary file
Credits goes to Author of the class: “Rochak Chauhan”
Source: http://www.phpclasses.org/browse/package/2322.html
Author:
Vidyadhar Yagnik
PHP Developer: Digicorp Information Systems Pvt. Ltd.
[email protected]
May 29th, 2009 by nilesh.shamnani §
There are two crucial debugging tools. Debugging Ajax applications presents challenges not present in a normal server-side application. If an Ajax call fails, you won’t necessarily know. You need a way of monitoring the Ajax calls that happen between the browser and server. The first tool is called Fiddler. You can download this tool (for free) at http://www.fiddler2.com. Fiddler enables you to view HTTP requests and responses, including Ajax calls. Fiddler works by installing itself as a proxy between your web browser and the rest of the universe. You can use Fiddler with Internet Explorer, Mozilla Firefox, Opera, Safari, and just about any other browser. After you install Fiddler, you can launch the tool by selecting the menu option Tools, Fiddler2 from within Microsoft Internet Explorer. After Fiddler launches, every browser request and response is recorded in the Fiddler Web Sessions pane. You can click a request and then click the Session Inspector tab to see the full request and response
NOTE :
If you can’t get Fiddler to capture page requests from localhost, try adding a period directly after localhost in the browser address bar. For example, make a request that looks like this: http://localhost.:6916/Original/Feedback.aspx If you are using Microsoft Vista, you might need to disable IPv6 support. In Fiddler, select the menu option Tools, Fiddler Options, and uncheck the Enable IPv6 check box.
The other critical Ajax debugging tool is Firebug, which is a free Firefox extension. You can download Firebug by launching Firefox and selecting the menu option Tools, Addons. Next, click the Get Extensions link. Finally, enter Firebug into the search box and follow the installation instructions. Firebug, like Fiddler, enables you to monitor Ajax calls, but it enables you to do much more. After you install Firebug, you enable it by selecting the menu option Tools, Firebug and unchecking Disable Firebug. After Firebug is enabled, you can click the green check box at the bottom right of the Firefox browser to open Firebug . Firebug has several very useful features for debugging JavaScript applications. For example, it enables you to set breakpoints in JavaScript scripts, inspect DOM elements, and determine which CSS rules apply to which elements in a page. Right now, however, I want you to notice that you can use Firebug to monitor Ajax requests and esponses. If you click the Net tab and the XHR tab, then every Ajax call will appear in the Firebug window. You can click a particular Ajax request to see the full request and response interaction between browser and server.
May 26th, 2009 by devdatt.mehta §
We are working with clients in Middle East for almost 5 years now and we have learned lot of things about development in Arabic language.
Following are some points which will help you in developing any website or application in Arabic.
- Arabic is written right to left
- If you are developing it for Kuwait clients price should be in KD and with 3 Decimal pleases.
- How to display Arabic word in html ? Should I use UTF-8 charset to display Arabic in html page ?
For example =>
HTML HEAD TAG definition.
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=’content-type’ content=’text/html; charset=UTF-8′>
<title>الاختبار</title>
</head>
<body dir=’rtl’>
الاختبار
</body>
</html>
- How to convert direction in html for Arabic ?
Arabic script is written from right to left direction of the page so to Display Arabic content use dir=’rtl’ attribute in html tag or direction=’rtl’ for css/inline style sheet. It is always right aligned.
For example
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=’content-type’ content=’text/html; charset=UTF-8′>
<title>الاختبار</title>
<body dir=’rtl’>
<div style=’direction:rtl;‘>
الاختبار
</div>
<table dir=”rtl”>
<tr>
<td align=’right’>الاختبار</td>
</tr>
</table>
</body>
</html>
- Which format of Arabic words are displayed properly and in readable format ?
Use Font to display Arabic words in “Tahoma: font size 12”.
For example
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=’content-type’ content=’text/html; charset=UTF-8′>
<title>الاختبار</title>
<body dir=”rtl” style=”font-size:12px;font-family:Tahoma,Arial;”>
<div style=”direction:rtl;text-align:right;”>الاختبار</div>
</body>
</html>
- How to save Arabic data in MySQL or database ?
Use following step to insert, save and retrieve Arabic data.
Step – 1 Table collection should be in “utf8_unicode_ci”
Step – 2 Field collection should be in “utf8_unicode_ci”
Step – 3 Use following code after connection with database. it will
set MySQL server in “utf8 character set”.
mysql_query(“SET NAMES ‘utf8′”);
For Ref:http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html
If you are not storing data in UTF-8 then you must use “urlencode” and “urldecode” function
For example
At the time of request.
$keyword = urldecode($_POST['keyword']);
SELECT * FROM <table_name> WHERE <Field Name> LIKE ‘%$keyword%’
At the time of redirect.
$keyword = urlencode($keyword);
header(‘location: file.php?keyword=$keyword’);
or
<script type=’text/javascript’>
window.location.href = “file.php?keyword=<?=$keyword?>”;
</script>
- Suggestion for multi language application setup
For example English and Arabic
1. Use prefix/LANG_CODE “ar_” and “en_” concat with field name.</
2. Query format
SELECT LANG_CODE.”field1″, LANG_CODE.”field2″,….
3 Multi language application folder structure. It is better that you should store css and images in different folder.
For example
Folder Structure
-CSS_EN
-CSS_AR
-IMAGES_EN
-IMAGES_AR
4. Words module
- Give rights to administrator to edit Arabic and English word to rectify any mistake, if any.
- For retrieve data rapidly must store all Arabic and English word in .xml file.
For example
<?xml version=’1.0′ encoding=’UTF-8′?>
<lang>
<words>
<word id=”1″ english=”Sign In” arabic=”تسجيل“></word>
</words>
</lang>
Create PHP constant file for words.
ar_words.php
<?php
define(SIGNIN,trim(str_replace(‘#’,'&#’,$p->output['0']['child'][0]['child'][3]['attrs']['ARABIC'])),” “);
?>
en_words.php
<?php
define(SIGNIN,$p->output['0']['child'][0]['child'][3]['attrs']['ENGLISH']);
?>
Let us know if you feel some important points are missing here.
May 13th, 2009 by dhruval.shah §
This is a procedure for removing extra spaces from text and make it exact one.
public string RemoveExtaSpaces(string text)
{
Regex regex = new Regex(@”\s{2,}”, Options);
text = regex.Replace(text.Trim(), ” “); //This line removes extra spaces and make space exactly one.
//To remove the space between the end of a word and a punctuation mark used in the text we will be using following line of code
regex=new Regex(@”\s(\!|\.|\?|\;|\,|\:)”); // “\s” will check for space near all punctuation marks in side ( \!|\.|\?|\;|\,|\:)”); )
text = regex.Replace(text, “$1″);
return text;
}
May 9th, 2009 by dhruval.shah §
This is a procedure for stripping out HTML tags while preserving the most basic formatting.
In other words, it converts HTML to plain text.
// Return Plain Text
private string ConvertHtmlToPlainText(string htmlText)
{
return System.Text.RegularExpressions.Regex.Replace(htmlText, “<[^>]*>”, string.Empty);
}
Enjoy!
May 6th, 2009 by dhaval.shah §
What is SQL Injection?
SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. This vulnerability is present when user input is manipulated for string literal escape characters embedded in SQL statements or user input is not sufficiently filtered and thereby unexpectedly executed.
How SQL Injection looks like?
Basic SQL Injections
If anybody want to pull up the records of particular user name from the user information table and if “username” variable is set as
X‘ OR ‘Y‘ = ‘Y
By inputting the above code as user name , Let see how’s it work at back end?
SELECT * FROM UserInformation WHERE UserName = ‘X’ OR ‘Y’ = ‘Y’
If we use this type of code were in an authentication procedure then this example could be used to force the selection of a valid “username” because the evaluation of ‘Y’='Y’ is always true and you will be logged in as the user on top of the SQL table.
Same way if the “username” variable is set as
X‘ OR 1 = 1 –-
If we use double dashes (–) than at the back end these dashes at the end tell the SQL server to ignore the rest of the query.
SELECT * FROM UserInformation WHERE UserName = ‘X’ OR 1 = 1 –-‘
Same way more SQL Injection syntaxes are:
‘) OR (‘1’ = ‘1
‘ OR ‘1’ = ‘1
‘ OR 1 = 1
“ OR “1”= “1
“ OR 1 = 1 –-
OR 1 = 1 –-
How can we get free from SQL Injection?
- Validate all input before using it.We can validate the input by this way.Reject the input that contains the following characters:
1. Single Quote(‘)
2. Dash ( – )
3. /* and */
4. Semicolon ( ; )
- User parameterized input with stored procedures: Stored procedures may be susceptible to SQL injection if they use unfiltered input. So all the input provided to the stored Procedures is provided in the form of parameters
- Filtering input: Replace a Single Quote (‘) with two Single Quotes (‘’) to filter the input.
- Limit the database permission: Use a limited access account to connect to the database
- Don’t store secrets in plain text: Encrypt or hash passwords and other sensitive data; you should also encrypt connection strings
- Exceptions should divulge minimal information: Don’t expose too much information in error messages; display minimal information in the event of error handling.
Reference :
http://en.wikipedia.org/wiki/SQL_injection
http://www.secureworks.com/research/articles/sql-injection-attacks
May 2nd, 2009 by nayan.lodha §
Uber-Uploader
Uber-Uploader is a group of programs written in Perl, PHP and Javascript. It is intended to present a graphical representation of the status of a web based file upload in the form of a progress bar.
External Links
CakePHP
CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. Our primary goal is to enable you to work in a structured and rapid manner–without loss of flexibility.
CakePHP takes the monotony out of web development. We provide you with all the tools you need to get started coding what you really need to get done: the logic specific to your application. Instead of reinventing the wheel every time you sit down to a new project, check out a copy of CakePHP and get started with the real guts of your application.
Why We Need To Integrate CakePHP With Uber-Uploader
As mention above Uber-Uploader is a group of programs written in Perl, PHP and Javascript.It is used to upload large volume video files.It also provide a very good GUI as progress bar and show some informaton like Elapsed Time ,Est Time Left ,Percent Complete etc that helps user to keep patience while upload a large volum files.
Here is the some steps How to integrate uber uploader in cakePHP
1.Create a folder in Webroot/files and put all files in that folder
eg. i created ‘uploder’ in webroot/files than i created ‘html’ folder in ‘uploder’ folder
2.Set the $TEMP_DIR value in ‘ubr_upload.pl’ AND ‘ubr_ini.php’.
eg. $TEMP_DIR = ‘/xyz.com/html/tmp/ubr_temp/’;
eg. $TEMP_DIR = ‘/var/tmp/ubr_temp/’;
eg. $TEMP_DIR = ‘/usr/home/roger/ubr_temp/’;
3.Set the $_CONFIG['upload_dir'] value in ‘ubr_default_config.php’. It should be physical path
eg. $_CONFIG['upload_dir'] = ‘/XYZ.com/app/webroot/files/uploader/html/tmp/ubr_uploads’;
eg. $_CONFIG['upload_dir'] = ‘/var/www/html/ubr_uploads/’;
eg. $_CONFIG['upload_dir'] = ‘/usr/local/www/htdocs/ubr_uploads/’;
eg. $_CONFIG['upload_dir'] = $ENV{‘DOCUMENT_ROOT’} . ‘/ubr_uploads/’;
4.Set the correct path values for the scripts in ‘ubr_ini.php’.
eg. PATH_TO_UPLOAD_SCRIPT = ‘../app/webroot/files/uploader/html/cgi-bin/ubr_upload.pl’; // Path info
PATH_TO_LINK_SCRIPT = ‘../app/webroot/files/uploader/html/ubr_link_upload.php’; // Path info
PATH_TO_SET_PROGRESS_SCRIPT = ‘../app/webroot/files/uploader/html/ubr_set_progress.php’; // Path info
PATH_TO_GET_PROGRESS_SCRIPT = ‘../app/webroot/files/uploader/html/ubr_get_progress.php’; // Path info
PATH_TO_JS_SCRIPT = ‘../app/webroot/files/uploader/html/ubr_file_upload.js’; // Path info
PATH_TO_JQUERY = ‘../app/webroot/files/uploader/html/jquery-1.3.1.min.js’; // Path Info
PATH_TO_CSS_FILE = ‘../app/webroot/files/uploader/html/ubr.css’; // Path info
DEFAULT_CONFIG = ‘/XYZ.com/app/webroot/files/uploader/html/ubr_default_config.php’; // Path info
5.Make ubr_pload.pl executable with the command chmod 755 ubr_pload.pl
6.Set the correct path for $_CONFIG['redirect_url'] in ‘ubr_default_config.php’
7.Set the correct path for $_CONFIG['path_to_upload'] and $_CONFIG['upload_dir'] in ‘ubr_default_config.php’.It is the Directory where the video get uplaod
eg. /home/xyz.com/app/webroot/files/uploader/html/tmp/ubr_uploads/
8.Make sure that both path ($_CONFIG['path_to_upload'] and $_CONFIG['upload_dir']) should be same.
9 Make sure that path for $TEMP_DIR in ubr_upload.pl should be same to $TEMP_DIR value in ‘ubr_ini.php
10.Now Create a action in controller and include the following code
eg action “uploadvideo” in videos_controller
$this->set(“DEBUG_AJAX”,$DEBUG_AJAX);
$this->set(“PATH_TO_UPLOAD_SCRIPT”,$PATH_TO_UPLOAD_SCRIPT);
$this->set(“PATH_TO_JQUERY”,$PATH_TO_JQUERY);
$this->set(“PATH_TO_GET_PROGRESS_SCRIPT”,$PATH_TO_GET_PROGRESS_SCRIPT);
$this->set(“PATH_TO_SET_PROGRESS_SCRIPT”,$PATH_TO_SET_PROGRESS_SCRIPT);
$this->set(“PATH_TO_CSS_FILE”,$PATH_TO_CSS_FILE);
$this->set(“DEFAULT_CONFIG”,$DEFAULT_CONFIG);
$this->set(“MULTI_CONFIGS_ENABLED”,$MULTI_CONFIGS_ENABLED);
$this->set(“PATH_TO_LINK_SCRIPT”,$PATH_TO_LINK_SCRIPT);
$this->set(“PATH_TO_JS_SCRIPT”,$PATH_TO_JS_SCRIPT);
$this->set(“_CONFIG”,$_CONFIG);
$this->set(“CGI_UPLOAD_HOOK”,$CGI_UPLOAD_HOOK);
$this->set(“GET_PROGRESS_SPEED”,$GET_PROGRESS_SPEED);
$this->set(“DELETE_LINK_FILE”,$DELETE_LINK_FILE);
if($PHP_ERROR_REPORTING){ error_reporting(E_ALL); }
header(‘Content-type: text/html; charset=UTF-8′);
header(‘Expires: Mon, 26 Jul 1997 05:00:00 GMT’);
header(‘Last-Modified: ‘ . date(‘r’));
header(‘Cache-Control: no-store, no-cache, must-revalidate’);
header(‘Cache-Control: post-check=0, pre-check=0′, FALSE);
header(‘Pragma: no-cache’);
//Set config file
if($MULTI_CONFIGS_ENABLED){
// Put your multi config file code here
$config_file = ‘ubr_default_config.php’;
}
else{ $config_file = $DEFAULT_CONFIG; }
// Load config file
require $config_file;
//***************************************************************************************************************
// The following possible query string formats are assumed
//
// 1. No query string
// 2. ?about=1
//***************************************************************************************************************
if($DEBUG_PHP){ phpinfo(); exit(); }
elseif($DEBUG_CONFIG){ debug1($_CONFIG['config_file_name'], $_CONFIG); exit(); }
elseif(isset($_GET['about']) && $_GET['about'] == 1){
kak(“<u><b>UBER UPLOADER FILE UPLOAD</b></u><br>UBER UPLOADER VERSION = <b>” . $UBER_VERSION . “</b><br>UBR_FILE_UPLOAD = <b>” . $THIS_VERSION . “</b><br>\n”, 1, __LINE__);
}
11. Now put the following code in CTP file(“uploadvideo.ctp” )
<style>
.debug {font:16px Arial; background-color:#FFFFFF; border:1px solid #898989; width:700px; height:100px; overflow:auto;}
.alert {font:18px Arial;}
.data {background-color:#b3b3b3; border:1px solid #898989; width:350px;}
.data tr td {background-color:#dddddd; font:13px Arial; width:35%;}
.bar1 {background-color:#b3b3b3; position:relative; text-align:left; height:20px; width:<?php print $_CONFIG['progress_bar_width']; ?>px; border:1px solid #505050;}
.bar2 {background-color:#000099; position:relative; text-align:left; height:20px; width:0%;}
</style>
<script language=”JavaScript” type=”text/JavaScript” src=”../app/webroot/files/uploader/html/jquery-1.3.1.min.js”></script>
<script language=”javascript” type=”text/javascript” src=”../app/webroot/files/uploader/html/ubr_file_upload.js”></script>
<script language=”javascript” type=”text/javascript”>
var upload_range = 1;
var path_to_link_script = “<?php print $PATH_TO_LINK_SCRIPT; ?>”;
var path_to_set_progress_script = “<?php print $PATH_TO_SET_PROGRESS_SCRIPT; ?>”;
var path_to_get_progress_script = “<?php print $PATH_TO_GET_PROGRESS_SCRIPT; ?>”;
var path_to_upload_script = “<?php print $PATH_TO_UPLOAD_SCRIPT; ?>”;
var multi_configs_enabled = <?php print $MULTI_CONFIGS_ENABLED; ?>;
var check_allow_extensions_on_client = <?php print $_CONFIG['check_allow_extensions_on_client']; ?>;
var check_disallow_extensions_on_client = <?php print $_CONFIG['check_disallow_extensions_on_client']; ?>;
<?php if($_CONFIG['check_allow_extensions_on_client']){ print “var allow_extensions = /” . $_CONFIG['allow_extensions'] . “$/i;\n”; } ?>
<?php if($_CONFIG['check_disallow_extensions_on_client']){ print “var disallow_extensions = /” . $_CONFIG['disallow_extensions'] . “$/i;\n”; } ?>
var check_file_name_format = <?php print $_CONFIG['check_file_name_format']; ?>;
<?php if($_CONFIG['check_file_name_format']){ print “var check_file_name_regex = /” . $_CONFIG['check_file_name_regex'] . “/;\n”; } ?>
<?php if($_CONFIG['check_file_name_format']){ print “var check_file_name_error_message = ‘” . $_CONFIG['check_file_name_error_message'] . “‘;\n”; } ?>
<?php if($_CONFIG['check_file_name_format']){ print “var max_file_name_chars = ” . $_CONFIG['max_file_name_chars'] . “;\n”; } ?>
<?php if($_CONFIG['check_file_name_format']){ print “var min_file_name_chars = ” . $_CONFIG['min_file_name_chars'] . “;\n”; } ?>
var check_null_file_count = <?php print $_CONFIG['check_null_file_count']; ?>;
var check_duplicate_file_count = <?php print $_CONFIG['check_duplicate_file_count']; ?>;
var max_upload_slots = <?php print $_CONFIG['max_upload_slots']; ?>;
var cedric_progress_bar = <?php print $_CONFIG['cedric_progress_bar']; ?>;
var cedric_hold_to_sync = <?php print $_CONFIG['cedric_hold_to_sync']; ?>;
var bucket_progress_bar = <?php print $_CONFIG['bucket_progress_bar']; ?>;
var progress_bar_width = <?php print $_CONFIG['progress_bar_width']; ?>;
var show_percent_complete = <?php print $_CONFIG['show_percent_complete']; ?>;
var show_files_uploaded = <?php print $_CONFIG['show_files_uploaded']; ?>;
var show_current_position = <?php print $_CONFIG['show_current_position']; ?>;
var show_current_file = <?php if($CGI_UPLOAD_HOOK && $_CONFIG['show_current_file']){ print “1″; }else{ print “0″; } ?>;
var show_elapsed_time = <?php print $_CONFIG['show_elapsed_time']; ?>;
var show_est_time_left = <?php print $_CONFIG['show_est_time_left']; ?>;
var show_est_speed = <?php print $_CONFIG['show_est_speed']; ?>;
var JQ = jQuery.noConflict();
JQ(document).ready(function(){
iniFilePage();
JQ(“#upfile_0″).bind(“keypress”, function(e){ if(e == 13){ return false; } });
//JQ(“#upfile_0″).bind(“change”, function(e){ addUploadSlot(1); });
JQ(“#upload_button”).bind(“click”, function(e){ //alert(valid.validate());
if(valid.validate())
linkUpload();
});
JQ(“#reset_button”).bind(“click”, function(e){ resetForm(); });
});
</script>
<script type=”text/javascript” src=”http://www.xyz.com/app/webroot/files/uploader/html/ubr_file_upload.js” ></script>
<link href=”http://www.xyz.com/app/webroot/files/uploader/html/ubr.css” type=”text/css” rel=”stylesheet” />
<!– Start Progress Bar –>
<div align=”center” id=”progress_bar” style=”display:none;”>
<div id=”upload_status_wrap” class=”ubrBar1″ style=”width:400px”>
<div id=”upload_status” class=”ubrBar2″></div>
</div>
<?php if($_CONFIG['show_percent_complete'] || $_CONFIG['show_files_uploaded'] || $_CONFIG['show_current_position'] || $_CONFIG['show_elapsed_time'] || $_CONFIG['show_est_time_left'] || $_CONFIG['show_est_speed']){ ?>
<br>
<table class=”ubrUploadData”>
<?php if($_CONFIG['show_percent_complete']){ ?>
<tr>
<td class=’ubrUploadDataLabel’>Percent Complete:</td>
<td class=’ubrUploadDataInfo’><span id=”percent_complete”>0%</span></td>
</tr>
<?php } ?>
<?php if($_CONFIG['show_files_uploaded']){ ?>
<tr>
<td class=’ubrUploadDataLabel’>Files Uploaded:</td>
<td class=’ubrUploadDataInfo’><span id=”files_uploaded”>0</span> of <span id=”total_uploads”></span></td>
</tr>
<?php } ?>
<?php if($_CONFIG['show_current_position']){ ?>
<tr>
<td class=’ubrUploadDataLabel’>Current Position:</td>
<td class=’ubrUploadDataInfo’><span id=”current_position”>0</span> / <span id=”total_kbytes”></span> KBytes</td>
</tr>
<?php } ?>
<?php if($CGI_UPLOAD_HOOK && $_CONFIG['show_current_file']){ ?>
<tr>
<td class=’ubrUploadDataLabel’>Current File Uploading:</td>
<td class=’ubrUploadDataInfo’><span id=”current_file”></span></td>
</tr>
<?php } ?>
<?php if($_CONFIG['show_elapsed_time']){ ?>
<tr>
<td class=’ubrUploadDataLabel’>Elapsed Time:</td>
<td class=’ubrUploadDataInfo’><span id=”elapsed_time”>0</span></td>
</tr>
<?php } ?>
<?php if($_CONFIG['show_est_time_left']){ ?>
<tr>
<td class=’ubrUploadDataLabel’>Est Time Left:</td>
<td class=’ubrUploadDataInfo’><span id=”est_time_left”>0</span></td>
</tr>
<?php } ?>
<?php if($_CONFIG['show_est_speed']){ ?>
<tr>
<td class=’ubrUploadDataLabel’>Est Speed:</td>
<td class=’ubrUploadDataInfo’><span id=”est_speed”>0</span> KB/s.</td>
</tr>
<?php } ?>
</table>
<?php } ?>
</div>
<!– End Progress Bar –>
<!– Start Upload Form –>
<form name=”form_upload” id=”form_upload” <?php if($_CONFIG['embedded_upload_results'] || $_CONFIG['opera_browser'] || $_CONFIG['safari_browser']){ print “target=\”upload_iframe\”"; } ?> method=”post” enctype=”multipart/form-data” action=”#” style=”margin: 0px; padding: 0px;”>
<noscript><font color=’red’>Warning: </font>Javascript must be enabled to use this uploader.<br><br></noscript>
<!– Include extra values you want passed to the upload script here. –>
<!– eg. <input type=”text” name=”employee_num” value=”5″> –>
<!– Access the value in the CGI with $query->param(‘employee_num’); –>
<!– Access the value in the PHP finished page with $_POST_DATA['employee_num']; –>
<!– DO NOT USE “upfile_” for any of your values. –>
<div id=”upload_slots”><input type=”file” name=”upfile_0″ size=”90″ <?php if($_CONFIG['multi_upload_slots']){ ?>onChange=”addUploadSlot(1)”<?php } ?> onkeypress=”return handleKey(event)” value=”"></div>
<br>
<input type=”button” id=”reset_button” name=”reset_button” value=”Reset” onClick=”resetForm();”> <input type=”button” id=”upload_button” name=”upload_button” value=”Upload” onClick=”linkUpload();”>
</form>
<!– End Upload Form –>
</div>
<div id=’ajax_div’><!– Used to store AJAX –></div>
12 Now you can run the code www.xyz.com/videos/uploadvideo
I hope this helps people looking for solution integrating Uber Uploader in Cake PHP. Leave comment in case of any issues.
April 21st, 2009 by vishal.parmar §
We have lot of clients in Middle East and thus we have to develop almost all the projects in English and Arabic.
Developing in Arabic can be quite challanging sometimes not just because it is a different language but it is also read and written from right to left. So it is a very vast subject but right now let us focus on few things.
Following are couple of issues you may come across working with Arabic but there are also simple solutions to them as explained below.
(1) Sending email in Arabic
Sometimes we find that Arabic mail is displayed properly in gmail,yahoo etc but they dont look ok in Outlook, Zimbra.
Instead of Arabic junk data like following comes in email:
áã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈáã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈ
áã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈáã íÊã ÝÊÍ ãáÝ ÇáÞÇáÈ
Solution to this problem is very simple
You just need to set mail header charset as UTF-8 intead of iso-8859-1.
PHP example:
$headers = ‘MIME-Version: 1.0′ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=UTF-8‘ . “\r\n”;
(2) To display HTML page in Arabic Language
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8“>
I hope this may help you someday when you are stuck.
Would you like to share some of your tips about working with Arabic language here? please write them in comments.
Thanks.