Link to home
Start Free TrialLog in
Avatar of Stilmon
Stilmon

asked on

Apache webserver issue

We are having an issue with out apache webserver running under xampp.
i have rebuilt it multiple times (its a vm machine with 6gb ram) server 2008 r2)

then its fine. seems a day or 2 goes by and it gets so slow that i cannot even login with localhost.  here is the log.

Cannot initialize zend_mm storage [win32]
[Thu Nov 07 08:53:44 2013] [notice] Parent: child process exited with status 255 -- Restarting.
[Thu Nov 07 08:53:44 2013] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 07 08:53:44 2013] [notice] Digest: done
[Thu Nov 07 08:53:46 2013] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Thu Nov 07 08:53:46 2013] [notice] Server built: Sep 10 2011 11:34:11
[Thu Nov 07 08:53:46 2013] [notice] Parent: Created child process 8832
[Thu Nov 07 08:53:46 2013] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Nov 07 08:53:46 2013] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 07 08:53:46 2013] [notice] Digest: done
[Thu Nov 07 08:53:47 2013] [notice] Child 8832: Child process is running
[Thu Nov 07 08:53:47 2013] [notice] Child 8832: Acquired the start mutex.
[Thu Nov 07 08:53:47 2013] [notice] Child 8832: Starting 1500 worker threads.
[Thu Nov 07 08:53:47 2013] [notice] Child 8832: Listening on port 443.
[Thu Nov 07 08:53:47 2013] [notice] Child 8832: Listening on port 443.
[Thu Nov 07 08:53:47 2013] [notice] Child 8832: Listening on port 80.
[Thu Nov 07 08:53:47 2013] [notice] Child 8832: Listening on port 80.
Cannot initialize zend_mm storage [win32]
[Thu Nov 07 08:54:39 2013] [notice] Parent: child process exited with status 255 -- Restarting.
[Thu Nov 07 08:54:39 2013] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 07 08:54:39 2013] [notice] Digest: done
[Thu Nov 07 08:54:40 2013] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Thu Nov 07 08:54:40 2013] [notice] Server built: Sep 10 2011 11:34:11
[Thu Nov 07 08:54:40 2013] [notice] Parent: Created child process 8136
[Thu Nov 07 08:54:40 2013] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Nov 07 08:54:41 2013] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 07 08:54:41 2013] [notice] Digest: done
[Thu Nov 07 08:54:42 2013] [notice] Child 8136: Child process is running
[Thu Nov 07 08:54:42 2013] [notice] Child 8136: Acquired the start mutex.
[Thu Nov 07 08:54:42 2013] [notice] Child 8136: Starting 1500 worker threads.
[Thu Nov 07 08:54:42 2013] [notice] Child 8136: Listening on port 443.
[Thu Nov 07 08:54:42 2013] [notice] Child 8136: Listening on port 443.
[Thu Nov 07 08:54:42 2013] [notice] Child 8136: Listening on port 80.
[Thu Nov 07 08:54:42 2013] [notice] Child 8136: Listening on port 80.
Cannot initialize zend_mm storage [win32]
[Thu Nov 07 08:55:47 2013] [notice] Parent: child process exited with status 255 -- Restarting.
[Thu Nov 07 08:55:47 2013] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 07 08:55:47 2013] [notice] Digest: done
[Thu Nov 07 08:55:48 2013] [notice] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Thu Nov 07 08:55:48 2013] [notice] Server built: Sep 10 2011 11:34:11
[Thu Nov 07 08:55:48 2013] [notice] Parent: Created child process 1972
[Thu Nov 07 08:55:48 2013] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Nov 07 08:55:49 2013] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 07 08:55:49 2013] [notice] Digest: done
[Thu Nov 07 08:55:50 2013] [notice] Child 1972: Child process is running
[Thu Nov 07 08:55:50 2013] [notice] Child 1972: Acquired the start mutex.
[Thu Nov 07 08:55:50 2013] [notice] Child 1972: Starting 1500 worker threads.
[Thu Nov 07 08:55:50 2013] [notice] Child 1972: Listening on port 443.
[Thu Nov 07 08:55:50 2013] [notice] Child 1972: Listening on port 443.
[Thu Nov 07 08:55:50 2013] [notice] Child 1972: Listening on port 80.
[Thu Nov 07 08:55:50 2013] [notice] Child 1972: Listening on port 80.
Cannot initialize zend_mm storage [win32]


php log



[07-Nov-2013 15:37:36] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:37:36] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:37:36] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:37:36] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:37:36] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:47:33] PHP Warning:  file_get_contents(C:/xampp/htdocs//data/mac2net/QUM6ODY6NzQ6MEE6Mjg6MDg=.txt) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in C:\xampp\htdocs\wifi-test-getcommand.php on line 9

[07-Nov-2013 15:47:35] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:51:58] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:51:58] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:51:58] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286

[07-Nov-2013 15:54:43] PHP Fatal error:  Out of memory (allocated 1048576) (tried to allocate 1572864 bytes) in C:\xampp\htdocs\checkin-batman.php on line 1286
Avatar of Gary
Gary
Flag of Ireland image

What is the memory_limit in php.ini?
Avatar of Stilmon
Stilmon

ASKER

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 512M

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

seems to ignore it ?  


ini is located in
C:\xampp\php


this is xampp installation also fyi
Have you got a phpinfo file set up? Post the results here
Avatar of Stilmon

ASKER

PHP Version 5.3.8 

System  Windows NT FRESHLOC-CHK 6.1 build 7600 (Windows Server 2008 R2 Standard Edition) i586  
Build Date  Aug 23 2011 11:47:20  
Compiler  MSVC9 (Visual C++ 2008)  
Architecture  x86  
Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--disable-isapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" "--disable-static-analyze"  
Server API  Apache 2.0 Handler  
Virtual Directory Support  enabled  
Configuration File (php.ini) Path  C:\Windows  
Loaded Configuration File  C:\xampp\php\php.ini  
Scan this dir for additional .ini files  (none)  
Additional .ini files parsed  (none)  
PHP API  20090626  
PHP Extension  20090626  
Zend Extension  220090626  
Zend Extension Build  API220090626,TS,VC9  
PHP Extension Build  API20090626,TS,VC9  
Debug Build  no  
Thread Safety  enabled  
Zend Memory Manager  enabled  
Zend Multibyte Support  disabled  
IPv6 Support  enabled  
Registered PHP Streams  php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, phar  
Registered Stream Socket Transports  tcp, udp  
Registered Stream Filters  convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*, bzip2.*  

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
 


--------------------------------------------------------------------------------

PHP Credits

--------------------------------------------------------------------------------

Configuration
apache2handler
Apache Version  Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1  
Apache API Version  20051115  
Server Administrator  postmaster@localhost  
Hostname:Port  localhost:80  
Max Requests  Per Child: 0 - Keep Alive: on - Max Per Connection: 100  
Timeouts  Connection: 300 - Keep-Alive: 5  
Virtual Server  No  
Server Root  C:/xampp/apache  
Loaded Modules  core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_auth_digest mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_log_config mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_setenvif mod_ssl mod_status mod_php5 mod_perl  

Directive Local Value Master Value 
engine 1 1 
last_modified 0 0 
xbithack 0 0 


Apache Environment
Variable Value 
MIBDIRS  C:/xampp/php/extras/mibs  
MYSQL_HOME  \xampp\mysql\bin  
OPENSSL_CONF  C:/xampp/apache/bin/openssl.cnf  
PHP_PEAR_SYSCONF_DIR  \xampp\php  
PHPRC  \xampp\php  
TMP  \xampp\tmp  
HTTP_ACCEPT  image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, */*  
HTTP_REFERER  http://localhost/xampp/navi.php  
HTTP_ACCEPT_LANGUAGE  en-US  
HTTP_USER_AGENT  Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)  
HTTP_ACCEPT_ENCODING  gzip, deflate  
HTTP_HOST  localhost  
HTTP_CONNECTION  Keep-Alive  
PATH  C:\WampDeveloper\Components\Apache\bin;C:\WampDeveloper\Components\Php;C:\WampDeveloper\Components\Mysql\bin;C:\WampDeveloper\Tools\Perl\c\bin;C:\WampDeveloper\Tools\Perl\perl\site\bin;C:\WampDeveloper\Tools\Perl\perl\bin;C:\WampDeveloper\Tools\curl;C:\WampDeveloper\Tools\Expat\Bin;C:\WampDeveloper\Tools\ImageMagick;C:\WampDeveloper\Tools\gnuwin32;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\  
SystemRoot  C:\Windows  
COMSPEC  C:\Windows\system32\cmd.exe  
PATHEXT  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC  
WINDIR  C:\Windows  
SERVER_SIGNATURE  <address>Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 Server at localhost Port 80</address>  
SERVER_SOFTWARE  Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1  
SERVER_NAME  localhost  
SERVER_ADDR  ::1  
SERVER_PORT  80  
REMOTE_ADDR  ::1  
DOCUMENT_ROOT  C:/xampp/htdocs  
SERVER_ADMIN  postmaster@localhost  
SCRIPT_FILENAME  C:/xampp/htdocs/xampp/phpinfo.php  
REMOTE_PORT  58761  
GATEWAY_INTERFACE  CGI/1.1  
SERVER_PROTOCOL  HTTP/1.1  
REQUEST_METHOD  GET  
QUERY_STRING  no value  
REQUEST_URI  /xampp/phpinfo.php  
SCRIPT_NAME  /xampp/phpinfo.php  


HTTP Headers Information
HTTP Request Headers 
HTTP Request  GET /xampp/phpinfo.php HTTP/1.1  
Accept  image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, */*  
Referer  http://localhost/xampp/navi.php  
Accept-Language  en-US  
User-Agent  Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)  
Accept-Encoding  gzip, deflate  
Host  localhost  
Connection  Keep-Alive  
HTTP Response Headers 
X-Powered-By  PHP/5.3.8  
Keep-Alive  timeout=5, max=100  
Connection  Keep-Alive  
Transfer-Encoding  chunked  
Content-Type  text/html  


bcmath
BCMath support  enabled  

Directive Local Value Master Value 
bcmath.scale 0 0 


bz2
BZip2 Support  Enabled  
Stream Wrapper support  compress.bzip2://  
Stream Filter support  bzip2.decompress, bzip2.compress  
BZip2 Version  1.0.6, 6-Sept-2010  


calendar
Calendar support  enabled  


com_dotnet
COM support enabled 
DCOM support disabled 
.Net support enabled 

Directive Local Value Master Value 
com.allow_dcom 0 0 
com.autoregister_casesensitive 1 1 
com.autoregister_typelib 0 0 
com.autoregister_verbose 0 0 
com.code_page no value no value 
com.typelib_file no value no value 


Core
PHP Version  5.3.8  

Directive Local Value Master Value 
allow_call_time_pass_reference Off Off 
allow_url_fopen On On 
allow_url_include Off Off 
always_populate_raw_post_data Off Off 
arg_separator.input & & 
arg_separator.output & & 
asp_tags Off Off 
auto_append_file no value no value 
auto_globals_jit On On 
auto_prepend_file no value no value 
browscap C:\xampp\php\extras\browscap.ini C:\xampp\php\extras\browscap.ini 
default_charset no value no value 
default_mimetype text/html text/html 
define_syslog_variables Off Off 
disable_classes no value no value 
disable_functions no value no value 
display_errors On On 
display_startup_errors On On 
doc_root no value no value 
docref_ext no value no value 
docref_root no value no value 
enable_dl On On 
error_append_string no value no value 
error_log C:\xampp\php\logs\php_error_log C:\xampp\php\logs\php_error_log 
error_prepend_string no value no value 
error_reporting 22519 22519 
exit_on_timeout Off Off 
expose_php On On 
extension_dir C:\xampp\php\ext C:\xampp\php\ext 
file_uploads On On 
highlight.bg #FFFFFF #FFFFFF 
highlight.comment #FF8000 #FF8000 
highlight.default #0000BB #0000BB 
highlight.html #000000 #000000 
highlight.keyword #007700 #007700 
highlight.string #DD0000 #DD0000 
html_errors On On 
ignore_repeated_errors Off Off 
ignore_repeated_source Off Off 
ignore_user_abort Off Off 
implicit_flush Off Off 
include_path .;C:\xampp\php\PEAR .;C:\xampp\php\PEAR 
log_errors On On 
log_errors_max_len 1024 1024 
magic_quotes_gpc Off Off 
magic_quotes_runtime Off Off 
magic_quotes_sybase Off Off 
mail.add_x_header Off Off 
mail.force_extra_parameters no value no value 
mail.log no value no value 
max_execution_time 30 30 
max_file_uploads 20 20 
max_input_nesting_level 64 64 
max_input_time 60 60 
memory_limit -1 -1 
open_basedir no value no value 
output_buffering 4096 4096 
output_handler no value no value 
post_max_size 8M 8M 
precision 14 14 
realpath_cache_size 16K 16K 
realpath_cache_ttl 120 120 
register_argc_argv Off Off 
register_globals Off Off 
register_long_arrays Off Off 
report_memleaks On On 
report_zend_debug On On 
request_order GP GP 
safe_mode Off Off 
safe_mode_exec_dir no value no value 
safe_mode_gid Off Off 
safe_mode_include_dir no value no value 
sendmail_from no value no value 
sendmail_path no value no value 
serialize_precision 100 100 
short_open_tag On On 
SMTP localhost localhost 
smtp_port 25 25 
sql.safe_mode Off Off 
track_errors On On 
unserialize_callback_func no value no value 
upload_max_filesize 128M 128M 
upload_tmp_dir C:\xampp\tmp C:\xampp\tmp 
user_dir no value no value 
user_ini.cache_ttl 300 300 
user_ini.filename .user.ini .user.ini 
variables_order GPCS GPCS 
xmlrpc_error_number 0 0 
xmlrpc_errors Off Off 
y2k_compliance On On 
zend.enable_gc On On 


