Keylogger's Profile User Rating: *****

Reputation: 7 Worker
Group:
Active Members
Active Posts:
344 (0.26 per day)
Joined:
14-February 11
Profile Views:
5,940
Last Active:
User is offline Sep 01 2014 08:36 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Keylogger has not set their status

Posts I've Made

  1. In Topic: [Solved] CodeIgniter file_exists not working

    Posted 16 Jul 2014

    Solved.

    Since the problem was on file_exists() and it seems that the function goes to the root directory, all I had to do was to change a little the algorithm.

    function getImage($image){
    
        if(file_exists('public/images/' . $image) == FALSE || $image == null){
            return base_url() . './public/images/no_image.png';
        }
    
        return base_url() . './public/images/' . $image;
    }
    
  2. In Topic: [Solved] CodeIgniter file_exists not working

    Posted 16 Jul 2014

    Just for the record the problem is on the function file_exists ONLY.

    If I change my original function:
    function getImage($image){
    	
    	$path = base_url() . 'public/images/';
    	
    	if(file_exists($path . $image) === FALSE || $image == null){
    		return $path . "no_image.png";
    	}
    	
    	return $path . $image;
    }
    

    To this:
    function getImage($image){
    	
    	$path = base_url() . 'public/images/';
    	
    	return $path . $image;
    }
    

    It works. However, if the image does not exists in the folder I should show the image "no_image.png", that's why I use file_exists to check if exists or not.

    View PostCTphpnwb, on 15 July 2014 - 03:28 PM, said:

    What's the value of $row->picture? More importantly, what's the value returned ($path . $image) by your function?

    The value of $row->picture is users/1/image_name.jpg.

    View Postastonecipher, on 15 July 2014 - 04:51 PM, said:

    Also, what is base_url() showing?

    The `base_url()` by himself shows correctly: http://localhost/myproject/

    Edit: Btw, I'm not calling the function in my root (http://localhost/myproject/), but yes in http:// localhost/myproject/dashboard/products.

    Edit 2: A topic with the same issue http://ellislab.com/.../79524/#399857.

    The solution told there I already tried and it keep not working for me.
    They tell to use something like:
    if(file_exists(dir_name(FCPATH)."/gallery/member_picture/member_no_image.gif"))
    

    And adapting that to my code becomes:
    if(file_exists(dirname(FCPATH) . "/public/images/" . $image) === FALSE || $image == null){
        return $path . "no_image.png";
    }
    

    Which continues not to work because if I output the dirname(FCPATH):
    return dirname(FCPATH) . "/public/images/" . $image;
    //output to img src:
    <img src="C:\xampp\htdocs/public/images/users/1/image_name.jpg" class="thumbnail-image">
    

    And when I click to open the link of src in a new tab the url is:
    http:// localhost/myproject/dashboard/C:/xampp/htdocs/public/images/users/1/image_name.jpg
    


    Other solution said in that topic is to use:
    file_exists("./gallery/member_picture/member_no_image.gif"))
    

    Again, adapting to my code:
    return "./public/images/" . $image;
    //output to img src:
    <img src="./public/images/users/1/image_name.jpg" class="thumbnail-image">
    

    And when I open the link of src in a new tab I get:
    http://localhost/myproject/dashboard/public/images/users/1/image_name.jpg
    

    which is incorrect, should be:
    http://localhost/myproject/public/images/users/1/image_name.jpg
    
  3. In Topic: .htaccess rewrite rule for several parameters

    Posted 7 Apr 2014

    View Postno2pencil, on 07 April 2014 - 11:40 AM, said:

    Thank you for sharing your overall solution!

    I can not change your reputation? It was a misclick..it should allow to change..
    Thanks anyway.
  4. In Topic: .htaccess rewrite rule for several parameters

    Posted 7 Apr 2014

    Hey, sorry again but actually it's not working.
    RewriteEngine On
    
    RewriteRule ^([a-zA-Z0-9]+)$ clients.php?name=$1
    RewriteRule ^([a-zA-Z0-9]+)/$ clients.php?name=$1
    


    Shouldn't be ?:
    RewriteRule ^([a-zA-Z0-9]+)$ index.php?name=$1
    RewriteRule ^([a-zA-Z0-9]+)/$ index.php?name=$1
    

    Even if so, I have put this .htaccess file inside the folder clients and it's not working.

    Edit: Solved this way http://forum.codecal...-urls-with-php/
  5. In Topic: .htaccess rewrite rule for several parameters

    Posted 7 Apr 2014

    View Postno2pencil, on 04 April 2014 - 11:44 AM, said:

    What you are trying to do is called clean urls :

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9]+)$ clients.php?name=$1
    RewriteRule ^([a-zA-Z0-9]+)/$ clients.php?name=$1
    
    


    Since your directories do not change, I don't believe you need to target anything more than changing the php file & the argument to the new /item/.

    Worked thanks. However, instead of put "+1 this post was usefull" I clicked the red button..and I can't figure out how do I change??

My Information

Member Title:
D.I.C Regular
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

Keylogger has no profile comments yet. Why not say hello?