Install Xdebug on WAMP [Windows Platform]

1. First download latest xdebug (DLL File) from this link: Download Xdebug [Xdebug 2.1.0 5.2 VC6 (32 bit)]

 

2. Now copy the xdebug file which you just downloaded and paste it into the following directory c:\wamp\bin\php\php5.2.9-2\ext\

 

3. Next click on wamp server and go to php tab and click php.ini file [ See the Following Screenshot]

 

4. Add the following to your php.ini file

;xdebug Configuration
zend_extension_ts="C:\wamp\bin\php\php5.2.9-2\ext\php_xdebug-2.1.0-5.2-vc6.dll"

;xdebug Configuration for Remote Connection
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

If you are using php 5.3 or above version then add the following-

;xdebug Configuration
zend_extension="C:\wamp\bin\php\php5.2.9-2\ext\php_xdebug-2.1.0-5.2-vc6.dll"

;xdebug Configuration for Remote Connection
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

 

5. Now restart your webserver and point your browser to phpinfo.php and if all went well then you should see the following:

Thats All.

Hope now you can debug your php application through Xdebug.

Set default image or text in html input box

Suppose you have a user login panel which shows two input text field, one for username & another for password. Now you don’t wanna use level for this input box. Then What!!!!!!!

Simply show text or image inside input box.

Here is the code…..

<form action="#" method="post">

 <input name="login_username" value="email" type="text"  onfocus="if(this.value=='email') this.value='';" onblur="if(this.value=='') this.value='email';" />

 <input name="login_password" value="" type="password" style="background:url(../images/password.gif);"/>

 <input value="GO" name="login" type="submit" />

 <a href='#'>forgot password?</a>

 </form>

CodeIgniter- How to change uploaded file name

In CodeIgniter(Version-1.7.1), Normally we can’t change  or rename uploaded filename. Don’t understand what i am talking about. lets clear it, suppose  that u want to upload a file named “ABC” (Name of your file in your PC) to server by changing the name from “ABC to “XYZ” . Then WHAT?????

To change the uploaded file name you have to modify CodeIgniter Upload class which can be found at

system\libraries\Upload.php

then go to line number 190 and insert comment tag before the line which you have to modify

or simply you have to find the line which is shown here


// Set the uploaded data as class variables
 $this->file_temp = $_FILES[$field]['tmp_name'];        

 //insert a single comment tag to the following line
 //$this->file_name = $this->_prep_filename($_FILES[$field]['name']);

 $this->file_size = $_FILES[$field]['size'];        
 $this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
 $this->file_type = strtolower($this->file_type);
 $this->file_ext     = $this->get_extension($_FILES[$field]['name']);

Next add the modiefied code after the last line which is shown here


$this->file_ext     = $this->get_extension($_FILES[$field]['name']);
 //Add the Modifide Code here
 if (empty($this->file_name)){
 $this->file_name = $this->_prep_filename($_FILES[$field]['name']);
 }
 else{
 $this->file_name = $this->_prep_filename($this->file_name.$this->file_ext);    
 }

Now when you load upload class then provide the name and do_upload function upload  your file by setting the name you provided.

</pre>
//Provide your desire file name

$config['file_name']='XYZ';

$config['upload_path'] = './uploads/';
 $config['allowed_types'] = 'gif|jpg|png';
 $config['max_size']    = '100';
 $config['max_width']  = '1024';
 $config['max_height']  = '768';

 $this->load->library('upload', $config);
<pre>

Thats all…