ctype
ctype functions  enabled  


curl
cURL support  enabled  
cURL Information  7.21.7  
Age  3  
Features  
AsynchDNS  Yes  
Debug  No  
GSS-Negotiate  Yes  
IDN  No  
IPv6  Yes  
Largefile  Yes  
NTLM  Yes  
SPNEGO  No  
SSL  Yes  
SSPI  Yes  
krb4  No  
libz  Yes  
CharConv  No  
Protocols  dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp  
Host  i386-pc-win32  
SSL Version  OpenSSL/1.0.0e  
ZLib Version  1.2.5  
libSSH Version  libssh2/1.2.7  


date
date/time support  enabled  
"Olson" Timezone Database Version  2011.8  
Timezone Database  internal  
Default timezone  Europe/Berlin  

Directive Local Value Master Value 
date.default_latitude 31.7667 31.7667 
date.default_longitude 35.2333 35.2333 
date.sunrise_zenith 90.583333 90.583333 
date.sunset_zenith 90.583333 90.583333 
date.timezone Europe/Berlin Europe/Berlin 


dom
DOM/XML  enabled  
DOM/XML API Version  20031129  
libxml Version  2.7.7  
HTML Support  enabled  
XPath Support  enabled  
XPointer Support  enabled  
Schema Support  enabled  
RelaxNG Support  enabled  


ereg
Regex Library  Bundled library enabled  


exif
EXIF Support  enabled  
EXIF Version  1.4 $Id: exif.c 314376 2011-08-06 14:47:44Z felipe $  
Supported EXIF Version  0220  
Supported filetypes  JPEG,TIFF  

Directive Local Value Master Value 
exif.decode_jis_intel JIS JIS 
exif.decode_jis_motorola JIS JIS 
exif.decode_unicode_intel UCS-2LE UCS-2LE 
exif.decode_unicode_motorola UCS-2BE UCS-2BE 
exif.encode_jis no value no value 
exif.encode_unicode ISO-8859-15 ISO-8859-15 


filter
Input Validation and Filtering  enabled  
Revision  $Revision: 313665 $  

Directive Local Value Master Value 
filter.default unsafe_raw unsafe_raw 
filter.default_flags no value no value 


ftp
FTP support  enabled  


gd
GD Support  enabled  
GD Version  bundled (2.0.34 compatible)  
FreeType Support  enabled  
FreeType Linkage  with freetype  
FreeType Version  2.4.3  
GIF Read Support  enabled  
GIF Create Support  enabled  
JPEG Support  enabled  
libJPEG Version  6b  
PNG Support  enabled  
libPNG Version  1.2.46  
WBMP Support  enabled  
XBM Support  enabled  

Directive Local Value Master Value 
gd.jpeg_ignore_warning 0 0 


gettext
GetText Support  enabled  


hash
hash support  enabled  
Hashing Engines  md2 md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru snefru256 gost adler32 crc32 crc32b salsa10 salsa20 haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5  


iconv
iconv support  enabled  
iconv implementation  "libiconv"  
iconv library version  1.11  

Directive Local Value Master Value 
iconv.input_encoding ISO-8859-1 ISO-8859-1 
iconv.internal_encoding ISO-8859-1 ISO-8859-1 
iconv.output_encoding ISO-8859-1 ISO-8859-1 


imap
IMAP c-Client Version  2007e  
SSL Support  enabled  


json
json support  enabled  
json version  1.2.1  


libxml
libXML support  active  
libXML Compiled Version  2.7.7  
libXML Loaded Version  20707  
libXML streams  enabled  


mbstring
Multibyte Support  enabled  
Multibyte string engine  libmbfl  
HTTP input encoding translation  disabled  

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1. 

Multibyte (japanese) regex support  enabled  
Multibyte regex (oniguruma) version  4.7.1  

Directive Local Value Master Value 
mbstring.detect_order no value no value 
mbstring.encoding_translation Off Off 
mbstring.func_overload 0 0 
mbstring.http_input pass pass 
mbstring.http_output pass pass 
mbstring.http_output_conv_mimetypes ^(text/|application/xhtml\+xml) ^(text/|application/xhtml\+xml) 
mbstring.internal_encoding no value no value 
mbstring.language neutral neutral 
mbstring.strict_detection Off Off 
mbstring.substitute_character no value no value 


mcrypt
mcrypt support enabled 
mcrypt_filter support enabled 
Version  2.5.8  
Api No  20021217  
Supported ciphers  cast-128 gost rijndael-128 twofish cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes arcfour  
Supported modes  cbc cfb ctr ecb ncfb nofb ofb stream  

Directive Local Value Master Value 
mcrypt.algorithms_dir no value no value 
mcrypt.modes_dir no value no value 


mhash
MHASH support  Enabled  
MHASH API Version  Emulated Support  


mysql
MySQL Support enabled 
Active Persistent Links  0  
Active Links  0  
Client API version  mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $  

Directive Local Value Master Value 
mysql.allow_local_infile On On 
mysql.allow_persistent On On 
mysql.connect_timeout 3 3 
mysql.default_host no value no value 
mysql.default_password no value no value 
mysql.default_port 3306 3306 
mysql.default_socket MySQL MySQL 
mysql.default_user no value no value 
mysql.max_links Unlimited Unlimited 
mysql.max_persistent Unlimited Unlimited 
mysql.trace_mode Off Off 


mysqli
MysqlI Support enabled 
Client API library version  mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $  
Active Persistent Links  0  
Inactive Persistent Links  0  
Active Links  0  

Directive Local Value Master Value 
mysqli.allow_local_infile On On 
mysqli.allow_persistent On On 
mysqli.default_host no value no value 
mysqli.default_port 3306 3306 
mysqli.default_pw no value no value 
mysqli.default_socket MySQL MySQL 
mysqli.default_user no value no value 
mysqli.max_links Unlimited Unlimited 
mysqli.max_persistent Unlimited Unlimited 
mysqli.reconnect Off Off 


mysqlnd
mysqlnd enabled 
Version  mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $  
Compression  supported  
SSL  supported  
Command buffer size  4096  
Read buffer size  32768  
Read timeout  31536000  
Collecting statistics  Yes  
Collecting memory statistics  No  
Tracing  n/a  

Client statistics  
bytes_sent  0  
bytes_received  0  
packets_sent  0  
packets_received  0  
protocol_overhead_in  0  
protocol_overhead_out  0  
bytes_received_ok_packet  0  
bytes_received_eof_packet  0  
bytes_received_rset_header_packet  0  
bytes_received_rset_field_meta_packet  0  
bytes_received_rset_row_packet  0  
bytes_received_prepare_response_packet  0  
bytes_received_change_user_packet  0  
packets_sent_command  0  
packets_received_ok  0  
packets_received_eof  0  
packets_received_rset_header  0  
packets_received_rset_field_meta  0  
packets_received_rset_row  0  
packets_received_prepare_response  0  
packets_received_change_user  0  
result_set_queries  0  
non_result_set_queries  0  
no_index_used  0  
bad_index_used  0  
slow_queries  0  
buffered_sets  0  
unbuffered_sets  0  
ps_buffered_sets  0  
ps_unbuffered_sets  0  
flushed_normal_sets  0  
flushed_ps_sets  0  
ps_prepared_never_executed  0  
ps_prepared_once_executed  0  
rows_fetched_from_server_normal  0  
rows_fetched_from_server_ps  0  
rows_buffered_from_client_normal  0  
rows_buffered_from_client_ps  0  
rows_fetched_from_client_normal_buffered  0  
rows_fetched_from_client_normal_unbuffered  0  
rows_fetched_from_client_ps_buffered  0  
rows_fetched_from_client_ps_unbuffered  0  
rows_fetched_from_client_ps_cursor  0  
rows_affected_normal  0  
rows_affected_ps  0  
rows_skipped_normal  0  
rows_skipped_ps  0  
copy_on_write_saved  0  
copy_on_write_performed  0  
command_buffer_too_small  0  
connect_success  0  
connect_failure  0  
connection_reused  0  
reconnect  0  
pconnect_success  0  
active_connections  0  
active_persistent_connections  0  
explicit_close  0  
implicit_close  0  
disconnect_close  0  
in_middle_of_command_close  0  
explicit_free_result  0  
implicit_free_result  0  
explicit_stmt_close  0  
implicit_stmt_close  0  
mem_emalloc_count  0  
mem_emalloc_amount  0  
mem_ecalloc_count  0  
mem_ecalloc_amount  0  
mem_erealloc_count  0  
mem_erealloc_amount  0  
mem_efree_count  0  
mem_efree_amount  0  
mem_malloc_count  0  
mem_malloc_amount  0  
mem_calloc_count  0  
mem_calloc_amount  0  
mem_realloc_count  0  
mem_realloc_amount  0  
mem_free_count  0  
mem_free_amount  0  
mem_estrndup_count  0  
mem_strndup_count  0  
mem_estndup_count  0  
mem_strdup_count  0  
proto_text_fetched_null  0  
proto_text_fetched_bit  0  
proto_text_fetched_tinyint  0  
proto_text_fetched_short  0  
proto_text_fetched_int24  0  
proto_text_fetched_int  0  
proto_text_fetched_bigint  0  
proto_text_fetched_decimal  0  
proto_text_fetched_float  0  
proto_text_fetched_double  0  
proto_text_fetched_date  0  
proto_text_fetched_year  0  
proto_text_fetched_time  0  
proto_text_fetched_datetime  0  
proto_text_fetched_timestamp  0  
proto_text_fetched_string  0  
proto_text_fetched_blob  0  
proto_text_fetched_enum  0  
proto_text_fetched_set  0  
proto_text_fetched_geometry  0  
proto_text_fetched_other  0  
proto_binary_fetched_null  0  
proto_binary_fetched_bit  0  
proto_binary_fetched_tinyint  0  
proto_binary_fetched_short  0  
proto_binary_fetched_int24  0  
proto_binary_fetched_int  0  
proto_binary_fetched_bigint  0  
proto_binary_fetched_decimal  0  
proto_binary_fetched_float  0  
proto_binary_fetched_double  0  
proto_binary_fetched_date  0  
proto_binary_fetched_year  0  
proto_binary_fetched_time  0  
proto_binary_fetched_datetime  0  
proto_binary_fetched_timestamp  0  
proto_binary_fetched_string  0  
proto_binary_fetched_blob  0  
proto_binary_fetched_enum  0  
proto_binary_fetched_set  0  
proto_binary_fetched_geometry  0  
proto_binary_fetched_other  0  
init_command_executed_count  0  
init_command_failed_count  0  
com_quit  0  
com_init_db  0  
com_query  0  
com_field_list  0  
com_create_db  0  
com_drop_db  0  
com_refresh  0  
com_shutdown  0  
com_statistics  0  
com_process_info  0  
com_connect  0  
com_process_kill  0  
com_debug  0  
com_ping  0  
com_time  0  
com_delayed_insert  0  
com_change_user  0  
com_binlog_dump  0  
com_table_dump  0  
com_connect_out  0  
com_register_slave  0  
com_stmt_prepare  0  
com_stmt_execute  0  
com_stmt_send_long_data  0  
com_stmt_close  0  
com_stmt_reset  0  
com_stmt_set_option  0  
com_stmt_fetch  0  
com_deamon  0  
bytes_received_real_data_normal  0  
bytes_received_real_data_ps  0  


odbc
ODBC Support enabled 
Active Persistent Links  0  
Active Links  0  
ODBC library  Win32  

Directive Local Value Master Value 
odbc.allow_persistent On On 
odbc.check_persistent On On 
odbc.default_cursortype Static cursor Static cursor 
odbc.default_db no value no value 
odbc.default_pw no value no value 
odbc.default_user no value no value 
odbc.defaultbinmode return as is return as is 
odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes 
odbc.max_links Unlimited Unlimited 
odbc.max_persistent Unlimited Unlimited 


pcre
PCRE (Perl Compatible Regular Expressions) Support  enabled  
PCRE Library Version  8.12 2011-01-15  

Directive Local Value Master Value 
pcre.backtrack_limit 1000000 1000000 
pcre.recursion_limit 100000 100000 


PDO
PDO support enabled 
PDO drivers  mysql, odbc, sqlite, sqlite2  


pdo_mysql
PDO Driver for MySQL enabled 
Client API version  mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $  


PDO_ODBC
PDO Driver for ODBC (Win32) enabled 
ODBC Connection Pooling  Enabled, strict matching  


pdo_sqlite
PDO Driver for SQLite 3.x enabled 
SQLite Library  3.7.7.1  


Phar
Phar: PHP Archive support enabled 
Phar EXT version  2.0.1  
Phar API version  1.1.1  
SVN revision  $Revision: 314419 $  
Phar-based phar archives  enabled  
Tar-based phar archives  enabled  
ZIP-based phar archives  enabled  
gzip compression  enabled  
bzip2 compression  enabled  
OpenSSL support  disabled (install ext/openssl)  

Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle. 

Directive Local Value Master Value 
phar.cache_list no value no value 
phar.readonly On On 
phar.require_hash On On 


Reflection
Reflection enabled 
Version  $Revision: 313665 $  


