Jump to content

adrianTNT

Members
  • Posts

    146
  • Joined

  • Last visited

Posts posted by adrianTNT

  1. Hello.

    When mysql starts on my server (cent OS with plesk) it shows in mysql logs that max_join_size had a bad value and it set it to correct one, this is the bug info: http://bugs.mysql.com/bug.php?id=35346

     

    It says to set the max_join_size value to "4M" but I have no idea what "config file" to edit.

    I tried both these in /etc/my.cnf and rebooted the server:

     

    max_join_size=4M

    set-variable=max_join_size=4M

     

    But the error is still there in logs, (still tries to start with that bad value):

    Am I editing the wrong file or entering the wrong command?

  2. Can someone tell me how to convert this ereg_replace to preg_replace ?

     

    $string = ereg_replace("[^A-Za-z0-9_]", " ", $string);

    It is supposed to only allow letters and numbers.

     

    Then I also need to replace multiple spaces that was like this:

    $string = ereg_replace("( )+", "_", $string);

     

     

     

  3. Hello.

    I want to have a photo album URL that looks like this:

     

    /pictures/christmas-pictures-1020/christmas-lights-234.html

     

    That is album title - album id / photo title - photo id ^.

     

    My current rule:

    RewriteRule ^pictures/(.*)-([0-9]+)/(.*)-([0-9]+).html$ ...

     

    I want to allow special characters in these titles, characters like ţîş that is why the (.*) but I assume this is not right because any_character can also be a slash.

    I tried to replace (.*) with [a-zA-Z] but that one does't include special characters ?!

    What would be the solution? Maybe I can just add a condition where title can be any char but not "/", if this is a good solution then how do I write this "not slash" condition ?

     

    Thank you.

  4. I think the part of that code that saves the actual image file on server is:

     

    imagejpeg($logoImage, "imageWithLogo.jpg", 100);

     

    if you call that in site root it would probably not work, I would try something like this:

     

    imagejpeg($logoImage, "images/imageWithLogo.jpg", 100);

     

    where "images" is a folder that is made writable.

  5. Hello, I have some questions about dates/time ...

     

    I have a site where registered users will receive messages, I want to include the date/time with that message.

    I am not sure what is best way to do this, so I am recording the GMT hours offset from users input (from receivers), but then I saw that the hours offset from the GMT is different in different seasons of the year, so how do I detect correct local time for the message receiver? Is it something like a database with start-end time of daylight savings hour adjustment or how is this done?

  6. I also seen this... I have files as:

    /image_files/120.jpg

    and if I access same path without it's extension it still shows the file.

    That happens with no rewrite rules from my end, I deleted the .htaccess to test this.

     

    Let me know if this indicates any other issue, otherwise I am waiting for GoDaddy's answer and inform them about this other thing if needed. Looks like it is from their configuration, it is not a dedicated server so my access to settings is limited.

  7. Hello, I have a strange problem with mod rewrite, this rewrite rule shows 404 error:

     

    RewriteRule ^admin(/)?$ admin.php

     

    as long as the .php file is named the same. But if I rename existent file on server to something like admins.php and rewrite "admin/" to admins.php then it works ok.

    It looks like I would not be able to rewrite "path/" if path.php exists

     

    I am using a "grid" hosting account from Godaddy. These rules worked fine on some dedicated servers from where I got the site files.

  8. Hello. I was trying to sort values of an array and something is very different from everything I knew so far.

     

    Code is:

    $files_list = array();
    array_push($files_list,"0.jpg");
    array_push($files_list,"3.jpg");
    array_push($files_list,"1.jpg");
    array_push($files_list,"2.jpg");
    
    arsort($files_list);
    
    echo $files_list[0];

     

    I was expecting last line to echo "3.jpg" but it keeps returning "0.jpg"  :o, I tried all kind of sort/arsort, nothing retruns that greatest value, what am I doing wrong?

    I managed to find a solution by end($array_name), but still what was wrong with the above code?  :o

  9. Hello.

     

    I have a domain that I use for domain parking, let's say parking.com, in root of this site I have a folder "domains" and I will keep all content of my parked domains inside this folder: phisical directory structure is:

    parking.com/domains/somesite.com/

    parking.com/domains/someothersite.com/

     

    I am doing this by htaccess so that by accessing some-site.com it will show the content of parking.com/domains/some-site.com

    I have a trailing slash problem with my code:

    If I enter in browser somesite.com/sample/ it works ok but if I enter somesite.com/sample it redirects incorrectly in address bar, it goes to http://somesite.com/domains/somesite.com/sample/ but shows correct content though.

    Is there  a way to maybe redirect somesite.com/sample to somesite.com/sample/ ?

     

    My htaccess, ady advices/fixes are welcome:

     

    RewriteCond %{HTTP_HOST}	!parking.com
    RewriteCond %{HTTP_HOST}	!208.109.209.xx
    RewriteCond $1 !^domains
    
    # with or without www redirect to a  folder without www
    RewriteCond %{HTTP_HOST}	^(www.)?([^.]*)\.(.*)$ [NC]
    RewriteRule ^(.*)$			/domains/%2.%3/$1 [L,QSA]
    
    # redirect to index without any "if file exists" exception, otherwise root "/" exists and directory list will be printed ?!
    RewriteRule ^domains/([^/]*)/$ /domains/?domain=$1
    
    # allow for existent files, redirect otherwise
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^domains/([^/]*)/(.*)$ /domains/?domain=$1&page=$2 [L,QSA]

     

  10. $my_text= '<pre class="brush: plain">
    <div class="header">
    <a href="#">home</a>
    <a href="#">products</a>
    <a href="#">services</a>
    </div>
    </pre>';
    echo preg_replace("~<pre[^>]*>(.*?)</pre>~e", "htmlentities('$1')", $my_text);

    This one returns the string unchanged.

    - Maybe the forum is formating the code differently and I am pasting the wrong thing?

    - Or the intitial text needs to be in double quotes?

    Sorry to bother you, I thought it was easyer.

  11. Hello, I have this text:

     

    $my_text= '<pre class="brush: plain">

    <div class="header">

    <a href="#">home</a>

    <a href="#">products</a>

    <a href="#">services</a>

    </div>

    </pre>';

     

    I need to get all that content inside the "<pre>..</pre>" tag and convert it to htmlentities.

    The "class" is different in more situations so I need to match:

     

    <pre [anything]>[GIVE ME THIS]</pre>

     

    Does that make sense? :)

    Thank you in advance.

  12. Hello, can someone tell me how this should be done? I would like to create a script that can create a thumbnail of a given URL. I have some PHP skills but I think this should involve other applications and I don't know where to start. Probably PHP needs to work with some browser or other programs on server in order to get a browser-like image.

    Any tips? (I use dedicated linux server with GD, etc).

     

    Thank you.

  13. Hello.

    What is the best way to save visitor "hits" into database so that I can then show stats like "hits in month x, hits in month y"?

     

    If I save each visitor hit as a record in a table I think it will increase the database too much.

    Is the best solution to create a record for each month and just increase a value in this record? For example an entrance would be "august 2008" and will increase the field "total hits" for each visitor during August?

     

    Any best practices/ideas/strategies/techniques/ for this?

    Thank you.

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