PHP - Moved: Need Help To Create Captive Portals Using Iptables Rules On Ubuntu
This topic has been moved to Linux.
http://www.phpfreaks.com/forums/index.php?topic=307024.0 Similar TutorialsHello. Sorry if this is not the correct place to post this but, I'm looking to create this with php but, need some help. I would like to add a captive portal to my network. I've read about some that are out there but, they are not customisable to really accomplish what I need. I'm here to see if I can get some ideas from you guys. This is what I'm trying to accomplish. Simply show a splash page every certain time, let's say every four hours, the client would just press a button or a link and just redirect to the page the user intended to visit and just keep track of whos online using the Internet. I've used NoCat and it works well but, is written in Perl. I have some php scripts that I would like to use with it but, haven't find a way to do it. I noticed Nocat listens on a certain port writes an iptable rule marking packets with mangle table from the client's ip address, after a certain time it deletes the rule for that address forcing the ip to "re-authenticate" again showing the splash page. Any suggestions on how can this be done? Thanks in advanced for your help. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=322565.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=353241.0 NOTE - Please read the information first as it contains important information to understand the problem. Rules → • There are 9 Columns(C1,C2,C3,C4,C5,C6,C7,C8,C9) [ Max columns will be 9] • The number of Rows can vary from 3,6,9,12,15,18 (Max). In this case Number of Rows shall be 12 Number of Rows = No of Tickets (Max Allowed 6) x Rows Per Ticket (Max Allowed 3). Thus, Max Rows can be 18 • Each Row is required to have 4 Blank Spaces and 5 Filled with Numbers • All numbers available in the Column Array have to be utilized • This configuration of an shall create a matrix of 9 Columns & 12 Rows (3 x 4 Tickets), which is 108 MATRIX BLOCKS where only a maximum of 60 numbers can be filled out of 108 available blocksrandomly with the above conditions being met 100%. • The numbers in column must be arranged / sorted in ASCENDING ORDER (For coding logic purpose, as soon as the number is assigned to the new MATRIX MAP use array_shift() or unset() the number so as to avoid repetition Example - Row 1 and Column 1 shall generate a MATRIX BLOCK - R1C1 Row 3 and Column 7 shall generate a MATRIX BLOCK - R3C7 Matrix Block can also be termed as Matrix Cell for your ease (if needed) MASTER SET OF ARRAY WITH NUMBERS array( "C1"=> array( 1, 2, 3, 5, 6, 7, 9 ), //7 Numbers "C2"=> array( 13, 14, 15, 17, 18, 19 ), //6 Numbers "C3"=> array( 21, 22, 23, 24, 25, 26, 30 ), //7 Numbers "C4"=> array( 31, 33, 34, 36, 37, 38, 39 ), //7 Numbers "C5"=> array( 41, 42, 46, 47, 48, 49, 50 ), //7 Numbers "C6"=> array( 51, 52, 53, 54, 55, 57, 58 ), //7 Numbers "C7"=> array( 61, 62, 64, 65, 69, 70 ), //6 Numbers "C8"=> array( 71, 74, 75, 76, 77, 78 ), //6 Numbers "C9"=> array( 82, 83, 85, 87, 88, 89, 90 ) //7 Numbers ); The above array has 60 Numbers to be filled out of 108 MATRIX BLOCK / CELL which meets the condition that for a FULL BLOCK containing 4 MINI BLOCKS WITH 3 ROWS (max. allowed) EACH I have been able to generate this without any issue meeting all the conditions of the Columns My Allocation Matrix Array will look like array( "R1"=> array( "C1"=> true, // Means that MATRIX BLOCK R1C1 will be NOT EMPTY "C2"=> false, // Means that MATRIX BLOCK R1C2 will be EMPTY "C3"=> true, "C4"=> false, "C5"=> true, "C6"=> false, "C7"=> true, "C8"=> true, "C9"=> false ), "R2"=> array( "C1"=> false, "C2"=> true, "C3"=> false, "C4"=> true, "C5"=> false, "C6"=> true, "C7"=> true, "C8"=> true, "C9"=> false ), "R3"=> array( "C1"=> true, "C2"=> true, "C3"=> true, "C4"=> true, "C5"=> false, "C6"=> false, "C7"=> false, "C8"=> false, "C9"=> true ), "R4"=> array( "C1"=> true, "C2"=> true, "C3"=> true, "C4"=> false, "C5"=> true, "C6"=> true, "C7"=> false, "C8"=> false, "C9"=> false ), "R5"=> array( "C1"=> false, "C2"=> false, "C3"=> false, "C4"=> false, "C5"=> true, "C6"=> true, "C7"=> true, "C8"=> true, "C9"=> true ), "R6"=> array( "C1"=> true, "C2"=> true, "C3"=> false, "C4"=> true, "C5"=> false, "C6"=> true, "C7"=> false, "C8"=> false, "C9"=> true ), "R7"=> array( "C1"=> false, "C2"=> false, "C3"=> true, "C4"=> false, "C5"=> true, "C6"=> false, "C7"=> true, "C8"=> true, "C9"=> true ), "R8"=> array( "C1"=> true, "C2"=> false, "C3"=> false, "C4"=> true, "C5"=> false, "C6"=> false, "C7"=> true, "C8"=> true, "C9"=> true ), "R9"=> array( "C1"=> true, "C2"=> false, "C3"=> true, "C4"=> false, "C5"=> true, "C6"=> true, "C7"=> false, "C8"=> false, "C9"=> true ), "R10"=> array( "C1"=> false, "C2"=> true, "C3"=> true, "C4"=> true, "C5"=> true, "C6"=> false, "C7"=> true, "C8"=> false, "C9"=> false ), "R11"=> array( "C1"=> false, "C2"=> true, "C3"=> false, "C4"=> true, "C5"=> true, "C6"=> true, "C7"=> false, "C8"=> true, "C9"=> false ), "R12"=> array( "C1"=> true, "C2"=> false, "C3"=> true, "C4"=> true, "C5"=> false, "C6"=> true, "C7"=> false, "C8"=> false, "C9"=> true ) ); In the above array R stands for Row, C for Column, TRUE/FALSE (Boolean) means that if TRUE a Number can be filled in the resulting MATRIX BLOCK / CELL ( Row[Number]Column[Number] ) else if FALSE the MATRIX BLOCK / CELL shall be EMPTY The result for the above shall be
PROBLEM : I am unable to understand what should possibly be the logic & loop used here for creating a MATRIX ALLOCATION MAP as shown above I have tried while, foreach & for but unable determine the perfect combination which would meet the conditions. (Tried all of the above with Nested Loops also) Edited May 1, 2020 by AlphaMikeTags I've been playing around with C and C++ on my Ubuntu machine. I tried it once on Windows and I didn't have a good experience because I didn't like using the Visual Studio. I like to write code, so really prefer a text editor over an IDE.
This weekend I found that it is super easy to write and run C and C++ programs on Ubuntu. GCC was already installed, and after installing G++ I could compile C++ programs easily. I just used my text editor, which is all I really want to use.
The only thing I was struggling with, and it could be the reason why I may need an IDE, is debugging. The error messages that GCC and G++ are giving are not very awesome, and sometimes I would compile the program without error, just to find that it gives a "segmentation fault" or other errors that offer no information.
So am I forced to learn and use an IDE, or are there debugging tools I should use instead? If you don't use an IDE, what do you use, and how do you debug?
Please tell me how to connect php and mysql in ubuntu 14.04
I've been doing a lot of studying of Linux lately. I enabled the root acount to do some work. When done, even if I logout, close the terminal, or reboot, I can still access the root account without supplying the root password. So what am I not understanding or what am I doing wrong? I don't really need to disable the root account, but this is just a learning experience, and I'm not understanding why I still have access. See below:
# I needed to enable root access for something
skunkbad:~$ sudo passwd root
# I did what I needed to do
skunkbad:~$ sudo -i
root@ubuntu-Inspiron-3647:~#
# I logout from root
root@ubuntu-Inspiron-3647:~# logout
# I disable the root access per instructions from many internet references
skunkbad:~$ sudo passwd -dl root
# Root access is still available, even if I close and reopen the terminal
skunkbad:~$ sudo -i
# I logout from root
root@ubuntu-Inspiron-3647:~# logout
# Trying to access root via su prompts for password, and old password is wrong
skunkbad:~$ su
Password:
su: Authentication failure
Code: [Select] <?php $myServer = "<remote ip>"; $myUser = "<username>"; $myPass = "<password>"; $myDB = "FAP2"; //create an instance of the ADO connection object $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); ?> No error messages reported, but page "dies" at this point. The ubuntu machine can see the sql machine, but yet this is happening. My setup: (everything on a local network) Web server: Ubuntu Server 8.10 -- Workgroup File server: Windows Server 2008 x64 -- domain Test server: Win 2000 running WAMP -- domain I'm trying to run the code snippet below. $file is a file on the File server above. It definitely exists. Running the code below on the Test server works perfectly. But the file cannot be found when running from the Web server. $file = '//server/share/file.txt'; if (file_exists($file)) echo 'yay!'; else echo 'error'; What with the safe mode considerations, I've also tried to add: ini_set('safe_mode', 'Off'); to no effect. And since file, and fopen similarly not work, I'm pretty sure it's not that either. The File & Test servers are on the same Windows domain, but that's definitely not the reason. I tried the code on a file on a Linux computer in the Workgroup (where the Web server is) with the same results: Test server works, Web server does not. Please advise; I'm really lost. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=352032.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=359282.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=334031.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=313625.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321735.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=355753.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=355885.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314453.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=349578.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=318572.0 Hi,
can anyone tell me what im doing wrong. below is a rewrite rule saved as .htaccess. the page loads and i dont get a 500 error but the url didnt change like it should have in the rewrite rule. The .htaccess is located in the root folder. Any idea what i'm doing wrong guys? <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^products/$ view/inventory.php </IfModule> |