session
Session Support  enabled  
Registered save handlers  files user sqlite  
Registered serializer handlers  php php_binary wddx  

Directive Local Value Master Value 
session.auto_start Off Off 
session.bug_compat_42 On On 
session.bug_compat_warn On On 
session.cache_expire 180 180 
session.cache_limiter nocache nocache 
session.cookie_domain no value no value 
session.cookie_httponly Off Off 
session.cookie_lifetime 0 0 
session.cookie_path / / 
session.cookie_secure Off Off 
session.entropy_file no value no value 
session.entropy_length 0 0 
session.gc_divisor 100 100 
session.gc_maxlifetime 86400 86400 
session.gc_probability 1 1 
session.hash_bits_per_character 5 5 
session.hash_function 0 0 
session.name PHPSESSID PHPSESSID 
session.referer_check no value no value 
session.save_handler files files 
session.save_path C:\xampp\tmp C:\xampp\tmp 
session.serialize_handler php php 
session.use_cookies On On 
session.use_only_cookies Off Off 
session.use_trans_sid 0 0 


SimpleXML
Simplexml support enabled 
Revision  $Revision: 314376 $  
Schema support  enabled  


soap
Soap Client  enabled  
Soap Server  enabled  

Directive Local Value Master Value 
soap.wsdl_cache 1 1 
soap.wsdl_cache_dir /tmp /tmp 
soap.wsdl_cache_enabled 1 1 
soap.wsdl_cache_limit 5 5 
soap.wsdl_cache_ttl 86400 86400 


sockets
Sockets Support  enabled  


SPL
SPL support enabled 
Interfaces  Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject  
Classes  AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException  


SQLite
SQLite support enabled 
PECL Module version  2.0-dev $Id: sqlite.c 306939 2011-01-01 02:19:59Z felipe $  
SQLite Library  2.8.17  
SQLite Encoding  iso8859  

Directive Local Value Master Value 
sqlite.assoc_case 0 0 


sqlite3
SQLite3 support enabled 
SQLite3 module version  0.7-dev  
SQLite Library  3.7.7.1  

Directive Local Value Master Value 
sqlite3.extension_dir no value no value 


standard
Dynamic Library Support  enabled  
Internal Sendmail Support for Windows  enabled  

Directive Local Value Master Value 
assert.active 1 1 
assert.bail 0 0 
assert.callback no value no value 
assert.quiet_eval 0 0 
assert.warning 1 1 
auto_detect_line_endings 0 0 
default_socket_timeout 60 60 
from no value no value 
safe_mode_allowed_env_vars PHP_ PHP_ 
safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH 
url_rewriter.tags a=href,area=href,frame=src,input=src,form=,fieldset= a=href,area=href,frame=src,input=src,form=,fieldset= 
user_agent no value no value 


tokenizer
Tokenizer Support  enabled  


wddx
WDDX Support enabled 
WDDX Session Serializer  enabled  


xml
XML Support  active  
XML Namespace Support  active  
libxml2 Version  2.7.7  


xmlreader
XMLReader  enabled  


xmlrpc
core library version  xmlrpc-epi v. 0.51  
php extension version  0.51  
author  Dan Libby  
homepage  http://xmlrpc-epi.sourceforge.net  
open sourced by  Epinions.com  


xmlwriter
XMLWriter  enabled  


zip
Zip  enabled  
Extension Version  $Id: php_zip.c 313665 2011-07-25 11:42:53Z felipe $  
Zip version  1.9.1  
Libzip version  0.9.0  


zlib
ZLib Support  enabled  
Stream Wrapper support  compress.zlib://  
Stream Filter support  zlib.inflate, zlib.deflate  
Compiled Version  1.2.5  
Linked Version  1.2.5  

Directive Local Value Master Value 
zlib.output_compression Off Off 
zlib.output_compression_level -1 -1 
zlib.output_handler no value no value 


Additional Modules
Module Name 


Environment
Variable Value 
ALLUSERSPROFILE  C:\ProgramData  
APPDATA  C:\Users\administrator.FRESHLOCCOLO\AppData\Roaming  
CLIENTNAME  FLSP01  
CommonProgramFiles  C:\Program Files (x86)\Common Files  
CommonProgramFiles(x86)  C:\Program Files (x86)\Common Files  
CommonProgramW6432  C:\Program Files\Common Files  
COMPUTERNAME  FRESHLOC-CHK  
ComSpec  C:\Windows\system32\cmd.exe  
FP_NO_HOST_CHECK  NO  
HOMEDRIVE  C:  
HOMEPATH  \Users\administrator.FRESHLOCCOLO  
LOCALAPPDATA  C:\Users\administrator.FRESHLOCCOLO\AppData\Local  
LOGONSERVER  \\FRESHLOC-DASH  
MAGICK_HOME  C:\WampDeveloper\Tools\ImageMagick  
NUMBER_OF_PROCESSORS  16  
OPENSSL_CONF  C:\WampDeveloper\Components\Apache\bin\openssl.cnf  
OS  Windows_NT  
Path  C:\WampDeveloper\Components\Apache\bin;C:\WampDeveloper\Components\Php;C:\WampDeveloper\Components\Mysql\bin;C:\WampDeveloper\Tools\Perl\c\bin;C:\WampDeveloper\Tools\Perl\perl\site\bin;C:\WampDeveloper\Tools\Perl\perl\bin;C:\WampDeveloper\Tools\curl;C:\WampDeveloper\Tools\Expat\Bin;C:\WampDeveloper\Tools\ImageMagick;C:\WampDeveloper\Tools\gnuwin32;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\  
PATHEXT  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC  
PROCESSOR_ARCHITECTURE  x86  
PROCESSOR_ARCHITEW6432  AMD64  
PROCESSOR_IDENTIFIER  Intel64 Family 6 Model 44 Stepping 2, GenuineIntel  
PROCESSOR_LEVEL  6  
PROCESSOR_REVISION  2c02  
ProgramData  C:\ProgramData  
ProgramFiles  C:\Program Files (x86)  
ProgramFiles(x86)  C:\Program Files (x86)  
ProgramW6432  C:\Program Files  
PSModulePath  C:\Windows\system32\WindowsPowerShell\v1.0\Modules\  
PUBLIC  C:\Users\Public  
SESSIONNAME  RDP-Tcp#0  
SystemDrive  C:  
SystemRoot  C:\Windows  
TEMP  C:\Users\ADMINI~1.FRE\AppData\Local\Temp\2  
TMP  C:\Users\ADMINI~1.FRE\AppData\Local\Temp\2  
USERDNSDOMAIN  FRESHLOCCOLO.COM  
USERDOMAIN  FRESHLOCCOLO  
USERNAME  administrator  
USERPROFILE  C:\Users\administrator.FRESHLOCCOLO  
wampdev  C:\WampDeveloper\Components\Apache\bin;C:\WampDeveloper\Components\Php;C:\WampDeveloper\Components\Mysql\bin;C:\WampDeveloper\Tools\Perl\c\bin;C:\WampDeveloper\Tools\Perl\perl\site\bin;C:\WampDeveloper\Tools\Perl\perl\bin;C:\WampDeveloper\Tools\curl;C:\WampDeveloper\Tools\Expat\Bin;C:\WampDeveloper\Tools\ImageMagick;C:\WampDeveloper\Tools\gnuwin32  
windir  C:\Windows  
AP_PARENT_PID  8936  


PHP Variables
Variable Value 
_SERVER["MIBDIRS"] C:/xampp/php/extras/mibs 
_SERVER["MYSQL_HOME"] \xampp\mysql\bin 
_SERVER["OPENSSL_CONF"] C:/xampp/apache/bin/openssl.cnf 
_SERVER["PHP_PEAR_SYSCONF_DIR"] \xampp\php 
_SERVER["PHPRC"] \xampp\php 
_SERVER["TMP"] \xampp\tmp 
_SERVER["HTTP_ACCEPT"] image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, */* 
_SERVER["HTTP_REFERER"] http://localhost/xampp/navi.php 
_SERVER["HTTP_ACCEPT_LANGUAGE"] en-US 
_SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729) 
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate 
_SERVER["HTTP_HOST"] localhost 
_SERVER["HTTP_CONNECTION"] Keep-Alive 
_SERVER["PATH"] C:\WampDeveloper\Components\Apache\bin;C:\WampDeveloper\Components\Php;C:\WampDeveloper\Components\Mysql\bin;C:\WampDeveloper\Tools\Perl\c\bin;C:\WampDeveloper\Tools\Perl\perl\site\bin;C:\WampDeveloper\Tools\Perl\perl\bin;C:\WampDeveloper\Tools\curl;C:\WampDeveloper\Tools\Expat\Bin;C:\WampDeveloper\Tools\ImageMagick;C:\WampDeveloper\Tools\gnuwin32;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\ 
_SERVER["SystemRoot"] C:\Windows 
_SERVER["COMSPEC"] C:\Windows\system32\cmd.exe 
_SERVER["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC 
_SERVER["WINDIR"] C:\Windows 
_SERVER["SERVER_SIGNATURE"] <address>Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 Server at localhost Port 80</address>  
_SERVER["SERVER_SOFTWARE"] Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 
_SERVER["SERVER_NAME"] localhost 
_SERVER["SERVER_ADDR"] ::1 
_SERVER["SERVER_PORT"] 80 
_SERVER["REMOTE_ADDR"] ::1 
_SERVER["DOCUMENT_ROOT"] C:/xampp/htdocs 
_SERVER["SERVER_ADMIN"] postmaster@localhost 
_SERVER["SCRIPT_FILENAME"] C:/xampp/htdocs/xampp/phpinfo.php 
_SERVER["REMOTE_PORT"] 58761 
_SERVER["GATEWAY_INTERFACE"] CGI/1.1 
_SERVER["SERVER_PROTOCOL"] HTTP/1.1 
_SERVER["REQUEST_METHOD"] GET 
_SERVER["QUERY_STRING"] no value 
_SERVER["REQUEST_URI"] /xampp/phpinfo.php 
_SERVER["SCRIPT_NAME"] /xampp/phpinfo.php 
_SERVER["PHP_SELF"] /xampp/phpinfo.php 
_SERVER["REQUEST_TIME"] 1383840009 


PHP License
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE 

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.

Open in new window

Your memory is set to unlimited (-1) not 512 so you were looking at the wrong php.ini

What is the checkin-batman.php file doing? Can you paste the contents.
Avatar of Stilmon

ASKER

I have just set it to -1 to see if that helped but just now put back to 512.



*/

