Jump to content

farzher

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Posts posted by farzher

  1. Hey guys, I found what I need, it's called wkhtmltoimage It's a binary file that you can execute using PHP.

    I have it installed on my server in the root folder, just above public_html, and I can execute it through SSH, but I can't figure out how to execute it from my php script.

    Which is in public_html/lib/functions.php

     

    I tried this:

    exec("wkhtmltoimage-amd64 http://google.com/ output.png")

    It says: wkhtmltoimage-amd64: command not found

    exec("../../wkhtmltoimage-amd64 http://google.com/ output.png")

    Didn't work either.

  2. Wow, I was overwriting it using that... thanks!

     

    But I still have one crazy problem with my .htaccess rewrite. When I upload this .htaccess file my index.php comes out as html... o_O without the .htaccess it processes the index script fine...

     

    Here's the .htaccess code:

    AddHandler x-mapp-php5 .php
    AddType x-mapp-php5 .php
    Options -MultiViews
    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !\.(txt|swf|js|ico|gif|jpg|png|css|xml)$ /
    

     

    I've tried a few different codes I found online, using any of them makes my index output as html. All I'm trying to do is remove the index.php from the url.

  3. Yeah I don't think I'm using the correct include path though, on my local server it was just C:\wamp\www

    On my web host I'm using this in the php.ini: include_path=".:/var/www/vhosts/webmall.net/httpdocs/library"

    How can I check what the right path is? I have the library folder in the root, but apparently that include path doesn't work.

  4. WHERE find_in_set('chicken', items) AND find_in_set('penguin', items)

     

    Sure that works, but if I'm looking for

     

    WHERE find_in_set('chicken', items) AND find_in_set('chicken', items)

     

    (both chicken) it returns true on the set "chicken,penguin" which I don't want it to do o.o

     

    I decided not to make it its own table because it seemed like a waste of space, storing the id, item_name, and user_id instead of just item_name and then a comma. Should I make it its own item_user_list table? Even if I do, I still have the same problem.

  5. This should be easy enough to understand. I have a CSV value in MYSQL ex: "chicken,penguin".

     

    I need to find which row contains chicken AND penguin. I've been using find_in_set('chicken', items)

     

    But if I do find in set with chicken AND chicken it would still return true for "chicken,penguin"

     

    What do? To make sure both of the items are correct?

  6. Hey thanks, this was actually helpful ^_^

     

    From most of the stuff I read online it seemed like Joomla, Drupal, wordpess etc. was the standard / best way of doing things; it seemed really dumb to me though because I needed plugins just to run PHP code o_o

     

    Looks like I need a PHP framework and not CMS, I'm gonna try out zend, and if that isn't good enough I'll try the 'create your own framework' method, thanks dood.

  7. Yeah I know, sounds like a really dumb question, but seriously, I'm wondering what frameworks / plugins will help make my code more reusable, object oriented, all that good stuff.

     

    The website I'm working on now using Joomla is becoming too much of a mess, I need a better way to create menus, forms, templates, whatever. Also a better way to handle users of different types logging in, each requires a different menu. I hear Zend uses the MVC pattern, but how exactly does that work for a website? Is it worth learning?

     

    I leave you with my original question, what is the best way to make a website?

  8. So, I want to be able to do this: "WHERE something IN(SELECT array FROM table WHERE id='$id')"

    So that I can select the array of strings and use the IN function on it.

     

    Is this possible? Right now I have to select the CSV array of strings ex: "one,two,three" and format it like this "'one','two','three'" using php then do a second select passing that sting into the IN function.

     

    What kind of format would I need to use to get this to work in one query with mysql?

  9. Hi

     

    Something like this should do it (not tested so might be a typo or 2)

     

    SELECT a.ip_group_city.location, b.city, b.zipcode, c.name
    FROM ip_group_city a
    LEFT OUTER JOIN Locations b ON a.location = b.id
    LEFT OUTER JOIN  c ON a.region_code = c.code AND a.country_code = c.country_code
    WHERE ip_start <= INET_ATON('$ip')
    ORDER BY ip_start DESC LIMIT 1

     

    All the best

     

    Keith

     

    LMAO a typo or two, there were a lot haha. but no worries only took a minute to fix. Thanks so much, I'll use this as a reference for future stuff :)

     

    Here's the working version:

    SELECT a.location, b.city, b.zipcode, c.name
    FROM ip_group_city a
    LEFT OUTER JOIN locations b ON a.location = b.id
    LEFT OUTER JOIN fips_regions c ON b.region_code = c.code AND b.country_code = c.country_code
    WHERE a.ip_start <= INET_ATON('$ip')
    ORDER BY a.ip_start DESC LIMIT 1
    

     

    thxthxthxthx

  10. $ip = $_GET['ip'];
    $array = array();
    
    $result = mysql_query("SELECT ip_group_city.location
    				  FROM ip_group_city
    				  WHERE ip_start <= INET_ATON('$ip')
    				  ORDER BY ip_start DESC LIMIT 1");
    $row = mysql_fetch_array($result);
    
    $location = $row['location'];
    $result = mysql_query("SELECT *
    				  FROM locations
    				  WHERE locations.id='$location'
    				  LIMIT 1");
    
    $row = mysql_fetch_array($result);
    $array = array_merge($array, array("city" => $row['city']));
    $array = array_merge($array, array("zip" => $row['zipcode']));
    
    $result = mysql_query("SELECT name
    				  FROM fips_regions
    				  WHERE code='".$row['region_code']."'
    				  AND country_code='".$row['country_code']."'
    				  LIMIT 1");
    
    $row = mysql_fetch_array($result);
    
    $array = array_merge($array, array("region" => $row['name']));
    

     

    How can I get this down to 1 or 2 queries? I've tried a bunch of different thing but nothing works -_-

    It's an IP geolocation database that I downloaded btw.

    HALP!

×
×
  • 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.