adrianTNT
-
Posts
146 -
Joined
-
Last visited
Posts posted by adrianTNT
-
-
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=4Mset-variable=max_join_size=4MBut 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?
-
Thanks, so I tried this, and it seems to do the trick, (if anyone sees a problem please let me know):
$string = preg_replace("/[^A-Za-z0-9_]/", " ",$string);
-
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);
-
I am not sure if there is a better solution but on my server I write another rule with the slash at the end, it works to add it in same rule by writing (/)? at the end, I think it is like this for your rule:
RewriteRule ^.*(/)?$ list.php
Unless others have better ideas
-
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.
-
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.
-
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?
-
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.
-
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.
-
Yes, that was the problem. I have to review so much code now
-
ok, I guess I never noticed the difference between arsort() and rsort()
Now I have to review thousand of code lines that I made so far and used arrays
EDIT:
-
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" , 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?
-
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]
-
Thanks for the help guys, topic solved
-
I'm almost there
preg_replace('~(<pre\b[^>]*>)(.*?)(</pre>)~ise', '\'$1\' . htmlentities(\'$2\') . \'$3\'', $my_text);
Is almost perfect, just that it made html entities of the class="brush: plain" too, how to change that to only start the html entities right after that?
-
After some more tests... I think it has to do with new lines in my string ...
-
$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.
-
ok, and what is the right way to convert the tag contents to html entities, I thought this would work, I was wrong:
$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>", htmlentities("$1"), $my_text);
Warning: Unknown modifier ']'
-
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.
-
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.
-
Thanks for the suggestions, I fully forgot that is a must to save referral URLs too and that has a great impact over how I have to save the data. Thanks again for the suggestions I will think and compare solutions.
-
Yes, that was what I had in mind and wanted to see if there are other better practices than this.
-
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.
-
I think I found it, but if anyone knows a better one please let me know.
preg_match('/^(.*)_(.*).zip/', "animation_3393434349.zip", $matches); $timestamp_from_name = $matches[2]; echo $timestamp_from_name;
Alert: The phpfreaks forum members data appears to have been stolen.
in Announcements
Posted