require("functions.php");
if($_POST['hw'] == "OM2P")
{
	$postdata = file_get_contents("php://input");
	//echo "postdata is".$postdata."\n";

	/* Server settings.php file running */
	if(file_exists("settings.php")) {require("settings.php");}
	else {die("# We need to setup the server first");}
	/* Find Netowrk name */
	/*if(file_exists($dir . "data/mac2net/" . base64_encode($_POST['mac']) . ".txt")) {$networkname = file_get_contents($dir . "data/mac2net/" . base64_encode($_POST['mac']) . ".txt");}
else {echo "unable to get the network name"; exit;}*/

	/* Replace the root directory */
	$wdir = str_replace($_SERVER['DOCUMENT_ROOT'], "", $dir);

	/* mac2net node file name variable to find the network name */
	//echo "directory:".$dir."\n";
	$netfpath = $dir . 'data/mac2net/' . base64_encode($_POST['mac']) . '.txt';
	//echo $netfpath."\n";

	/* Get the network name for node */
	if(file_exists($netfpath)) {$networkname = file_get_contents($netfpath);}//echo "network name:". $networkname."\n";}
	else 
    {
        /*echo "file".base64_encode($_POST['mac']). "do not exist\n";exit;*/
        echo "file".base64_encode($_POST['mac']). "do not exist\n";
        $readerid=$_POST['readerid'];
		$mac_tmp=$_POST['mac'];
		if(empty($readerid) && $readerid == ""){ $log_content .= $time. " Reader 'NO-ID' does not belong to any network - No record found from database -Mac-".$mac_tmp."\n";}
        
        $fid=file_get_contents("http://www.freshloc.net/liveclientlist.asp?sep=|&Reader=$readerid&MAC=$mac_tmp");
        if($fid)
        {
            $response=explode("|",$fid);
			//print_r($response);
            $respcount = count($response);
            //echo "Response count $respcount\n";
				//if(!empty($response[1]) && $response[1] != "0")
				if(!empty($response[1]))
				{
					if($respcount > 10)
					{
						if(is_null($response[11]) == TRUE)
						{
							$log_content .= $time." ".$readerid . " has no record on database - Mac-".$mac_tmp."\n"; 
						}
						else
						{	
                            $rsp11 = intval($response[11]);
							//if(is_numeric($response[11]) == TRUE)
							if(is_int($rsp11) == TRUE)
							{
									$networkname=get_network_name($dir, $response[11]);
                                    echo "$networkname\n";
									if($networkname)
									{
										add_node($dir, $networkname, $response[6], $mac_tmp, $response[7]);
										
										if($response[8] =="PD")
										{
											$fp_pd_type = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readertype.txt", 'w');
											fwrite($fp_pd_type, $response[8]);
											fclose($fp_pd_type);
										
											$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readerid.txt", 'w');
											fwrite($fp_pd, $response[5]);
											fclose($fp_pd);
										
											$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".clientid.txt", 'w');
											fwrite($fp_pd, $response[11]);
											fclose($fp_pd);
											$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".itemid1.txt", 'w');
											fwrite($fp_pd, $response[14]);
											fclose($fp_pd);
										
											$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".itemid2.txt", 'w');
											fwrite($fp_pd, $response[16]);
											fclose($fp_pd);
										}
									}
									else
									{
										$username=$response[12].$response[11];
										$retval=create_user($username, $response[11]);
										echo "Return value $retval";
										if($retval == 0)
										{
											//sleep(10);
											$networkname=get_network_name($dir, $retval[11]);
											if($networkname)
											{
												add_node($dir, $networkname, $response[6], $mac_tmp, $response[7]);
												if($response[8] =="PD")
												{
													$fp_pd_type = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readertype.txt", 'w');
													fwrite($fp_pd_type, $response[8]);
													fclose($fp_pd_type);			
													
													$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readerid.txt", 'w');		
													fwrite($fp_pd, $response[5]);
													fclose($fp_pd);
													
													$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".clientid.txt", 'w');
													fwrite($fp_pd, $response[11]);
													fclose($fp_pd);
													
													$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".itemid1.txt", 'w');
													fwrite($fp_pd, $response[14]);
													fclose($fp_pd);
													
													$fp_pd = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".itemid2.txt", 'w');
													fwrite($fp_pd, $response[16]);
													fclose($fp_pd);
												}
											}
										}
									}
								}
							}		
						}
					}

                    if($respcount < 11)
                    {
                        //echo "Processing else Mesh reader part\n";
                        if(is_null($response[7]) == TRUE)
						{
							$log_content .= $time." ".$readerid . " has no record on database - Mac-".$mac_tmp."\n"; 
						}
                        else
                        {
							if(is_numeric($response[7]) == TRUE  )
							{
                                $networkname=get_network_name($dir, $response[7]);
                                if($networkname){
                                    add_node($dir, $networkname, $response[5], $mac_tmp, $response[6]);
								}
                                else
                                {
                                    $username=$response[8].$response[7];
                                    $retval=create_user($username, $response[7]);
                                    if($retval == 0)
                                    {
                                        $networkname=get_network_name($dir, $retval[7]);
                                        if($networkname){
                                            add_node($dir, $networkname, $response[5], $mac_tmp, $response[6]);
										}
                                    }
                                }
                            }
                        }
                    }
				}
				else
				{
					$log_content .= $time." Reader ".$readerid ." does not belong to any network - No record found from database -Mac-".$mac_tmp."\n"; 
				}
        }
		
	
		
	// BOF Time for deshbord log
	$xmlp_time = simplexml_load_file($dir."data/uploads/".$networkname ."/".$networkname.".xml");
	//setTimezoneByOffset($xmlp_time->management->enable_gmt_offset);
	
	//BOF DST time +1hrs
	if($xmlp_time->management->enable_dst == "1"){$dst = 3;}else{$dst = 2;}
	//EOF DST time +1hrs
	$zone = 3600*($xmlp_time->management->enable_gmt_offset + $dst);
	$now = time();
	$time= gmdate('M d H:i:s', $now + $zone);
	$time = strtotime($time);
	$time_datetxt = gmdate('dmyiHa', $time); 
	$time = gmdate('M d H:i:s', $time); 
	
	if(is_dir($dir."data/log") == FALSE)
	{
		if(mkdir($dir."data/log") == TRUE)
		{
			$logp = fopen($dir. "data/log/dashboardlog.txt", "w");
			fclose($logp); 
		}
	}
	$log_content = "";
	$log_content = $time ." Received checkin from Reader " .$_POST['readerid']." - MAC- ".$_POST['mac']." \n";
	//$log_content .= $time ." Received checkin time " .date('dmy-H-ia')." - MAC- ".$_POST['mac']."\n";
	//$log_content .= $time ." Received checkin time " .$time_datetxt." - MAC- ".$_POST['mac']."\n";
	
	// BOF check wfi node file is exist in php if not exitst then add wifi node
if(file_exists($dir . "data/uploads/" .$networkname . "/" . $networkname . "_wifi_nodes.xml")){
	
	//BOF Modification wifi file exist with Node added then dont added node
	$xmlp_wifi_nodes = simplexml_load_file($dir . "data/uploads/" . $networkname ."/". $networkname . "_wifi_nodes.xml");
	$wifi_node_exist = "0" ;
	foreach($xmlp_wifi_nodes->wifi_node as $wifinodes){
		if($wifinodes->wifi_node_mac == $_POST['mac']){
			$wifi_node_exist = $wifi_node_exist + 1 ;
		}
	}
	if($wifi_node_exist == "0"){
		
$wifi_node_data = "<wifi_node>
<wifi_node_ssid id=\"". $_POST['mac'] ."\"></wifi_node_ssid>
<wifi_node_mac id=\"". $_POST['mac'] ."\" >".$_POST['mac']."</wifi_node_mac>
<wifienable id=\"". $_POST['mac'] ."\">0</wifienable>
<wifi_custom id=\"". $_POST['mac'] ."\"></wifi_custom>
<wifi_auth_method id=\"". $_POST['mac'] ."\"></wifi_auth_method>
<wifi_encrypt_method id=\"". $_POST['mac'] ."\"></wifi_encrypt_method>
<transmit_key id=\"". $_POST['mac'] ."\"></transmit_key>
<encrypt_key_1 id=\"". $_POST['mac'] ."\"></encrypt_key_1>
<encrypt_key_2 id=\"". $_POST['mac'] ."\" ></encrypt_key_2>
<encrypt_key_3 id=\"". $_POST['mac'] ."\"></encrypt_key_3>
<encrypt_key_4 id=\"". $_POST['mac'] ."\"></encrypt_key_4>
<passphrase id=\"". $_POST['mac'] ."\"></passphrase>
<username id=\"". $_POST['mac'] ."\"></username>
<password id=\"". $_POST['mac'] ."\"></password>
</wifi_node>
</network>";
					
		$fc_add_wnode = file_get_contents($dir . "data/uploads/" . $networkname ."/". $networkname . "_wifi_nodes.xml");
		$fc_add_wnode = str_replace("</network>", $wifi_node_data, $fc_add_wnode);
		$fh_add_wnode = fopen($dir . "data/uploads/" . $networkname ."/". $networkname . "_wifi_nodes.xml", 'w') or die("Can't write to the nodes file.");
		fwrite($fh_add_wnode, $fc_add_wnode);
		fclose($fh_add_wnode);		
	}
	if(!file_exists($dir . "data/mac2net/" . base64_encode($_POST['mac']) . "_wifi.txt")){
		$fh_wnode_mac2net = fopen($dir . "data/mac2net/" . base64_encode($_POST['mac']) . "_wifi.txt", 'w') or die("Can't write to the nodes file.");
		fwrite($fh_wnode_mac2net, $networkname);
		fclose($fh_wnode_mac2net);
	}	
	
	//EOF Modification wifi file exist with Node added then dont added node
	
	/*if(!file_exists($dir . "data/mac2net/" . base64_encode($_POST['mac']) . "_wifi.txt"))
	{
$wifi_node_data = "<wifi_node>
<wifi_node_ssid id=\"". $_POST['mac'] ."\"></wifi_node_ssid>
<wifi_node_mac id=\"". $_POST['mac'] ."\" >".$_POST['mac']."</wifi_node_mac>
<wifienable id=\"". $_POST['mac'] ."\">0</wifienable>
<wifi_custom id=\"". $_POST['mac'] ."\"></wifi_custom>
<wifi_auth_method id=\"". $_POST['mac'] ."\"></wifi_auth_method>
<wifi_encrypt_method id=\"". $_POST['mac'] ."\"></wifi_encrypt_method>
<transmit_key id=\"". $_POST['mac'] ."\"></transmit_key>
<encrypt_key_1 id=\"". $_POST['mac'] ."\"></encrypt_key_1>
<encrypt_key_2 id=\"". $_POST['mac'] ."\" ></encrypt_key_2>
<encrypt_key_3 id=\"". $_POST['mac'] ."\"></encrypt_key_3>
<encrypt_key_4 id=\"". $_POST['mac'] ."\"></encrypt_key_4>
<passphrase id=\"". $_POST['mac'] ."\"></passphrase>
<username id=\"". $_POST['mac'] ."\"></username>
<password id=\"". $_POST['mac'] ."\"></password>
</wifi_node>
</network>";
					
		$fc_add_wnode = file_get_contents($dir . "data/uploads/" . $networkname ."/". $networkname . "_wifi_nodes.xml");
		$fc_add_wnode = str_replace("</network>", $wifi_node_data, $fc_add_wnode);
		$fh_add_wnode = fopen($dir . "data/uploads/" . $networkname ."/". $networkname . "_wifi_nodes.xml", 'w') or die("Can't write to the nodes file.");
		fwrite($fh_add_wnode, $fc_add_wnode);
		fclose($fh_add_wnode);	
		
		$fh_wnode_mac2net = fopen($dir . "data/mac2net/" . base64_encode($_POST['mac']) . "_wifi.txt", 'w') or die("Can't write to the nodes file.");
		fwrite($fh_wnode_mac2net, $networkname);
		fclose($fh_wnode_mac2net);
	
	}*/
	 
}

