[Solved] How to prevent users from accessing .pdf files untill they are not being redirect from any page of website by using .htaccess?

Issue resolved. Thanks for your precious time. Here is my code that I’m using in my .htaccess file. RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/ [NC] RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov) [NC] RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC] RewriteRule .*\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov)$ http://example.com/ [NC] Hope now you all understand that what I wanted to do. solved How to prevent users from accessing .pdf … Read more

[Solved] How to hash session IDs for the database?

The PHP function hash_pbkdf2 does not generate it’s own salt nor does it append a salt to the output. string hash_pbkdf2 ( string $algo , string $password , string $salt , int $iterations [, int $length = 0 [, bool $raw_output = false ]] ) The caller controls the output length, salt, iteration count and … Read more

[Solved] Form that logs in to a website?

A lot of websites on the internet (not nearly enough though) have protection in place that prevents sites other then their own to post forms (log in for example) to their site. A site that does not have this protection is vulnerable to: Cross Site Request Forgery (CSRF): http://en.wikipedia.org/wiki/Cross-site_request_forgery This is a major security risk … Read more

[Solved] strpos not finding one word in a string

strpos returns the index of the found string. In this case the index is 0 and your check for == true will fail. Try: strpos($where, $what) !== false The documentation provides more information. solved strpos not finding one word in a string

[Solved] How to echo random text in PHP? [closed]

$lines = array(“one”, “two”, “three”,”four”); for($i =0; i < count($lines)-1;i++){ $line = $lines[rand(0, count($lines)-1)]; $lines = array_diff($lines, array($line));//Use this to remove the index of array } i wrote this in the stack overflow chat so there might be a problem or two. though, all looks well to me. Was this what you were looking for? … Read more

[Solved] Understanding PHP templates [closed]

A template is basically a visual representation of something (like data I.E), can be dynamic or not, the template should hold placeholders that will be replaced with values passed to the template. Usually a template is a skeleton that should serve only as the visual representation (styles, markup). The main purpose of templates is to … Read more

[Solved] Change PHP code to JS

I echo the comment above. I believe StackOverflow is not a code writing service unless something changed very recently. However, let’s look at the code you posted. I think it would help to refactor this code into a more logical sense before attempting this in Javascript. That should make it easier to transpose. Every time … Read more

[Solved] My PHP script fails uploading 50M above images

Please change your php.ini settings . find lines : upload_max_filesize = 100M post_max_size = 100M If you have shared hosting you should tell the administrator yet using cpanel etc , do it from the control panel , Also See here and here And please search before create a new question.Google is your friend. 1 solved … Read more

[Solved] dont show hide post which user had hide that post

Use it this way: SELECT * FROM `user_post` WHERE `id` NOT IN ( SELECT `post_id` FROM `hide_post` WHERE `user_id` = ‘{$userID}’ AND `status` = ‘hide’ ) Here the {$userID} should be the current logged in User’s ID. 7 solved dont show hide post which user had hide that post