I found the solution here
Get Parent URL With Javascript December 6, 2009
I frequently have to create child window and the child windows sometimes need its parent URL, in javascript just create a variable to store the url. In this example I copy the content of parentURL variable to a hidden form element named sourceURL
<script type="text/javascript">
function frmSubmit(){
parentURL = opener.location.href;
document.getElementById('sourceURL').value = opener.location.href;
document.forms['myform'].submit();
}
</script>
<form name="myform" id="myform" method="post" action="target.php">
<input type="hidden" name="sourceURL" id="sourceURL" />
<input type="button" value=" submit " onclick="frmSubmit()" />
</form>
WebERP 500 Internal Server Error November 9, 2009
- delete .htaccess file
- create php.ini with
magic_quotes_gpc=off
register_globals=off
31 Useful Firefox Plugins for Web Developer October 21, 2009
Update: I’ve packed all these extension into one XPI file for fast install, you can download it from:
- Measure It
https://addons.mozilla.org/en-US/firefox/addon/539
- View Source Chart
https://addons.mozilla.org/en-US/firefox/addon/655
- HTTPfox
https://addons.mozilla.org/en-US/firefox/addon/6647
- FireFTP
https://addons.mozilla.org/en-US/firefox/addon/684
- IEtab
https://addons.mozilla.org/en-US/firefox/addon/1419
- FlashBlock
https://addons.mozilla.org/en-US/firefox/addon/433
- DownThemAll
https://addons.mozilla.org/en-US/firefox/addon/201
- Open Image in New Tab
https://addons.mozilla.org/en-US/firefox/addon/2248
- Colorful Tabs
https://addons.mozilla.org/en-US/firefox/addon/1368
- Download Statusbar
https://addons.mozilla.org/en-US/firefox/addon/26
- FireShot
https://addons.mozilla.org/en-US/firefox/addon/5648
- Fire Gestures
https://addons.mozilla.org/en-US/firefox/addon/6366
- Opera View
https://addons.mozilla.org/en-US/firefox/addon/1190
- FireBug
https://addons.mozilla.org/en-US/firefox/addon/1843
- GreaseMonkey
https://addons.mozilla.org/en-US/firefox/addon/748
- Extended Statusbar
https://addons.mozilla.org/en-US/firefox/addon/1433
- Chrome View
https://addons.mozilla.org/en-US/firefox/addon/8740
- Console2
https://addons.mozilla.org/en-US/firefox/addon/1815
- Image Zoom
https://addons.mozilla.org/en-US/firefox/addon/139
- Extension Developer
https://addons.mozilla.org/en-US/firefox/addon/7434
- Resizeable Textarea
https://addons.mozilla.org/en-US/firefox/addon/3818
- Live HTTP Headers
https://addons.mozilla.org/en-US/firefox/addon/3829
- DOM Inspector
https://addons.mozilla.org/en-US/firefox/addon/6622
- Form Saver
https://addons.mozilla.org/en-US/firefox/addon/1490
- FirePHP
https://addons.mozilla.org/en-US/firefox/addon/6149
- Tamper Data
https://addons.mozilla.org/en-US/firefox/addon/966
- Poster
https://addons.mozilla.org/en-US/firefox/addon/2691
- Flash Tracer
https://addons.mozilla.org/en-US/firefox/addon/3469
- FEBE
https://addons.mozilla.org/en-US/firefox/addon/2109
- OPIE
https://addons.mozilla.org/en-US/firefox/addon/6152
- CLEO
https://addons.mozilla.org/en-US/firefox/addon/2942
Enable File Upload on FCKEditor (PHP) October 3, 2009
- Edit
fckeditor/editor/filemanager/connectors/php/config.php - Modify $Config['UserFilesPath']
Put your application folder here
Eg:
$Config['UserFilesPath'] = ‘/myapp/’ ; - Modify $Config['UserFilesAbsolutePath']
Put your application full path here. Windows users should use double backslash here
Eg:
$Config['UserFilesAbsolutePath'] = ‘/var/www/myapp/’ ;or
$Config['UserFilesAbsolutePath'] = ‘C:\xampp\htdocs\myapp\’ ;
- After that, you can customize other variable, like these
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . ‘images/’ ;
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’images/’ ;
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . ‘images/’ ;
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’images/’ ;
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . ‘images/’ ;
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’images/’ ;
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . ‘images/’;
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == ”) ? ” : $Config['UserFilesAbsolutePath'].’images/’ ;
You can put different filetype on different upload location. In this example I put all filetype on images folder
Allowing Blank Password on PHPMyAdmin September 8, 2009
- Open CONFIG.INC.PHP
- add this:
$cfg['Servers'][$i]['AllowNoPassword'] = true;
File Hosting List August 3, 2009
Recently I have a need to upload some files to many free file hosting so I did a search on Google, and this is part of the result.
- http://www.rapidshare.com
- http://www.mediafire.com
- http://www.filefactory.com
- http://www.badongo.com
- http://www.fileden.com
- http://www.savefile.com
- http://www.filedropper.com
- http://www.turboupload.com
- http://www.zshare.net
- http://www.wikiupload.com
- http://www.webfilehost.com
- http://www.bigupload.com
- http://www.megaupload.com
- http://www.yourfilelink.com
- http://www.filefreak.com
- http://www.massmirror.com
- http://www.uploading.com
- http://www.1filesharing.com
- http://www.filesavr.com
- http://www.ripway.com
- http://www.easy-share.com
- http://www.freewebspace.net
- http://www.ziddu.com
- http://www.rarhost.com
- http://www.fileave.com
- http://www.filesend.com
- http://www.usaupload.com
- http://www.4filehosting.com
- http://www.momupload.com
- http://www.fastfreehosting.com
- http://www.walagata.com
- http://www.swmirror.com
- http://www.filexoom.com
- http://www.youshare.com
- http://www.bigfilez.com
- http://www.uploadingit.com
- http://www.spread-it.com
- http://www.fileburst.com
- http://www.launchfile.com
- http://www.midload.com
- http://www.filelodge.com
- http://www.filewind.com
- http://www.freefilehosting.net
- http://www.uploaded.to
- http://www.snapdrive.net
- http://www.divshare.com
- http://www.box.net
- http://www.4shared.com
- http://www.electronicfiles.net
- http://www.simpload.com
- http://www.uploadbox.com
- http://www.sharebee.com
- http://www.supload.com
- http://www.megashare.com
- http://www.zippyshare.com
- http://www.filecargo.com
- http://www.storeandserve.com
- http://www.zupload.com
- http://www.netgull.com
- http://www.filehat.com
- http://www.savefiles.net
- http://www.woofiles.com
- http://www.bigfilehost.com
- http://www.xs.to
- http://www.slingfile.com
- http://www.uploadmb.com
- http://www.depositfiles.com
- http://www.limelinx.com
- http://www.sharingmatrix.com
Dynamic form elements and Internet Explorer 6 June 30, 2009
A few brief entries from the ‘tiny yet annoying bugs that take far too much time to fix’ file…
I’m creating forms dynamically using JavaScript. This has led to a number of problems with IE6:
Dynamic checkboxes/radio buttons and the ‘checked’ attribute
When creating a field, I wanted to be able to apply a ‘default’ value — for example, a checkbox element might be ticked by default. This was all going smoothly until (guess what?) I tested it on IE6: the checked attribute was set, and returned ‘true’ when tested, but the box did not appear to be checked when it appeared in the form.
The answer, as I discovered thanks to this forum post, was to use the ‘defaultChecked’ attribute instead (I set both, just in case). It seems to work across browsers, which is nice. Oh, and this applies to radio buttons as well as checkboxes.
Creating radio buttons
While we’re on the subject of radio buttons, I also found that IE6 doesn’t like radio buttons created using document.createElement() (i.e. as a DOM object). It’ll render them OK, but they’re unclickable. The answer is to create them by injecting HTML into an element with [element].innerHTML:
var obj = document.createElement( ’span’ );
obj.innerHTML = ‘<input type=”radio” name=”somefield” value=1>1′;
…and so forth. Ugly.
Assigning values to multiple select elements
This was a really fiddly one, and seems to happen under only very particular circumstances. Anyway…
If you create a select element and set the ‘multiple’ attribute, IE6 can sometimes have trouble assigning values to it if you do it immediately after it’s created. Note the word ’sometimes’: I haven’t been able to create a simple enough test case to isolate the exact circumstances that are required. And it’s only a problem if you’re setting more than one value.
Anyway, the (horrible) fix is to delay setting the values using setTimeout(). The delay doesn’t matter (1 millisecond will do), but it does work.
I hope these notes help some other unfortunate soul out there avoid wasting the number of hours and brain cells that I just have!
source:
http://the-stickman.com/web-development/javascript/dynamic-form-elements-and-internet-explorer-6/
PHP Execute Time Counter June 23, 2009
This code is based on the ASP script posted by Lio. It will determine the time taken for a php script to execute correct to 0.000000000000001 seconds.
<!-- put this at the top of the page -->
<?php
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
?>
<!-- put other code and html in here -->
<!– put this code at the bottom of the page –>
<?php
$mtime = microtime();
$mtime = explode(” “,$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime – $starttime);
echo “This page was created in ” . $totaltime . ” seconds”;
?>
Install Smarty in Windows June 23, 2009
This document assumes that your webserver and php5 is running. Download Smarty - http://smarty.php.net Installation - Windows, IIS/Apache, PHP5 Extract files, rename Smarty.x.x.x to smarty (suggest OUTSIDE of your www root!) Example: d:\smarty Run phpinfo.php to find out your php.ini location Edit php.ini's include_path and add the location of the libs folder. example: include_path = ".;d:\smarty\libs" Restart IIS/Apache Setup these two folders INSIDE your www root: (wwwroot)/smarty/templates (this is where your templates will go) (wwwroot)/smarty/configs Setup these two folders OUTSIDE of your www root: d:/smarty/templates_c d:/smarty/cache Setup security settings for the webserver to write to these four folders In (wwwroot) create index.php and in (wwwroot)/smarty/templates/index.tpl with the following code: index.php: <?php // load Smarty library require('Smarty.class.php'); $smarty = new Smarty; $smarty->template_dir = 'd:/inetpub/wwwroot/smarty/templates'; $smarty->config_dir = ' d:/inetpub/wwwroot/smarty/config'; $smarty->cache_dir = 'd:/smarty/smarty_cache'; $smarty->compile_dir = 'd:/smarty/smarty_templates_c'; $smarty->assign('name','fish boy!'); $smarty->display('index.tpl'); ?> index.tpl <html> <body> Hello, {$name}! </body> </html> Now open index.php in your web browser (requested from your webserver) http://localhost/index.php You can work this out to a referenced script/class: smarty_connect.php: <?php // load Smarty library require('Smarty.class.php'); class smarty_connect extends Smarty { function smarty_connect() { // Class Constructor. // These automatically get set with each new instance. $this->Smarty(); $this->template_dir = ' d:/inetpub/wwwroot/smarty/templates'; $this->config_dir = ' d:/inetpub/wwwroot/smarty/config'; $this->compile_dir = 'd:/smarty/templates_c'; $this->cache_dir = 'd:/smarty/cache'; $this->assign('app_name', 'Intranet'); } } ?> index.php: <?php require('smarty_connect.php'); $smarty = new smarty_connect; $smarty->assign('name','Ned'); $smarty->display('index.tpl'); ?> index.tpl: <html> <body> Hello, {$name}! </body> </html> If you are getting an error that Smarty.class.php isn't found chances are that your include_path isn't correct or you didn't edit the one that the webserver is using, check your phpinfo.php! source: http://news.php.net/php.smarty.dev/2703