// EOF check wfi node file is exist in php if not exitst then add wifi node

	if($has_https == "true" && !$_SERVER['HTTPS']) {header("Location: https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);exit;}

	/* Check if the Network configuration file exist for network */
	if(!file_exists($dir . "data/uploads/" . $networkname ."/". $networkname .".xml")) {
		$log_content .= $time."- Checkin Fail for Reader ".$readerid." Not belong to any network -Mac-".$mac_tmp."\n";  
		die("# Network configuration file do not exist");
	}
	else if(!$_POST['ip']) {die($error_correct);}
	else if(!$_POST['mac']) {die($error_correct);}
	else {
		//echo "file". $dir . "data/uploads/".$networkname."/".$networkname."_om2p.xml exist\n";
		// Load in the network data
		$xmlp = simplexml_load_file($dir . "data/uploads/" . $networkname ."/". $networkname . ".xml");
		//print_r($xmlp);

		// Set the correct timezone
		/*if($xmlp_time->management->enable_dst == "1"){
			$dst_offset =  $xmlp->management->enable_gmt_offset + 1 ;
		}else{
			$dst_offset =  $xmlp->management->enable_gmt_offset;
		}
		setTimezoneByOffset($dst_offset);*/
		setTimezoneByOffset($xmlp->management->enable_gmt_offset);

		$outfile = $dir . "data/uploads/" . $networkname ."/". $networkname . ".csv";
		$fh = fopen($outfile, 'a') or die("# Cant write input from node to csv output");

	$keys = array('hw','ip','mac','robin','memfree','ssid','pssid','RR','uptime','load','role','gateway','gw-qual','NTR','routes','hops','RTT','nodes','rssi');
		$robin_vars = array_fill_keys($keys, '');

		foreach($robin_vars as $key => $value) {
			$robin_vars[$key] = $_POST[$key];
			$string .= $key . "=" . $_POST[$key] . "&\n";
		}
		//print_r($robin_vars);

		array_unshift($robin_vars, date("D M j G:i:s T Y"));
		$status_string = implode(",",$robin_vars);
		fwrite($fh, $status_string . "\n");
		fclose($fh);

		$filen = $dir . "data/cid/" . $networkname . ".txt";
		$newfc = file_get_contents($dir . "data/cid/" . $networkname . ".txt");
		//$algar = md5($_POST['ip'] . md5(file_get_contents($dir . "data/uploads/" . $networkname ."/".$networkname . "_om2p.xml"))) . "\n";
		//echo $algar;

		// The node has checked in, so remove any file that says otherwise
		if(file_exists($dir . "data/errored/" . base64_encode($_POST['mac']) . ".txt")) {unlink($dir . "data/errored/" . base64_encode($_POST['mac']) . ".txt");}
		//else {echo "file".$dir."data/errored/".base64_encode($_POST['mac']).".txt do not exist\n";}

		// Check stats dir exists, if not: make it
		if(!is_dir($dir . "data/stats/" . $networkname . "/")) {mkdir($dir . "data/stats/" . $networkname . "/");}
		//else { echo "directory".$dir."data/stats/".$networkname."exist\n";}

		// Save node stats
		$fj = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".txt", 'w');// or die("# Cant write node statistics");
		fwrite($fj, $postdata);
		fclose($fj);
		//Bridge Mesh IP
		
		if(file_exists($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml")) {
		$bridege = simplexml_load_file($dir . "data/uploads/". $networkname ."/" . $networkname . "_nodes.xml");
		$no_of_nodes = "0";
		
		foreach($bridege->node as $bridgeip) {
			if($_POST['mac'] == $bridgeip->mac) {
				$bridge_mesh = $bridgeip->meship;
				// BOF Upadate Bridge Mesh ip
				if($bridge_mesh == "" || $bridge_mesh != $_POST['brmesh'])
				{
					$bridge_mac = $_POST['mac'];
					$dom = new DOMDocument;
					$dom->load($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml");
					$xpath = new DOMXPath($dom);
					
					$seats = $xpath->query("//node/meship[@id='$bridge_mac']");
					
					if ($seats->length) {
						foreach ($seats as $seat) {		
							$seats->item(0)->nodeValue = $_POST['brmesh'] ;
							$dom->save($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml");
						}
					}
				} 
			//EOF Upadate Bridge Mesh ip
		}
		$no_of_nodes = $no_of_nodes + 1;
	}
}
		// Save node lan ip
		$fj = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . "static.txt", 'w');// or die("# Cant write node statistics");
		fwrite($fj, $_POST['static']);
		fclose($fj);
		
		// Update DNS-O-MATIC, if the user opts to
if($xmlp->general->services_customdns_enable = "1") {
	if(file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".ip.txt") == $_SERVER['REMOTE_ADDR']) {echo "";}
	else {
		$fj = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".ip.txt", 'w');// or die("# Cant write node statistics");
		fwrite($fj, $_SERVER['REMOTE_ADDR']);
		fclose($fj);
	}
}
else {echo "";}

		// Save node time stats
		$fk = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".date.txt", 'w');// or die("# Cant write node statistics");
		//BOF DST time +1hrs
		if($xmlp_time->management->enable_dst == "1"){
				/*$todayDate = date("dmyiHa");// current date
				$currentTime = time($todayDate); //Change date into time
				$dst_time = $currentTime+60*60;*/
				//fwrite($fk, date("dmyiHa",time()+60*60)); //comment for issue of 6am with reder at 7pm
				fwrite($fk, $time_datetxt);
				
				//$log_content .= $time ." Received checkin time " .date('dmy-H-ia',$time_datetxt." - MAC- ".$_POST['mac']."\n";
				//$log_content .= $time ." Received checkin time " .$time_datetxt." - MAC- ".$_POST['mac']."\n";
		}else{
				/*$todayDate = date("dmyiHa");// current date
				$currentTime = time($todayDate); //Change date into time
				$dst_time = $currentTime;*/
				//fwrite($fk, date("dmyiHa")); //comment for issue of 6am with reder at 7pm
				fwrite($fk, $time_datetxt);
				//$log_content .= $time ." Received checkin time " .$time_datetxt." - MAC- ".$_POST['mac']."\n";
				
		}
		//EOF DST time +1hrs
		
		
		/*fwrite($fk, date('dmyiHa'));*/
		fclose($fk);

		// Save node performance stats over time
		/*if(is_dir($dir . "data/stats/" . $networkname . "/" . date('d') . "-" . date('m'))) {echo "";}
		else {mkdir($dir . "data/stats/" . $networkname . "/" . date('d') . "-" . date('m'));}

		$fk = fopen($dir . "data/stats/" . $networkname . "/" . date('d') . "-" . date('m') . "/" . base64_encode($_POST['mac']) . ".txt", 'w');// or die("# Cant write node statistics");
		fwrite($fk, $_POST['NTR'] . "&" . $_POST['RTT']);
		fclose($fk);*/

		// Process the resend-reply option
		if($_GET['RR'] == "1") {/* The node has been reflashed, or is new, so we send the data again. */}
		else if(strpos(file_get_contents($dir . "data/cid/" . $networkname . ".txt"), md5($_POST['ip'] . $_POST['mac'] . $_POST['robin'] . md5(file_get_contents($dir . "data/uploads/" . $networkname ."/".$networkname . ".xml"))) . "\n") !==FALSE) {/*echo "Node already has data so exit\n"; exit;*//* The node already has the data, we don't need to send it again */}
		else {/*echo "Node data changed continue\n";*//* The data has changed, so we let the script continue so the node gets its data */}


		// Save the checkin data
		$fi = fopen($dir . "data/cid/" . $networkname . ".txt", 'a');// or die("# Cant write node checkin value");
		$checkindata = md5($_POST['ip'] . $_POST['mac'] . $_POST['robin'] . md5(file_get_contents($dir . "data/uploads/" . $networkname ."/". $networkname . ".xml")));
		//echo "writing".$checkindata." to /data/cid".$networkname.".txt file\n";
		fwrite($fi, md5($_POST['ip'] . $_POST['mac'] . $_POST['robin'] . md5(file_get_contents($dir . "data/uploads/" . $networkname ."/". $networkname . ".xml"))) . "\n");
		fclose($fi);
		
		if ($networkname != "LasColinasMedicalCenter867")
		{
				
				/* BOF Role Change Notification Email*/
				if(file_exists($dir . "data/role/" . base64_encode($_POST['mac']) . ".txt")){
					$privious_role = file_get_contents($dir . "data/role/" . base64_encode($_POST['mac']) . ".txt");
					
				}else{ $privious_role ="";}
				 
				/* EOF Role change Notification Email */
				
				// Save the node role
				//if(isset($_POST['role'])) {$role = "G";}
				if ($_POST['role'] == "G") {$role = "G";}
				else if($_POST['role'] =="W"){$role = "W";}
				else {$role = "R";}
				//echo "node role".$role."\n";
				
				/* BOF Role Change Notification Email*/
				if($xmlp->management->enable_role_status == "1"){
					if($privious_role != "" && $privious_role != $role ){

							if($privious_role =="G"){
								$privious_role_new = "Gateway";
							}else if($privious_role =="W"){
								$privious_role_new = "Wifi";
							}else if($privious_role =="R"){
								$privious_role_new = "Mesh";
							}
							if($role =="G"){
								$role_new = "Gateway";
							}else if($role =="W"){
								$role_new = "Wifi";
							}else if($role =="R"){
								$role_new = "Mesh";
							}
							if(file_exists($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml")) {
								$rolchng_name = simplexml_load_file($dir . "data/uploads/". $networkname ."/" . $networkname . "_nodes.xml");
									foreach($rolchng_name->node as $rolchng) {
										if($_POST['mac'] == $rolchng->mac) {
											$rolchng_name = $rolchng->name;
											$rolchng_mac = $rolchng->mac;
											
										}
									}
							}  
							$lanip = $_POST['ip'];
							$meship = $_SERVER['REMOTE_ADDR'];
							
							 if(file_exists($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".date.txt")) {$fc_last_chekin = file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".date.txt");
										
				
										$day = substr($fc_last_chekin, 0, 2);
										$mon = substr($fc_last_chekin, 2, 2);
										$yer = substr($fc_last_chekin, 4, 2);
				
										$min = substr($fc_last_chekin, 6, 2);
										$anp = substr($fc_last_chekin, 10, 2);
										$hor = substr($fc_last_chekin, 8, 2);
										
										if($hor > 12) {$hor = $hor - 12;} 
							}
												
							$role_message = "<html><head><style>p{font-size:15px;}span{font-weight:bold;}</style></head><body><img src='http://checkin.freshloc.net/resources/logo.gif' alt='freshloc-logo' /><br><br><p>The following FreshNet reader has changed roles:<br><br><span>Account:</span> $networkname<br><br><span>Name:</span>$rolchng_name  <span>MAC:</span> $rolchng_mac<span> Original Role:</span> $privious_role_new<span> MeshIP:</span> $meship<span> New Role:</span> $role_new <span>Last checkin time:</span> $day-$mon-$yer-$hor:$min$anp<br></p></body></html>"; 
								
								if($xmlp->robindash->notifymail != "")
								{			
									$email = $xmlp->robindash->notifymail;
								}else{
									$email = "support@freshloc.com";
									//$email ="mukesh@limeston.com,scott.cadieux@freshloc.com";
									//$email ="scott.cadieux@freshloc.com";
								}
								send_alert($email, $networkname, $rolchng_name, $role_message);
								/* BOF Role change  logs */
								if(file_exists($dir."data/uploads/".$networkname."/logs/node-role.log.txt")){
										$log_role_chng_content = $time ." Name-" .$rolchng_name." MAC- ".$_POST['mac']."Original Role- ".$privious_role_new." IP: ".$meship." New Role- ".$role_new." Last checkin time- ".$day."-".$mon."-".$yer."-".$hor."-".$min.$anp."\n";
										
										$fname_log_role= $dir."data/uploads/".$networkname."/logs/node-role.log.txt";
										//write from begin role chage log file
										$get_data_log_role = file_get_contents($fname_log_role);
										
										if(file_put_contents($fname_log_role, $log_role_chng_content. $get_data_log_role) != FALSE)
				
										//Delete role log file after 2days
										$file_create_date =  date("F d Y H:i:s", filectime($fname_log_role));
										$today_log_role = date("F d Y H:i:s");
										$diff_day_log_role = round(abs(strtotime($today_log_role)-strtotime($file_create_date ))/86400);
										if($diff_day_log_role == "2"){
											unlink($fname_log_role);							
										}
										
								}else{
										$log_role_chng_content = $time ." Name-" .$rolchng_name." MAC- ".$_POST['mac']."Original Role- ".$privious_role_new." IP: ".$meship." New Role- ".$role_new." Last checkin time- ".$day."-".$mon."-".$yer."-".$hor."-".$min.$anp."\n";
										
										$fh_log_role = fopen($dir."data/uploads/".$networkname."/logs/node-role.log.txt" , a);
										fwrite($fh_log_role,$log_role_chng_content);
										fclose($fh_log_role);
								}
						
								/* EOF Role change logs */
							}
						
				}
		}

		/* EOF Role change Notification Email */
		
		if ($_POST['role'] == "G") {$role = "G";}
		else if($_POST['role'] =="W"){$role = "W";}
		else {$role = "R";}
		$fi = fopen($dir . "data/role/" . base64_encode($_POST['mac']) . ".txt", 'w');// or die("# Cant write node role");
		fwrite($fi, $role);
		fclose($fi);
		

		if(filesize($dir . "data/uploads/". $networkname ."/" . $networkname . ".csv") > 524288) {unlink($dir . "data/uploads/". $networkname ."/". $networkname . ".csv") or die("# Cant delete the log which is over 0.5 megabytes");}

echo "#@#config dashboard\n";
echo "checkin_interval ". $xmlp->dashboard->checkin_interval . "\n";
echo "dashboard_ssl " . $xmlp->dashboard->dashboard_ssl . "\n";
echo "dashboard_alt_ssl " . $xmlp->dashboard->dashboard_alt_ssl . "\n";
echo "dashboard_alt_srv " . $xmlp->dashboard->dashboard_alt_srv . "\n";
echo "req_ap_scan " . $xmlp->dashboard->req_ap_scan . "\n";
echo "#@#config debug\n";
echo "ssh_enabled " .  $xmlp->debug->ssh_enabled . "\n";
echo "tunnel_enabled " .  $xmlp->debug->tunnel_enabled . "\n";
echo "#@#config madwifi\n";
echo "priv_rate " .  $xmlp->madwifi->priv_rate . "\n";
echo "#@#config anyip\n";
echo "node_ip_max ".  $xmlp->anyip->node_ip_max . "\n";

echo "#@#config wireless\n";
echo "public.enabled " .  $xmlp->wireless->public_enabled_om2p. "\n";
echo "public.hidden " .  $xmlp->wireless->public_hidden_om2p. "\n";
//echo "public.ssid " .  $xmlp->wireless->public_ssid_om2p . "\n";
echo "public.ssid ";
if($xmlp->robindash->usenodename == 1) {
	$xmln = simplexml_load_file($dir . "data/uploads/". $networkname . "/" . $networkname . "_nodes.xml");

	foreach($xmln->node as $node) {
		if($_POST['ip'] == $node->ip && $_POST['mac'] == $node->mac) {
			if(!strlen($node->name)) {echo str_replace(" ", "*", $xmlp->wireless->public_ssid_om2p);}
			else {echo str_replace(" ", "*", $node->name);}
		}
	}
}
else {echo $xmlp->wireless->public_ssid_om2p;}
echo "\n";
echo "public.key " .  $xmlp->wireless->public_key_om2p . "\n";
echo "private.enabled " .  $xmlp->wireless->private_enabled_om2p . "\n";
echo "private.hidden " .  $xmlp->wireless->private_hidden_om2p . "\n";
echo "private.ssid " .  $xmlp->wireless->private_ssid_om2p . "\n";
echo "private.key " .  $xmlp->wireless->private_key_om2p . "\n";
echo "private.rad_server " .  $xmlp->wireless->private_rad_server_om2p . "\n";
echo "private.rad_port " .  $xmlp->wireless->private_rad_port_om2p . "\n";
echo "public.vlan_tag " .  $xmlp->wireless->public_vlan_tag_om2p . "\n";
echo "private.vlan_tag " .  $xmlp->wireless->private_vlan_tag_om2p. "\n";
echo "private.bridge " .  $xmlp->wireless->private_bridge_om2p . "\n";
//echo "wifi0.channel " .  $xmlp->wireless->wifi0_channel_om2p. "\n";
echo "wifi0.country " .  $xmlp->wireless->wifi0_country_om2p . "\n";
echo "wifi0.txpower " .  $xmlp->wireless->wifi0_txpower_om2p . "\n";
echo "ap.wide_channel " .  $xmlp->wireless->ap_wide_channel_om2p . "\n";
echo "wifi0.auto_channel " .  $xmlp->wireless->wifi0_auto_channel_om2p . "\n";
echo "wifi0.rts " .  $xmlp->wireless->wifi0_rts_om2p . "\n";
echo "wifi0.58_channel " .  $xmlp->wireless->wifi0_58_channel_om2p . "\n";
echo "#@#config filter\n";
echo "public.LAN_block " .  $xmlp->iprules->filter_LAN_BLOCK . "\n";
echo "private.LAN_block " .  $xmlp->iprules->filter_LAN_BLOCK2 . "\n";
echo "public.AP_isolate " .  $xmlp->iprules->filter_AP1_isolation . "\n";
echo "private.AP_isolate " .  $xmlp->iprules->filter_AP2_isolation . "\n";
echo "SMTP_redirect " .  $xmlp->iprules->filter_SMTP_rdir . "\n";
echo "public.anyip \n";
echo "#@#config nodes  \n";
if(file_exists($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml")) {
	$xmlstring = simplexml_load_file($dir . "data/uploads/". $networkname ."/" . $networkname . "_nodes.xml");
	$no_of_nodes = "0";

	foreach($xmlstring->node as $node) {
		if(file_exists($dir . "data/role/" . base64_encode($node->mac) . ".txt")) 
		{echo file_get_contents($dir . "data/role/" . base64_encode($node->mac) . ".txt");}
		else {echo "R";}

		echo " " . $node->ip . " " . str_replace(" ", "*", $node->name) . " " . $node->mac . "\n";
		$no_of_nodes = $no_of_nodes + 1;
	}
}
// wifi-network
echo "#@#config wifi_client\n";
if(file_exists($dir."data/uploads/".$networkname."/".$networkname."_wifi_nodes.xml")){
	$xmlp_wifi = simplexml_load_file($dir."data/uploads/".$networkname."/".$networkname."_wifi_nodes.xml");	
}else{
	echo "enable 0 \n";
}
$nodefound=0;
/*if($xmlp->wireless->wifi_enabled == 1){*/
if($xmlp_wifi->wifi_node !=""){
	foreach($xmlp_wifi->wifi_node as $wifinode){
		if($wifinode->wifi_node_mac == $_POST['mac'])
		{
			$nodefound=1;
			echo "enable ".$wifinode->wifienable." \n";
			echo "mode sta \n";
			echo "ssid ". $wifinode->wifi_node_ssid ."\n";
			if($wifinode->wifi_custom != ""){
				echo "encryption ".$wifinode->wifi_custom."\n";
				echo "key " . $wifinode->passphrase."\n";
			}else {
				if($wifinode->wifi_auth_method == "wpa_psk"){
				echo "encryption psk-mixed\n";
				echo "key " . $wifinode->passphrase."\n";
				}
				if($wifinode->wifi_auth_method == "wpa_802"){
				echo "encryption mixed-wpa\n";
				echo "key " . $wifinode->passphrase."\n";
				}
				if($wifinode->wifi_auth_method =="wep"){
				echo "encryption wep\n";
					if($wifinode->transmit_key == 1){
						echo "key 1\n" ;
						echo "key1 ". $wifinode->encrypt_key_1."\n";
					}
					if($wifinode->transmit_key == 2){
						echo "key 2\n" ;
						echo "key1 ". $wifinode->encrypt_key_1."\n";
						echo "key2 ". $wifinode->encrypt_key_2."\n";
					}
					if($wifinode->transmit_key == 3){
						echo "key 3\n" ;
						echo "key1 ". $wifinode->encrypt_key_1."\n";
						echo "key2 ". $wifinode->encrypt_key_2."\n";
						echo "key3 ". $wifinode->encrypt_key_3."\n";
					}
					if($wifinode->transmit_key == 4){
						echo "key 4\n" ;
						echo "key1 ". $wifinode->encrypt_key_1."\n";
						echo "key2 ". $wifinode->encrypt_key_2."\n";
						echo "key3 ". $wifinode->encrypt_key_3."\n";
						echo "key4 ". $wifinode->encrypt_key_4."\n";
					}
					if($wifinode->wifi_auth_method =="open_system"){
					echo "encryption none\n"; 
					}
				}
			}
					
		}
		//else{
		//	echo "enable 0 \n";
		//}
		
	}//end foreach

}///end wifi netwrok enable =1
if($nodefound == 0)
	echo "enable 0 \n";



//Managment
echo "#@#config management\n";
echo "disable_ng_inettest ".$xmlp->management->disable_Ng_inettest. "\n";
echo "reboot_token ". $xmlp->management->enable_force_reboot."\n";/*change it for reboot node from _node.xml file*/
echo "network ". $xmlp->node->general_net ."\n";
echo "dns_alt_srv \n";
echo "rootpwd " .  $xmlp->management->enable_rootpwd_om2p . "\n";
echo "sm " .  $xmlp->management->enable_sm . "\n";
echo "gmt_offset " .  $xmlp->management->enable_gmt_offset . "\n";
//BOF om2p
echo "LAN_block " . $xmlp->iprules->filter_LAN_BLOCK . "\n";
echo "pubAP_isolate " .  $xmlp->iprules->filter_AP1_isolation . "\n";
echo "privAP_isolate " .  $xmlp->iprules->filter_AP2_isolation . "\n";
//EOF om2p
echo "clientbr_iface \n";
echo "cp_name \n";
echo "node_id \n";
if($xmlp->management->disable_Ng_inettest == "0"){
echo "no_inet_check 1 \n";
}else{
echo "no_inet_check 0 \n";
}
echo  "#@#config reboot\n";
if(file_exists($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml")) {
	$xmlstring = simplexml_load_file($dir . "data/uploads/". $networkname ."/" . $networkname . "_nodes.xml");
	$no_of_nodes = "0";

	foreach($xmlstring->node as $noderestart) {
		if($_POST['mac'] == $noderestart->mac) {
			$reboot_flag = $noderestart->reboot;
			// BOF Upadate Reboot Node zero
			if($reboot_flag == "1")
			{
			$reboot_node = $_POST['mac'];
			$dom = new DOMDocument;
			$dom->load($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml");
			$xpath = new DOMXPath($dom);
			
			$seats = $xpath->query("//node/reboot[@id='$reboot_node']");
			
				if ($seats->length) {
					foreach ($seats as $seat) {		
					
						 $seats->item(0)->nodeValue = 0 ;
					
						 $dom->save($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml");
								 
						
					}
				}
			} 
			//EOF Upadate Reboot Node zero
		}
		$no_of_nodes = $no_of_nodes + 1;
	}
}
echo "reboot " . $reboot_flag . "\n"; 
echo "#@#config customscript\n";
$url= str_replace(" ", "\\ ",$xmlp->general->services_cstm_srv);
echo "cs_url " . $url . "\n";
//echo "cs_url ". $xmlp->general->services_cstm_srv ."\n";
//BOF Reading Partical Data from liveclientlist.asp
$mac_pd = $_POST['mac'];
echo "#@#config readerdata\n";
if(file_exists($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readertype.txt"))
{
	if(file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readertype.txt") == "PD")
	{	
		$reader_type = file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readertype.txt");
		echo "readertype ".$reader_type ."\n";
		$readerid = file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".readerid.txt");
		echo "readerid ".$readerid."\n";
		$clientid = file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".clientid.txt");
		echo "clientid ".$clientid."\n";
		$itemid1 = file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".itemid1.txt");
		echo "itemid1 ".$itemid1."\n";
		$itemid2 = file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . ".itemid2.txt");
		echo "itemid2 ".$itemid2."\n";
        echo "authcode Tcubed\n"; 
	}
}
//EOF Reading Partical Data from liveclientlist.asp
	}
	
	$filename= $dir . "data/log/dashboardlog.txt";
	//BOF write from begin deshlog file
	$get_data = file_get_contents($filename);
	if(file_put_contents($filename, $log_content. $get_data) != FALSE)
	//EOF  write from begin deshlog file
	//BOF Resize deshlog file
	$filesize = filesize($filename);
	if ($filesize > 102400)
	{
		$fp = fopen($filename, "r+");
		ftruncate($fp, 102400);
		fclose($fp);
	}
	//EOF Resize deshlog file
	exit;
}
else
{

if(file_exists("settings.php")) {require("settings.php");}
else {die("# We need to setup the server first");}


$wdir = str_replace($_SERVER['DOCUMENT_ROOT'], "", $dir);

if(file_exists($dir . "data/mac2net/" . base64_encode($_GET['mac']) . ".txt")) {$networkname = file_get_contents($dir . "data/mac2net/" . base64_encode($_GET['mac']) . ".txt");}
else {exit;}

if($has_https == "true" && !$_SERVER['HTTPS']) {header("Location: https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);exit;}

if(!file_exists($dir . "data/uploads/" . $networkname ."/". $networkname .".xml")) {die("# Network name does not exist");}
else if(!$_GET['ip']) {die($error_correct);}
else if(!$_GET['mac']) {die($error_correct);}
else {
// Load in the network data
$xmlp = simplexml_load_file($dir . "data/uploads/" . $networkname ."/". $networkname . ".xml");

// Set the correct timezone
setTimezoneByOffset($xmlp->management->enable_gmt_offset);

// Do the dual-checkin if we need to...
if($xmlp->robindash->forwardcheck == "1") {$fc = file_get_contents("https://www.wifi-mesh.com/dashboard/checkin-batman.php?" . str_replace("network=" . $networkname, "", $_SERVER['QUERY_STRING']));}

$outfile = $dir . "data/uploads/" . $networkname ."/". $networkname . ".csv";
$fh = fopen($outfile, 'a') or die("# Cant write input from node to csv output");

$keys = array('ip','mac','robin','batman','memfree','ssid','pssid','users','kbup','kbdown','top_users','uptime','gateway','gw-qual','NTR','routes','hops','RTT','nbs','rank','nodes','rssi','role');
$robin_vars = array_fill_keys($keys, '');

foreach($robin_vars as $key => $value) {
	$robin_vars[$key] = $_GET[$key];
	$string .= $key . "=" . $_GET[$key] . "&\n";
}

array_unshift($robin_vars, date("D M j G:i:s T Y"));
$status_string = implode(",",$robin_vars);
fwrite($fh, $status_string . "\n");
fclose($fh);

$filen = $dir . "data/cid/" . $networkname . ".txt";
$newfc = file_get_contents($dir . "data/cid/" . $networkname . ".txt");
$algar = md5($_GET['ip'] . md5(file_get_contents($dir . "data/uploads/" . $networkname ."/".$networkname . ".xml"))) . "\n";

// The node has checked in, so remove any file that says otherwise
if(file_exists($dir . "data/errored/" . base64_encode($_GET['mac']) . ".txt")) {unlink($dir . "data/errored/" . base64_encode($_GET['mac']) . ".txt");}


// Check stats dir exists, if not: make it
if(!is_dir($dir . "data/stats/" . $networkname . "/")) {mkdir($dir . "data/stats/" . $networkname . "/");}

// Save node stats
$fj = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_GET['mac']) . ".txt", 'w');// or die("# Cant write node statistics");
fwrite($fj, $_SERVER['QUERY_STRING']);
fclose($fj);
 

// Save node time stats
$fk = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_GET['mac']) . ".date.txt", 'w');// or die("# Cant write node statistics");
fwrite($fk, date('dmyiHa'));
fclose($fk);


// Save node performance stats over time
/*
if(is_dir($dir . "data/stats/" . $networkname . "/" . date('d') . "-" . date('m'))) {echo "";}
else {mkdir($dir . "data/stats/" . $networkname . "/" . date('d') . "-" . date('m'));}

$fk = fopen($dir . "data/stats/" . $networkname . "/" . date('d') . "-" . date('m') . "/" . date('i') . date('G') . "-" . base64_encode($_GET['mac']) . ".usage.txt", 'w');// or die("# Cant write node statistics");
fwrite($fk, $_GET['users'] . "&" . urlencode($_GET['top_users']) . "&" . $_GET['sta_mac'] . "&" . $_GET['sta_ip'] . "&" . $_GET['sta_hostname'] . "&" . $_GET['sta_rssi'] . "&" . $_GET['sta_dbm']);
fclose($fk);

$fk = fopen($dir . "data/stats/" . $networkname . "/" . date('d') . "-" . date('m') . "/" . base64_encode($_GET['mac']) . ".txt", 'w');// or die("# Cant write node statistics");
fwrite($fk, $_GET['NTR'] . "&" . $_GET['nbs'] . "&" . $_GET['rssi'] . "&" . $_GET['RTT']);
fclose($fk); */


	
// Process the resend-reply option
if($_GET['RR'] == "1") {/* The node has been reflashed, or is new, so we send the data again. */}
else if(strpos(file_get_contents($dir . "data/cid/" . $networkname . ".txt"), md5($_GET['ip'] . $_GET['mac'] . $_GET['robin'] . md5(file_get_contents($dir . "data/uploads/" . $networkname ."/".$networkname . ".xml"))) . "\n") !==FALSE) {/*echo "Node already has data so exit\n"; exit;*//* The node already has the data, we don't need to send it again */}
else {/*echo "Node data changed continue\n";*//* The data has changed, so we let the script continue so the node gets its data */}


// Save the checkin data
$fi = fopen($dir . "data/cid/" . $networkname . ".txt", 'a');// or die("# Cant write node checkin value");
fwrite($fi, md5($_GET['ip'] . $_GET['mac'] . $_GET['robin'] . md5(file_get_contents($dir . "data/uploads/" . $networkname ."/". $networkname . ".xml"))) . "\n");
fclose($fi);

// Save the node role
//if(isset($_GET['role'])) {$role = "G";}
if($_GET['role'] == "G") {$role = "G";}
else {$role = "R";}

$fi = fopen($dir . "data/role/" . base64_encode($_GET['mac']) . ".txt", 'w');// or die("# Cant write node role");
fwrite($fi, $role);
fclose($fi);

// Save node lan ip
$fj = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_POST['mac']) . "static.txt", 'w');// or die("# Cant write node statistics");
fwrite($fj, $_GET['static']);
fclose($fj);
// Update DNS-O-MATIC, if the user opts to
if($xmlp->general->services_customdns_enable = "1") {
	if(file_get_contents($dir . "data/stats/" . $networkname . "/" . base64_encode($_GET['mac']) . ".ip.txt") == $_SERVER['REMOTE_ADDR']) {echo "";}
	else {
		$fj = fopen($dir . "data/stats/" . $networkname . "/" . base64_encode($_GET['mac']) . ".ip.txt", 'w');// or die("# Cant write node statistics");
		fwrite($fj, $_SERVER['REMOTE_ADDR']);
		fclose($fj);
		
		file_get_contents("https://" . $xmlp->general->services_customdns_user . ":" . $xmlp->general->services_customdns_pass . "@updates.dnsomatic.com/nic/update?myip=" . $_SERVER['REMOTE_ADDR']);
	}
}
else {echo "";}
}

