Sponsored Content
Full Discussion: PHP Redirect Script
Top Forums Shell Programming and Scripting PHP Redirect Script Post 302571723 by galford on Tuesday 8th of November 2011 05:30:14 AM
Old 11-08-2011
PHP Redirect Script

Hello Unix.com,

I badly need to get rid of drones that access my website. I'm using a hits php script that logs every ip that visits my index.php. Looks like this:

PHP Code:
<?php
$IP 
getenv("REMOTE_ADDR");
$day date('l jS \of F Y h:i:s A');
$fout fopen("hits.txt""a");
fputs($fout"$IP");
fclose($fout);
?>
How can I make an addon to act like this: to search the "hits.txt" file and if an ip is in the list for 3 times to redirect him to lets say about:blank or google or any other and the visit "attempt" not to appear in the "hits.txt" log.

Thanks in advance,
Galford. D. Weller
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PHP Redirect

I need a script named index.php . when i goto that page it redirects to html/index.php can someone please tell me the code required (2 Replies)
Discussion started by: perleo
2 Replies

2. Shell Programming and Scripting

How redirect script output from inside of script?

Is it possible to redirect a script output by command inside of that script? I mean, if I have a script 'dosome.sh' I could run it by >dosome.sh > dosome.log I would dream to get some command inside of scrip to do the same; so, running the dosome.sh would have all output redirected to a log... (4 Replies)
Discussion started by: alex_5161
4 Replies

3. Shell Programming and Scripting

Redirect bg process output to within the script

Hi, I have a process running in the background, which throws up some output to the terminal when I run my script. How can I read this output from my script? Thank you. (5 Replies)
Discussion started by: Theju
5 Replies

4. UNIX for Advanced & Expert Users

Redirect ErrorLog to a script

Hello, guys! I need to redirect the error_log of apache web server to a script. I tried to use a pipe instead of a filename but this will cause me some troubles beacause cPanel doesn't like it. So, I would like to try something else. Do you have any ideea on how can I read the content of the... (2 Replies)
Discussion started by: Sergiu-IT
2 Replies

5. Shell Programming and Scripting

Cannot redirect to STDIN in a shell script

I am unable to use STDIn redirection with < (commands) When I do the following, both approaches work and give the same results: 1. $ printf "aaa\nbbb\n" > file1 $ printf "111\n222\n" > file2 $ cat file1 file2 aaa bbb 111 2222. $ cat <(printf "aaa\nbbb\n") <(printf "111\n222\n") aaa... (8 Replies)
Discussion started by: metaltree
8 Replies

6. Web Development

PHP Help - Delete cookies and redirect back to referrer

I was wondering if any one would be willing to help me with this. I'd like to create a 503 error page using a PHP script that will do the following: - delete all cookies that contains 'something' in the host and 'JSESSIONID' as the cookie name. There are either 1 or 2 cookies that each... (0 Replies)
Discussion started by: Adrnalnrsh
0 Replies

7. Shell Programming and Scripting

Redirect the output in shell script for tftp

I've been using tftp in one of my file #!/bin/bash filename1="config1h.txt" filename2="config15.txt" hostname="test.com" tftp $hostname <</dev/null get $filename1 get $filename2 quit EOF My output looks like this # ./test3.sh tftp> Received 1262 bytes in 0.0 seconds tftp> Received... (2 Replies)
Discussion started by: LavanyaP
2 Replies

8. Solaris

Script redirect command output failed, why?

Hi, I put a for loop in a script to eject backup tapes from the robot. The command echo' output goes to the log file without problem, but command vmchange's output does not go to the log file although it's working fine. It still displays on the screen. I've tried '2>&1 1>$log', but nothing changed.... (5 Replies)
Discussion started by: aixlover
5 Replies

9. Shell Programming and Scripting

Need script to compare and redirect

Hi, I have a file, sol_servers_global, which is list of all solaris global servers in my environment and another file, solaris_non_global_zones_from_DB. I have a gateway server, from where all servers are contactable via ssh. I have collected name of zones running on these servers with below... (3 Replies)
Discussion started by: solaris_1977
3 Replies

10. Shell Programming and Scripting

Script to call a menu script and redirect each option to a text file

Hello, I want to design a script that will call an existing menu script and select options one by one and redirict the out put to a file. For example;- In the script MENU.sh there are 10 options i want to design a script MENU2.sh that will select option 2 3 4 6 7 10 and redirict the output... (4 Replies)
Discussion started by: spradha
4 Replies
DL(3)									 1								     DL(3)

dl - Loads a PHP extension at runtime

SYNOPSIS
bool dl (string $library) DESCRIPTION
Loads the PHP extension given by the parameter $library. Use extension_loaded(3) to test whether a given extension is already available or not. This works on both built-in extensions and dynami- cally loaded ones (either through php.ini or dl(3)). Warning This function has been removed from some SAPIs in PHP 5.3. PARAMETERS
o $library - This parameter is only the filename of the extension to load which also depends on your platform. For example, the sockets extension (if compiled as a shared module, not the default!) would be called sockets.so on Unix platforms whereas it is called php_sockets.dll on the Windows platform. The directory where the extension is loaded from depends on your platform: Windows - If not explicitly set in the php.ini, the extension is loaded from C:php4extensions (PHP 4) or C:php5 (PHP 5) by default. Unix - If not explicitly set in the php.ini, the default extension directory depends on o whether PHP has been built with --enable-debug or not o whether PHP has been built with (experimental) ZTS (Zend Thread Safety) support or not o the current internal ZEND_MODULE_API_NO (Zend internal module API number, which is basically the date on which a major module API change hap- pened, e.g. 20010901) Taking into account the above, the directory then defaults to <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or- not>-ZEND_MODULE_API_NO, e.g. /usr/local/php/lib/php/extensions/debug-non-zts-20010901 or /usr/local/php/lib/php/extensions/no- debug-zts-20010901. RETURN VALUES
Returns TRUE on success or FALSE on failure. If the functionality of loading modules is not available or has been disabled (either by set- ting enable_dl off or by enabling safe mode in php.ini) an E_ERROR is emitted and execution is stopped. If dl(3) fails because the speci- fied library couldn't be loaded, in addition to FALSE an E_WARNING message is emitted. EXAMPLES
Example #1 dl(3) examples <?php // Example loading an extension based on OS if (!extension_loaded('sqlite')) { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { dl('php_sqlite.dll'); } else { dl('sqlite.so'); } } // Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0 if (!extension_loaded('sqlite')) { $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX); } ?> CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | dl(3) is now disabled in some SAPIs due to sta- | | | bility issues. The only SAPIs that allow dl(3) | | | are CLI and Embed. Use the Extension Loading | | | Directives instead. | | | | +--------+---------------------------------------------------+ NOTES
Note dl(3) is not supported when PHP is built with ZTS support. Use the Extension Loading Directives instead. Note dl(3) is case sensitive on Unix platforms. Note This function is disabled when PHP is running in safe mode. SEE ALSO
Extension Loading Directives, extension_loaded(3). PHP Documentation Group DL(3)
All times are GMT -4. The time now is 07:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy