Hi guys! I'm developed system web autorithation users for acess users to internet with php.
I'm using web serwer nginx, my config
https://openwrt.org/docs/guide-user/services/webserver/nginx
This code my first web page:
<?php
$ip = $_SERVER['REMOTE_ADDR']; //получаем ip пользователя
$lines = file("dhcp.leases");
$found = false;
$table_users = "users";
function input()
{
global $mac;
echo "<center>
<h1>Welcome to WRT-NET</h1>
Для доступа в интернет пройдите авторизацию:<br><br>
<form method='POST' action=auth.php>
Номер телефона:<br>
<input type=text name='tel' value='' size=12><br><br>
<input type=hidden name='mac' value='$mac'>
<input type=submit value='Продолжить'>
</form>
</body>
</html>";
}
function cod()
{
global $mac;
echo"
Введите код:<br><br>
<form method='POST' action=ini.php>
<input type=text name='cod' value='' size=12><br><br>
<input type=hidden name='mac' value='$mac'>
<input type=submit value='Продолжить'>
</form>
</body>
</html>";
}
foreach($lines as $line)//разбивает файл на строки
{
if(strpos($line, $ip) !== false)//ищет соответствие переменной $ip
{
$found = true;
$mac=substr($line, 10, 18); //фильтрует строку.
}
}
//Забирем mac из базы и сравниваем с полученым из файла
$link = new mysqli("192.168.10.229", "smsgw", "123qweasd", users) or die(mysql_error());
$query ="SELECT * FROM users WHERE mac LIKE '%".$mac."%'";
$result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link));
$row = mysqli_fetch_row($result);
if($row['1'] !== $mac)
{
input();
}
else
{
cod() ;
}
mysqli_free_result($result);
?>
I'm building firmware with support php7-mod-mysqli, php7-mod-sockets, php7-sessions, php7-cgi, php7-fastcgi and etc...
my php.ini:
[PHP]
zend.ze1_compatibility_mode = Off
; Language Options
engine = On
;short_open_tag = Off
precision = 12
y2k_compliance = On
output_buffering = Off
;output_handler =
zlib.output_compression = Off
;zlib.output_compression_level = -1
;zlib.output_handler =
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 100
;open_basedir =
disable_functions =
disable_classes =
; Colors for Syntax Highlighting mode. Anything that's acceptable in
; <span style="color: ???????"> would work.
;highlight.string = #DD0000
;highlight.comment = #FF9900
;highlight.keyword = #007700
;highlight.bg = #FFFFFF
;highlight.default = #0000BB
;highlight.html = #000000
;ignore_user_abort = On
;realpath_cache_size = 16k
;realpath_cache_ttl = 120
; Miscellaneous
expose_php = On
; Resource Limits
max_execution_time = 30 ; Maximum execution time of each script, in seconds.
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data.
;max_input_nesting_level = 64
memory_limit = 8M ; Maximum amount of memory a script may consume.
; Error handling and logging
; Error Level Constants:
; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0)
; E_ERROR - fatal run-time errors
; E_RECOVERABLE_ERROR - almost fatal run-time errors
; E_WARNING - run-time warnings (non-fatal errors)
; E_PARSE - compile-time parse errors
; E_NOTICE - run-time notices (these are warnings which often result
; from a bug in your code, but it's possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it's automatically initialized to an
; empty string)
; E_STRICT - run-time notices, enable to have PHP suggest changes
; to your code which will ensure the best interoperability
; and forward compatibility of your code
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
; initial startup
; E_COMPILE_ERROR - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated notice message
; E_DEPRECATED - warn about code that will not work in future versions
; of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
;
; Common Values:
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
display_errors = On
display_startup_errors = Off
log_errors = Off
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
;report_zend_debug = 0
track_errors = Off
;html_errors = Off
;docref_root = "/phpmanual/"
;docref_ext = .html
;error_prepend_string = "<font color=#ff0000>"
;error_append_string = "</font>"
; Log errors to specified file.
;error_log = /var/log/php_errors.log
; Log errors to syslog.
;error_log = syslog
; Data Handling
;arg_separator.output = "&"
;arg_separator.input = ";&"
variables_order = "EGPCS"
request_order = "GP"
register_globals = Off
register_long_arrays = Off
register_argc_argv = On
auto_globals_jit = On
post_max_size = 8M
;magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
;default_charset = "iso-8859-1"
;always_populate_raw_post_data = On
; Paths and Directories
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
doc_root = "/www"
user_dir =
extension_dir = "/usr/lib/php"
enable_dl = On
cgi.force_redirect = 1
;cgi.nph = 1
cgi.redirect_status_env = "yes";
cgi.fix_pathinfo=1
;fastcgi.impersonate = 1;
;fastcgi.logging = 0
;cgi.rfc2616_headers = 0
; File Uploads
file_uploads = On
upload_tmp_dir = "/tmp"
upload_max_filesize = 2M
max_file_uploads = 20
; Fopen wrappers
allow_url_fopen = On
allow_url_include = Off
;from="john@doe.com"
;user_agent="PHP"
default_socket_timeout = 60
;auto_detect_line_endings = Off
my phpifo:
my version OpenWrt 18.06.1 r7258-5eb055306f
error message on web page: **Fatal error** : Uncaught Error: Class 'mysqli' not found in /www/index.php:57 Stack trace: #0 {main} thrown in **/www/index.php** on line **57**
error on run:
root@OpenWrt:/www# php-fcgi
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqlnd.so' (tried: /usr/lib/php/mysqlnd.so (Error relocating /usr/lib/php/mysqlnd.so: PHP_SHA256Init: symbol not found), /usr/lib/php/mysqlnd.so.so (Error loading shared library /usr/lib/php/mysqlnd.so.so: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/pdo_mysql.so (Error relocating /usr/lib/php/pdo_mysql.so: mysqlnd_reverse_api_register_api: symbol not found), /usr/lib/php/pdo_mysql.so.so (Error loading shared library /usr/lib/php/pdo_mysql.so.so: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli.so' (tried: /usr/lib/php/mysqli.so (Error relocating /usr/lib/php/mysqli.so: mysqlnd_reverse_api_register_api: symbol not found), /usr/lib/php/mysqli.so.so (Error loading shared library /usr/lib/php/mysqli.so.so: No such file or directory)) in Unknown on line 0
where i'm erroring? Please help me!!!