// Check if the log file is too big
if(filesize($dir . "data/uploads/". $networkname ."/" . $networkname . ".csv") > 524288) {unlink($dir . "data/uploads/". $networkname ."/". $networkname . ".csv") or die("# Cant delete the log which is over 0.5 megabytes");}
?>
#@#config dhcp
#@#config dhcpd
#@#config firewall
#@#config fstab
#@#config init_6
#@#config maradns
#@#config olsr
#@#config wanif
<?php
if($xmlp->secondary->pomade_enabled == "0") {echo "#@#config pomade\n";}

if($xmlp->robindash->captivename == "nodogsplash") {echo "#@#config chilli\n#@#config wifidog\n";}
else if($xmlp->robindash->captivename == "coova" || $xmlp->robindash->captivename == "wifirush") {echo "#@#config nodog\n#@#config wifidog\n";}
else if($xmlp->robindash->captivename == "wifidog") {echo "#@#config nodog\n#@#config coova\n";}
else {echo "#@#config nodog\n#@#config coova\n";}

echo "#@#config dropbear\n";
if(file_exists($dir . "data/uploads/" . $networkname . "/ssh.key")) {echo "PasswordAuth on\n";}
else {echo "PasswordAuth on\n";}
?>
#@#config acl
mac.mode_ap1 <?php echo $xmlp->acl->mac_mode_ap1 . "\n"; ?>
mac.mode_ap2 <?php echo $xmlp->acl->mac_mode_ap2 . "\n"; ?>
#@#config cp_switch
main.which_handler <?php echo $xmlp->cp_switch->main_which_handler . "\n"; ?>
#@#config ra_switch
main.which_handler 2
<?php
if($xmlp->robindash->captivename == "nodogsplash" && $xmlp->robindash->firewall->http_authenticated) {
?>
#@#config nodog
FirewallRuleSet preauthenticated-users {
	FirewallRule <?php if($xmlp->robindash->firewall->https_unauthenticated == "1") {echo "allow port 443";} else {echo "block port 443";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->ftp_unauthenticated == "1") {echo "allow port 20";} else {echo "block port 20";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->ftp_unauthenticated == "1") {echo "allow port 21";} else {echo "block port 21";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->ssh_unauthenticated == "1") {echo "allow port 22";} else {echo "block port 22";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->telnet_unauthenticated == "1") {echo "allow port 23";} else {echo "block port 23";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->smtp_unauthenticated == "1") {echo "allow port 25";} else {echo "block port 25";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->smtp_unauthenticated == "1") {echo "allow port 465";} else {echo "block port 465";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->pop_unauthenticated == "1") {echo "allow port 109";} else {echo "block port 109";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->pop_unauthenticated == "1") {echo "allow port 110";} else {echo "block port 110";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->imap_unauthenticated == "1") {echo "allow port 143";} else {echo "block port 143";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->imap_unauthenticated == "1") {echo "allow port 220";} else {echo "block port 220";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->imap_unauthenticated == "1") {echo "allow port 993";} else {echo "block port 993";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->irc_unauthenticated == "1") {echo "allow port 194";} else {echo "block port 194";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->torrents_unauthenticated == "1") {echo "allow port 6881:6999";} else {echo "block port 6881:6999";} echo "\n"; ?>
<?php
if(file_exists($dir . "data/uploads/" . $networkname . "/multi-list.txt")) {
	$fc = file_get_contents($dir . "data/uploads/" . $networkname . "/multi-list.txt");
	$link = explode("\r\n", $fc);
	$ips = array();

	foreach($link as $url) {
		preg_match("/^(http:\/\/)?([^\/]+)/i", $url, $matches);
		$server = $matches[2];
		$serverips = gethostbynamel($server);
		
		foreach($serverips as $serverip) {
			if($ips[$serverip] == 1) {echo "";}
			else if($serverip == "") {echo "";}
			else {
				echo "	FirewallRule allow all port 80 to " . $serverip . "\n";
				echo "	FirewallRule allow all port 443 to " . $serverip . "\n";
			}
			
			$ips[$serverip] = 1;
		}
	}
}

if($xmlp->general->services_name_srv == "") {echo "";}
else {
	echo "	FirewallRule block port 53\n";
	echo "	FirewallRule allow port 53 to " . $xmlp->general->services_name_srv . "\n";
}
?>
}
FirewallRuleSet authenticated-users {
	FirewallRule <?php if($xmlp->robindash->firewall->http_authenticated == "1") {echo "allow port 80";} else {echo "block port 80";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->https_authenticated == "1") {echo "allow port 443";} else {echo "block port 443";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->ftp_authenticated == "1") {echo "allow port 20";} else {echo "block port 20";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->ftp_authenticated == "1") {echo "allow port 21";} else {echo "block port 21";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->ssh_authenticated == "1") {echo "allow port 22";} else {echo "block port 22";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->telnet_authenticated == "1") {echo "allow port 23";} else {echo "block port 23";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->smtp_authenticated == "1") {echo "allow port 25";} else {echo "block port 25";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->smtp_authenticated == "1") {echo "allow port 465";} else {echo "block port 465";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->pop_authenticated == "1") {echo "allow port 109";} else {echo "block port 109";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->pop_authenticated == "1") {echo "allow port 110";} else {echo "block port 110";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->imap_authenticated == "1") {echo "allow port 143";} else {echo "block port 143";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->imap_authenticated == "1") {echo "allow port 220";} else {echo "block port 220";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->imap_authenticated == "1") {echo "allow port 993";} else {echo "block port 993";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->irc_authenticated == "1") {echo "allow port 194";} else {echo "block port 194";} echo "\n"; ?>
	FirewallRule <?php if($xmlp->robindash->firewall->torrents_authenticated == "1") {echo "allow port 6881:6999";} else {echo "block port 6881:6999";} echo "\n"; ?>
<?php
if($xmlp->general->services_name_srv == "") {echo "";}
else {
	echo "	FirewallRule block port 53\n";
	echo "	FirewallRule allow port 53 to " . $xmlp->general->services_name_srv . "\n";
}
?>
}
FirewallRuleSet users-to-router {
	FirewallRule allow
}
GatewayName <?php echo str_replace(".", "", $_GET['ip']) . "\n"; ?>
<?php if(strlen($xmlp->nodog->RedirectURL) > 0) {echo "RedirectURL " . $xmlp->nodog->RedirectURL . "\n";} ?>
ClientIdleTimeout <?php if(strlen($xmlp->nodog->ClientIdleTimeout) > 0) {echo $xmlp->nodog->ClientIdleTimeout;} else {echo "1440";} echo "\n"; ?>
ClientForceTimeout <?php if(strlen($xmlp->nodog->ClientForceTimeout) > 0) {echo $xmlp->nodog->ClientForceTimeout;} else {echo "1440";} echo "\n"; ?>
AuthenticateImmediately <?php
if(file_exists($dir . "data/uploads/" . $networkname . "/multi-list.txt")) {echo "0\n";}
else {echo $xmlp->nodog->AuthenticateImmediately . "\n";}
?>
TrafficControl 1
DownloadLimit <?php echo $xmlp->nodog->DownloadLimit . "\n"; ?>
UploadLimit <?php echo $xmlp->nodog->UploadLimit . "\n"; ?>
MaxClients 200
<?php
if(strlen($xmlp->nodog->TrustedMACList) > 12) {echo "TrustedMACList " . str_replace("\n", ",", $xmlp->nodog->TrustedMACList) . "\n";}

$blocklist = "";
$hasblocks = "";
$i = 0;

if(is_dir($dir . "data/stats/" . $networkname . "/banned/")) {
	if ($dh = opendir($dir . "data/stats/" . $networkname . "/banned/")) {
		while (($file = readdir($dh)) !== false) {

			if($file == "." || $file == "..") {echo "";}
			else {
				$blocklist = $blocklist . base64_decode(str_replace(".txt", "", $file)) . ",";
				$hasblocks = true;
				$i = $i + 1;
			}
		}
		closedir($dh);
	}
}

if($hasblocks == true) {
	$multiplier = 18 * 2 - 1;
	$blocklist = substr($blocklist, 0, $multiplier);
	
	echo "BlockedMACList " . $blocklist . "\n";
}



if(file_exists($dir . "data/uploads/" . $networkname . "/multi-list.txt")) {echo "#@#config splash-HTML\npage "; if($use_https == "true") {echo "https://";} else {echo "http://";} echo $sn . $wdir . "data/ad-splash/" . $networkname . "/splash.html\n";}
else if($xmlp->nodog->AuthenticateImmediately == "1") {echo "";}
else {
	echo "#@#config splash-HTML\n";
	echo "page "; if($use_https == "true") {echo "https://";} else {echo "http://";} echo $sn . $wdir . "data/";

	if(file_exists($dir . "data/uploads/" . $networkname . "/multi-list.txt")) {echo "multi-splash/" . $networkname . "/splash.html\n";}
	else {echo $networkname . ".txt\n";}

	if ($handle = opendir($dir . "data/uploads/" . $networkname . "/")) {
		while (false !== ($file = readdir($handle))) {
			if ($file != "." && $file != ".." && $file != "custom.sh" && $file != "multi-list.txt") {
				if(strpos($file, '.txt') !==FALSE || strpos($file, '.htm') !==FALSE) {$type = "page";}
				else if(strpos($file, '.jp') !==FALSE || strpos($file, '.png') !==FALSE || strpos($file, '.gif') !==FALSE || strpos($file, '.bmp') !==FALSE) {$type = "image";}
				else {$type = "page";}

				echo $type . " "; if($use_https == "true") {echo "https://";} else {echo "http://";} echo $_SERVER['SERVER_NAME'] . $wdir . "data/uploads/" . $networkname . "/" . $file . "\n";
			}
		}
	}
}

echo "#bogus2 " . rand(1000000000, 9999999999) . "\n";
}
else if($xmlp->robindash->captivename == "nodogsplash") {
?>
#@#config nodog
FirewallRuleSet preauthenticated-users {
	FirewallRule allow
}
FirewallRuleSet authenticated-users {
	FirewallRule allow
}
FirewallRuleSet users-to-router {
	FirewallRule allow
}
GatewayName <?php echo str_replace(".", "", $_GET['ip']) . "\n"; ?>
<?php if(strlen($xmlp->nodog->RedirectURL) > 0) {echo "RedirectURL " . $xmlp->nodog->RedirectURL . "\n";} ?>
ClientIdleTimeout <?php if(strlen($xmlp->nodog->ClientIdleTimeout) > 0) {echo $xmlp->nodog->ClientIdleTimeout;} else {echo "1440";} echo "\n"; ?>
ClientForceTimeout <?php if(strlen($xmlp->nodog->ClientForceTimeout) > 0) {echo $xmlp->nodog->ClientForceTimeout;} else {echo "1440";} echo "\n"; ?>
AuthenticateImmediately <?php
if(file_exists($dir . "data/uploads/" . $networkname . "/multi-list.txt")) {echo "0\n";}
else {echo $xmlp->nodog->AuthenticateImmediately . "\n";}
?>
TrafficControl 1
DownloadLimit <?php echo $xmlp->nodog->DownloadLimit . "\n"; ?>
UploadLimit <?php echo $xmlp->nodog->UploadLimit . "\n"; ?>
MaxClients 200
<?php
if(strlen($xmlp->nodog->TrustedMACList) > 12) {echo "TrustedMACList " . str_replace("\n", ",", $xmlp->nodog->TrustedMACList) . "\n";}

if(file_exists($dir . "data/uploads/" . $networkname . "/multi-list.txt")) {echo "#@#config splash-HTML\npage "; if($use_https == "true") {echo "https://";} else {echo "http://";} echo $sn . $wdir . "data/ad-splash/" . $networkname . "/splash.html\n";}
else if($xmlp->nodog->AuthenticateImmediately == "1") {echo "";}
else {
	echo "#@#config splash-HTML\n";
	echo "page "; if($use_https == "true") {echo "https://";} else {echo "http://";} echo $sn . $wdir . "data/";

	if(file_exists($dir . "data/uploads/" . $networkname . "/multi-list.txt")) {echo "multi-splash/" . $networkname . "/splash.html\n";}
	else {echo $networkname . ".txt\n";}
	
	if ($handle = opendir($dir . "data/uploads/" . $networkname . "/")) {
		while (false !== ($file = readdir($handle))) {
			if ($file != "." && $file != ".." && $file != "custom.sh" && $file != "multi-list.txt") {
				if(strpos($file, '.txt') !==FALSE || strpos($file, '.htm') !==FALSE) {$type = "page";}
				else if(strpos($file, '.jp') !==FALSE || strpos($file, '.png') !==FALSE || strpos($file, '.gif') !==FALSE || strpos($file, '.bmp') !==FALSE) {$type = "image";}
				else {$type = "page";}

				echo $type . " "; if($use_https == "true") {echo "https://";} else {echo "http://";} echo $_SERVER['SERVER_NAME'] . $wdir . "data/uploads/" . $networkname . "/" . $file . "\n";
			}
		}
	}
}

echo "#bogus2 " . rand(1000000000, 9999999999) . "\n";
}

