
landysaccount
Members-
Posts
42 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
landysaccount's Achievements

Member (2/5)
0
Reputation
-
Hello. I don't know if this is the right place to ask about this issue, if is not then, please apologize. I have a small WISP in my town and I would like to offer free internet service at coffee shops, restaurant, and other public places but, this free service will have its limitations: All pages would have an advertisement or promotion on top just like NetZero used to do in the past. I think this is done with frameset but, don't know how to force this for all the pages. I would like to do this with php/mysql and if the user tries to remove the frame then maybe redirect them to pay per hour/day etc... I have a linux gateway that runs squid and would like certain ip addresses (free ones) to view pages with this promo on top or even have pop ups from time to time whichever is easier. Can you please provide any suggestions? Thanks in advanced for your help.
-
redirect connection with sockets???
landysaccount replied to landysaccount's topic in PHP Coding Help
Thanks for replying. I'm running this daemon/server listening on a certain port waiting for iptables to redirect traffic to it: iptables -t nat -A PREROUTING -i eth0 -p tcp \ -s 172.16.0.0/16 --sport $UNPRIVPORTS --dport 80 \ -j REDIRECT --to-port $daemonport Now, the daemon recieves this request and redirects (or maybe do authentication on its own) to another script in the same box that will do the authentication. Based on the credentials it would add an iptables rule to allow the client to the internet and to the page the user intended to before the redirection. Now, the problem is how can I get the intended address when iptables redirects it to the daemon? I've tried: '<meta HTTP-EQUIV="REFRESH" content="0; url=http://172.16.0.1/index2.php?requested=' .$_SERVER["QUERY_STRING"] . '&referer='. $_SERVER["HTTP_REFERER"] . '&uri='. $_SERVER["REQUEST_URI"] . '">'; and none of these are set. There might be a trick to get it. Your help is appreciated. Thanks. -
In login.php check if username is set: if( isset($_REQUEST['username'] ) && $_REQUEST['username'] == '' ){ echo "No username"; }
-
redirect connection with sockets???
landysaccount replied to landysaccount's topic in PHP Coding Help
I thought I almost had this resolved but I'm hitting a wall. I'm currently testing doing a redirect with iptables to the port the socket script/daemon is listening on. This script will be doing user authentication, add some iptables rules, and saving some info to db. Now, I would like to know the address and uri request the user was trying to go to before it was redirected. I can't get it. Please guide me. Thanks for your time. -
redirect connection with sockets???
landysaccount replied to landysaccount's topic in PHP Coding Help
After testing, I notice it works with IE8, and Mozilla but, not with Chrome. I just get this as plain text on the brower: <meta http-equiv="content-type" content="text/html; charset=windows-1250" /><meta name="generator" content="PSPad editor, www.pspad.com" /><meta http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT" /><meta http-equiv="Cache-Control" content="no-cache; must-revalidate" /><meta HTTP-EQUIV="REFRESH" content="0; url=http://www.cnn.com"> Don't know why? -
redirect connection with sockets???
landysaccount replied to landysaccount's topic in PHP Coding Help
I think I got a socket redirect the client to a different page like this: $output = '<meta http-equiv="content-type" content="text/html; charset=windows-1250" />' . '<meta name="generator" content="PSPad editor, www.pspad.com" />' . '<meta http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT" />' . '<meta http-equiv="Cache-Control" content="no-cache; must-revalidate" />'. '<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.cnn.com">'; socket_write($spawn, $output, strlen ($output)) or die("Could not write output\n"); -
Hello. This is a follow up on a previous thread. I'm trying to redirect a socket connection via browser to another script or page but, I'm having a lot of problems trying to do it. I don't know if it can be done. Please guide me to where I can get some input on it. I've google about it and nothing exactly... The socket file looks like this: $host = "172.16.0.3"; $port = "200"; // don't timeout! set_time_limit(0); // create socket $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP ) or die("Could not create socket\n"); // bind socket to port $result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n"); // start listening for connections $result = socket_listen($socket, 3) or die("Could not set up socket listener\n"); while( true ){ // accept incoming connections // spawn another socket to handle communication $spawn = socket_accept($socket) or die("Could not accept incoming connection\n"); // read client input $input = socket_read($spawn, 1024) or die("Could not read input\n"); // clean up input string $input = trim($input); // reverse client input and send back $output = strrev($input) . "\n"; header('Location: http://www.cnn.com/'); $output = "hello there.. you're connected"; socket_write($spawn, $output, strlen ($output)) or die("Could not write output\n"); } // close sockets socket_close($spawn); socket_close($socket); ?> I put in the browser's addr bar: http://172.16.0.3:200 and get "hello there.. you're connected"... Can it be done?? Any suggestions? Thanks in advanced for your help.
-
suggestions to create a captive portal from scratch
landysaccount replied to landysaccount's topic in PHP Coding Help
I was thinking of running a php script listening on a port running on a socket to rewrite the iptables rules but, can't think of how to actually do it I'm short on ideas. Never used php sockets before so dont know how that would work. Any suggestions would be apreciated. Thanks. -
You can try this: function getIp(){ if ( $_SERVER["HTTP_CLIENT_IP"] ) $ip = $_SERVER["HTTP_CLIENT_IP"]; else if( $_SERVER["HTTP_X_FORWARDED_FOR"] ) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; else if( $_SERVER["REMOTE_ADDR"] ) $ip = $_SERVER["REMOTE_ADDR"]; else $ip = "UNKNOWN"; return $ip; } Hope it helps.
-
Hello. 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.
-
I've tried full directory path already and is not working. I'm using apache2 with php5 on debian etch.
-
Hello. I am having problems with mkdir. I've read some previous posts and have done some of what others have done but, I can't get it to work. Here's what I'm trying to do: echo mkdir( "./Dec2009", 0777, true ) ? "Success" : "Fail"; It always fails. Don't know why. I have SafeMode = Off just to test this but is not working. I also have the entire directory owned by www-data. Thanks in advanced for your help.
-
[SOLVED] Help with foreign key error 1005
landysaccount replied to landysaccount's topic in MySQL Help
Solved the problem. Found out more information on the error by executing: SHOW ENGINE INNODB STATUS That guided me to notice that the table name survey_answer was misspelled so, there wasn't a match. How stupid that was. -
[SOLVED] Help with foreign key error 1005
landysaccount replied to landysaccount's topic in MySQL Help
I read this post: http://www.phpfreaks.com/forums/index.php/topic,274744.0.html but, still can't find help. Even read the http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html and followed the suggestions but, still can't get it right. -
Hello. I'm trying to test something I read in a book but, I'm getting an error and can't figure out where is the mistake. I get error 105/1005 cant' create table survey_responses. Here's my sql script: create table survey_question( quest_id int(3) unsigned not null auto_increment, question varchar(80) not null, primary key( quest_id ) ) engine=innodb; /* Survey answers */ create table survey_anwers( ans_id int(3) unsigned not null auto_increment, quest_id int(3) unsigned not null, ans_text varchar(40) not null, primary key( ans_id ), foreign key( quest_id ) references survey_question( quest_id ) ) engine=innodb; /* Survey responses */ create table survey_responses( resp_id int(10) unsigned not null auto_increment, quest_id int(3) unsigned not null, ans_id int(3) unsigned not null, primary key ( resp_id ), foreign key( quest_id ) references survey_question( quest_id ), foreign key( ans_id ) references survey_answers( ans_id ) ) engine=innodb; Both foreign keys are of the same type and size... What am I doing wrong? Thanks in advanced for your help.