Jump to content

GD77

Members
  • Posts

    108
  • Joined

  • Last visited

Posts posted by GD77

  1. Hello:
     

    I m having this foreach duplicated in returned data this happened when I upgraded to a news version of xammp and can t figure out why the duplicated are taking place...

     

    <?php
    if(isset($sess_uLOG) && $sess_uLOG==true) {
    $attrib = array('name'=>'fxxx','class' => 'fxxx');
    echo form_open('main/profile',$attrib);
    ?>
    <ul class="cont_up"><!-- START section Overview-->
    <?php
    foreach ($u_profile as $u_pr) : ?>
    	<li>
    		<div class="sec_topic">Overview<span><?php $ubtn=array('name'=>'form_btn','value'=>'btn_save0','type'=>'submit','content'=>'Save');echo form_button($ubtn)?></span></div>
    		<div class="profile_pic">
    			<img src="<?php echo base_url()."assests/imgs/profile/thumbs/".$u_pr->prof_pic; ?>" width="200" height="200" alt="<?php echo $u_pr->un; ?>">
    		</div>
    		<div class="sec_content0">
    			<blockquote>
    				<span>gender:</span><span>
    				<SELECT name="ugender">
    <?php
    @$u_gender=$this->input->post('ugender', TRUE);
    foreach ($ar_gender as $val_gender) {
    
    	if ($u_gender != NULL && !empty($u_gender)) {
    		echo "<option value='$val_gender'"; if ($val_gender == $u_gender) {echo " selected='selected'";}
    		echo ">".$val_gender."</option>\n";
    
    	} else {
    		echo "<option value='$val_gender'"; if ($val_gender == $u_pr->gender) {echo " selected='selected'";}
    		echo ">".$val_gender."</option>\n";
    	}//END if else post	
    }
    ?>				</SELECT>				
    				<span>name:</span>
    				<span>
    				<input type="text" name="ufname" value="<?php echo isset($_POST['ufname']) ? $_POST['ufname'] : $u_pr->ufn; ?>" maxlength="12">
    				<input type="text" name="ulname" value="<?php echo isset($_POST['ulname']) ? $_POST['ulname'] : $u_pr->uln; ?>" maxlength="12">
    			             </span>
    				<span>username:</span>
    				<span><input type="text" name="uname" value="<?php echo isset($_POST['uname']) ? $_POST['uname'] : $u_pr->un; ?>" maxlength="18"></span>
    				<span>country:</span><span>
    				<SELECT name="ucountry">
    <?php
    @$u_count=$this->input->post('ucountry');
    
    foreach ($country as $value) {
    
    	if ($u_count != NULL && !empty($u_count)) {
    		echo "<option value='$value'"; if ($value == $u_count) {echo " selected='selected'";}
    		echo ">".$value."</option>\n";
    	} else {
    		echo "<option value='$value'"; if ($value == $u_pr->u_country) {echo " selected='selected'";}
    		echo ">".$value."</option>\n";
    	}//END if else post	
    }
    ?>
    </SELECT>
    				</span>	
    				<span>phone: +</span><span><input type="text" name="uphone" value="<?php echo isset($_POST['uphone']) ? $_POST['uphone'] : $u_pr->u_phone; ?>" maxlength="18"></span>
    		    </blockquote>
    		</div>
    	</li>
    <?php endforeach; ?>
    </ul><!-- END section Overview-->
    <?php
    echo form_close();
    }else{
    	....
    }
    
  2. Thanks, and I've used sprintf which is better then strn_pad in this case just need it for single digits.

     

    function add_leading_zeros($array) {
            
        foreach($array as $key=>$value) { $array[$key] = sprintf("%02s",$value); }
                
        return $array;
    }
    print_r(add_leading_zeros(range(1,14)));
    
  3. Hello:

    Is their a way to format range single digits?

    ex:
     

    $ar1 = range (1,14);
    

    will return array(1,2,3...) I need to append 0 to single digits to have 01,02...

     

    Thanks.

  4. ok I v e noticed the issue occurs when i m encrypting an email address...
    I ve  dropped the CI built in and tried similar approach with the following:

     

      function encryptz($text) {
        return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)))); 
      }//END Fn encryptz
    
      function decryptz($text){
        return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))); 
      }//END Fn decryptz
    

    The data I m decrypting are returned through a url so using:

    $this->input->get('var');
    

    works except if var was returning an encrypted e-mail address...

     

  5. Yes using CI here first time so far so good fast too only main issue having is setting the right .htaccess and encrypt decrypt issues other then that give laravel a try too looks promising, as been said you need to experiment what it s best for you.
    Still CI has lots of community help behind it, fast and reliable with many tutorials to learn from...

  6. Is it possible to trigger form validation error from the Model or Controller to target

    validation_errors();

    used in a form?

    Ex:

    ///////////////view.php////////////
    
    $att = array('name'=>'x','class' => 'y', 'id' => 'z'); echo form_open('.../...',$att);?> ....
    ......
    
    ///////////////////////////////////
    
    ///////////////model.php or controller.php////////////
    
    function tst(){ ....validation code... then... trigger custom error for the validation_errors() in the view.php
    
    /////////////////////////////////////////////////////
    

     

  7. Ya I agree I am a bit paranoid though I still think it s a good Idea if you store the encryption key in the db and encrypted since most of us are on reseller or web hosting servers..


    About encrypting the config file!!! many times I had access to web servers either for new web making or editing and like everyone you ll have access to all users 's files on that server... this is my main concern...

  8. How safe is to rely on codeigniter own encryption key..?
    If you used encryption key do you have to encrypt the config.php file?

    Any ideas aside from storing the key into the db then loading it to the config.php which in turn might pose a bit of performance issue but still might be better solution...

  9. FIXED :/ can t believe I had an additional bracket at the the end of a long file :( wtf
    "}"<-- this was the problem btw as I said @pramodhkumar use autoload.php.. I had the model autoload so no need for $this->load->...

  10. Hello:

     

    I'm using the following from the controller to call a method from the model but receiving and erro:

     

    //from the controller  
     function getT(){
       	$th=$this->input->post('the', TRUE);
    
    	$this->model_data->thCheck($th);
    
       }//END Fn getT()
    
    //from the model
    function thCheck($th=NULL){
    
    echo $th;
    
    }
    

    yet I m receiving that error:

    Fatal error: Call to undefined method model_Data::thCheck() in ....\controllers\main.php on line 20

  11. Hello:

     

    I ve .css file with background images where paths are not working :/

    ex:

     

    .cmd {background:url(/assests/theme/theme1/img01.png);}
    

     

    any work around since we can t use base_url() in css of course...

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.