else if($xmlp->robindash->captivename == "coova" || $xmlp->robindash->captivename == "wifirush") {
?>
#@#config chilli
agent.service <?php echo $xmlp->chilli->agent_service . "\n"; ?>
agent.radiusserver1 <?php echo $xmlp->chilli->agent_radiusserver1 . "\n"; ?>
agent.radiusserver2 <?php echo $xmlp->chilli->agent_radiusserver2 . "\n"; ?>
agent.uamserver <?php echo $xmlp->chilli->agent_uamserver . "\n"; ?>
agent.uamurl <?php echo $xmlp->chilli->agent_uamurl . "\n"; ?>
agent.uamsecret <?php echo $xmlp->chilli->agent_uamsecret . "\n"; ?>
agent.radiussecret <?php echo $xmlp->chilli->agent_radiussecret . "\n"; ?>
agent.radiusnasid <?php echo $xmlp->chilli->agent_radiusnasid . "\n"; ?>
agent.admusr <?php echo $xmlp->chilli->agent_admusr . "\n"; ?>
agent.admpwd <?php echo $xmlp->chilli->agent_admpwd . "\n"; ?>
agent.uamurlextras <?php echo $xmlp->chilli->agent_uamurlextras . "\n"; ?>
agent.uamdomain <?php echo $xmlp->chilli->agent_uamdomain . "\n"; ?>
agent.custom1 <?php echo $xmlp->chilli->agent_custom1 . "\n"; ?>
agent.custom2 <?php echo $xmlp->chilli->agent_custom2 . "\n"; ?>
agent.custom3 <?php echo $xmlp->chilli->agent_custom3 . "\n"; ?>
<?php
if($xmlp->robindash->captivename == "wifirush") {echo "agent.macpasswd " . $xmlp->chilli->agent_macpasswd . "\n";}
}

else if($xmlp->robindash->captivename == "wifidog") {
?>
#@#config wifidog
<?php
if(strlen($xmlp->wifidog->gateway_TrustedMACList) > 12) {echo "gateway.TrustedMACList " . $xmlp->wifidog->gateway_TrustedMACList . "\n";}
?>
MainAuthServer.Hostname <?php echo $xmlp->wifidog->MainAuthServer_Hostname . "\n"; ?>
MainAuthServer.SSLAvailable <?php echo $xmlp->wifidog->MainAuthServer_SSLAvailable . "\n"; ?>
MainAuthServer.Path <?php echo $xmlp->wifidog->MainAuthServer_Path . "\n"; ?>
SecAuthServer.Hostname <?php echo $xmlp->wifidog->SecAuthServer_Hostname . "\n"; ?>
SecAuthServer.SSLAvailable <?php echo $xmlp->wifidog->SecAuthServer_SSLAvailable . "\n"; ?>
SecAuthServer.Path <?php echo $xmlp->wifidog->SecAuthServer_Path . "\n"; ?>
<?php
}
?>
#@#config general
services.ntpd_srv <?php echo $xmlp->general->services_ntpd_srv . "\n"; ?>
services.upstream <?php echo $xmlp->general->services_upstream . "\n"; ?>
services.name_srv <?php echo $xmlp->general->services_name_srv . "\n"; ?>
services.upgd_srv <?php echo $xmlp->general->services_upgd_srv . "\n"; ?>
services.base_test <?php echo $xmlp->general->services_upgd_srv . "\n"; ?>
services.base_beta <?php echo $xmlp->general->services_upgd_srv . "\n"; ?>
services.cstm_srv <?php echo $xmlp->general->services_cstm_srv . "\n";

if(strpos($xmlp->general->services_updt_srv, $sn) !==FALSE) {echo "";}
else if($xmlp->general->services_updt_srv == "") {echo "";}
else {echo "services.updt_srv " . $xmlp->general->services_updt_srv . "\n";}
?>
#@#config iprules
filter.LAN_BLOCK <?php echo $xmlp->iprules->filter_LAN_BLOCK . "\n"; ?>
filter.LAN_BLOCK2 <?php echo $xmlp->iprules->filter_LAN_BLOCK2 . "\n"; ?>
filter.AP1_bridge 0
filter.AP1_isolation 0
filter.AP2_bridge 0
filter.AP2_isolation 0
filter.port_block <?php echo $xmlp->iprules->filter_port_block . "\n"; ?>
filter.SMTP_rdir <?php echo $xmlp->iprules->filter_SMTP_rdir . "\n"; ?>
filter.SMTP_dest <?php echo $xmlp->iprules->filter_SMTP_dest . "\n"; ?>
filter.SMTP_block <?php echo $xmlp->iprules->filter_SMTP_block . "\n"; ?>
filter.enable_log <?php echo $xmlp->iprules->filter_enable_log . "\n"; ?>
filter.log_server <?php echo $xmlp->iprules->filter_log_server . "\n"; ?>
#@#config madwifi
priv.rate <?php echo $xmlp->madwifi->priv_rate . "\n"; ?>
priv.distance <?php if(strlen($xmlp->madwifi->priv_distance) > 2) {echo $xmlp->madwifi->priv_distance;} else {echo "2100";} echo "\n"; ?>
#@#config nodes
<?php
if(file_exists($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml")) {
	$xmlstring = simplexml_load_file($dir . "data/uploads/". $networkname ."/" . $networkname . "_nodes.xml");
	$no_of_nodes = "0";

	foreach($xmlstring->node as $node) {
		if(file_exists($dir . "data/role/" . base64_encode($node->mac) . ".txt")) 
		{echo file_get_contents($dir . "data/role/" . base64_encode($node->mac) . ".txt");}
		else {echo "R";}

		echo " " . $node->ip . " " . str_replace(" ", "*", $node->name) . " " . $node->mac . "\n";
		$no_of_nodes = $no_of_nodes + 1;
	}
}
?>
#@#config management
enable.https <?php if($has_https == "true") {echo "1\n";} else {echo "0\n";} ?>
enable.update_rate <?php

if($no_of_nodes > 150) {echo "30";}
else if($no_of_nodes > 100) {echo "20";}
else if($no_of_nodes > 75) {echo "15";}
else if($no_of_nodes > 50) {echo "10";}
else {echo "5";}

echo "\n";
?>
enable.upgrade_f <?php echo $xmlp->management->upgrade_f . "\n"; ?>
enable.upgrade_t <?php echo $xmlp->management->upgrade_t . "\n"; ?>
enable.ap2hidden <?php echo $xmlp->management->enable_ap2hidden . "\n"; ?>
enable.freeze_version <?php echo $xmlp->management->freeze_version . "\n"; ?>
enable.wake_slowly <?php echo $xmlp->management->enable_wake_slowly . "\n"; ?>
enable.local_domain <?php echo $xmlp->management->enable_local_domain . "\n"; ?>
enable.stand_alone_mode <?php echo $xmlp->management->stand_alone_mode . "\n"; ?>
enable.country_code <?php echo $xmlp->management->enable_country_code . "\n"; ?>
enable.transparent_bridge 0
enable.rootpwd <?php echo $xmlp->management->enable_rootpwd . "\n"; ?>
enable.gmt_offset <?php echo $xmlp->management->enable_gmt_offset . "\n"; ?>
enable.public_dns <?php echo $xmlp->management->enable_public_dns . "\n"; ?>
enable.sag_mode_interval <?php echo $xmlp->management->sag_mode_interval . "\n"; ?>
enable.strict_mesh <?php echo $xmlp->management->enable_strict_mesh . "\n"; ?>
enable.force_reboot <?php
$fr = $xmlp->management->enable_force_reboot;
$fr_date = $xmlp->management->enable_force_reboot_date;
$fr_time = $xmlp->management->enable_force_reboot_time;

if($fr == "1") {echo $fr_date . "@" . $fr_time . "\n";}
else {echo "never" . "\n";}
?>
enable.custom_update 1
enable.base trunk
#@#config mesh
ap.up <?php echo $xmlp->mesh->ap_up . "\n"; ?>
Myap.up <?php echo $xmlp->mesh->Myap_up . "\n"; ?>
ap.psk <?php echo $xmlp->mesh->ap_psk . "\n"; ?><?php echo "mesh configuration\n"; ?>
#@#config node
general.net <?php echo $xmlp->node->general_net . "\n"; ?>
#@#config radio
channel.default <?php echo $xmlp->radio->channel_alternate . "\n"; ?>
channel.alternate <?php echo $xmlp->radio->channel_alternate . "\n"; ?>
channel.current <?php echo $xmlp->radio->channel_alternate . "\n"; ?>
#@#config secondary
backend.update 0
backend.server 
backend.ssl 0
#@#config flags
<?php
if(file_exists($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml")) {
	$xmlstring = simplexml_load_file($dir . "data/uploads/". $networkname ."/" . $networkname . "_nodes.xml");
	$no_of_nodes = "0";

	foreach($xmlstring->node as $noderestart) {
		if($_GET['mac'] == $noderestart->mac) {
			$reboot_flag = $noderestart->reboot;
			// BOF Upadate Reboot Node zero
			if($reboot_flag == "1")
			{
			$reboot_node = $_GET['mac'];
			$dom = new DOMDocument;
			$dom->load($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml");
			$xpath = new DOMXPath($dom);
			
			$seats = $xpath->query("//node/reboot[@id='$reboot_node']");
			
				if ($seats->length) {
					foreach ($seats as $seat) {		
					
						 $seats->item(0)->nodeValue = 0 ;
					
						 $dom->save($dir . "data/uploads/" . $networkname ."/". $networkname . "_nodes.xml");
								 
						
					}
				}
			} 
			//EOF Upadate Reboot Node zero
		}
		$no_of_nodes = $no_of_nodes + 1;
	}
}
?>
restart.system <?php echo $reboot_flag . "\n"; ?>
#@#config wireless
private.ssid <?php echo $xmlp->wireless->private_ssid . "\n"; ?>
public.ssid <?php
if($xmlp->robindash->usenodename == 1) {
	$xmln = simplexml_load_file($dir . "data/uploads/". $networkname . "/" . $networkname . "_nodes.xml");

	foreach($xmln->node as $node) {
		if($_GET['ip'] == $node->ip && $_GET['mac'] == $node->mac) {
			if(!strlen($node->name)) {echo str_replace(" ", "*", $xmlp->wireless->public_ssid);}
			else {echo str_replace(" ", "*", $node->name);}
		}
	}
}
else {echo $xmlp->wireless->public_ssid;}
echo "\n";
?>
public.hidden <?php echo $xmlp->wireless->public_hidden . "\n"; ?>
private.key <?php echo $xmlp->wireless->private_key . "\n"; ?>
public.key <?php echo $xmlp->wireless->public_key . "\n"; ?>
<?php
if($xmlp->secondary->pomade_enabled == "1") {
?>
#@#config pomade
server.host <?php echo $xmlp->secondary->pomade_server . "\n"; ?>
server.private_lan <?php echo $xmlp->secondary->pomade_privatelann . "\n"; ?>
server.https <?php echo $xmlp->secondary->pomade_https . "\n"; ?>
server.mode <?php echo $xmlp->secondary->pomade_mode . "\n"; ?>
server.is_cstm_srv <?php echo $xmlp->secondary->pomade_cstmserver . "\n"; ?>
client.enabled <?php echo $xmlp->secondary->pomade_enabled . "\n"; ?>
client.private_cfg <?php echo $xmlp->secondary->pomade_privatecfg . "\n"; ?>
client.on_err_ignore <?php echo $xmlp->secondary->pomade_errorhandling . "\n"; ?>
<?php
}

if(is_dir($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/") && file_exists($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/staticcheckbox.txt")) {
	$sc = file_get_contents($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/staticcheckbox.txt");
	
	if($sc == "runmode") {
		echo "#@#config installation\n";
		echo "node.run_mode " . file_get_contents($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/node.run_mode.txt");
	}
	else if($sc == "gatewaystatic") {
		echo "#@#config installation\n";
		$role = file_get_contents($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/node.predef_role.txt");
		
		if($role == "-1") {echo "node.predef_role -1\n";}
		else {

			echo "node.predef_role " . $role . "\n";
			echo "gw.ipaddr " . file_get_contents($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/gw.ipaddr.txt") . "\n";
			echo "gw.netmask " . file_get_contents($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/gw.netmask.txt") . "\n";
			echo "gw.defroute " . file_get_contents($dir . "data/pnc/" . base64_encode($_GET['mac']) . "/gw.defroute.txt") . "\n";
		}
	}
	else {echo "";}
}
}
?>

Open in new window

Ok you are going to have to do some debugging on your part
Use memory_get_peak_usage(false) and see if you can find where/what is consuming the memory - best place to start would be the block referenced by your error above (line 1286)
Just echo out the value of memory_get_peak_usage(false) inside the loop and see what is happening.
It could be the garbage collection is not running fast enough to keep up with your site ergo lots of memory is being retained in use even when it is not needed.
The solution may be as simple as just nulling some of your variables once you are finished with them

p.s.
Use the code tag when pasting code (especially when it is thousands of lines long)
ASKER CERTIFIED SOLUTION
Avatar of Stilmon
Stilmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nice catch, never noticed you were on 32bit.
Avatar of Stilmon

ASKER

thank you for the help
You should still look at what is causing the problem, using 64bit is only covering the error up since you now have access to the full 6Gb of memory whereas before you only had 2Gb
Avatar of Stilmon

ASKER

apache is using about 500mb of memory total.
Ok, good luck.
Avatar of Stilmon

ASKER

64 bit version fixed the issue