Jump to content

landysaccount

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by landysaccount

  1. 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.
  2. 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.
  3. In login.php check if username is set: if( isset($_REQUEST['username'] ) && $_REQUEST['username'] == '' ){ echo "No username"; }
  4. 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.
  5. 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?
  6. 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");
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. I've tried full directory path already and is not working. I'm using apache2 with php5 on debian etch.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. I beleive the /var/www/apache2/* directories should be owned by www-data user or user which apache or your webserver runs under.
  17. Ok. I understand that but I can't change it, Logically isn't this true: 1255662000 < 1255742769 The first one is the timestamp for 16-oct-2009 at 12:00am, the second one is a timestamp later that day. So, I guess I have to compare these value with php instead? I didn't want to go through all the records since there are over 3000 records in that table. It will take "some" time to go through the entire table. Any other idea?
  18. Hello. I have a table where I save a record and use time() for the timestamp. create table network_access( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, ip VARCHAR(15) NOT NULL, mac VARCHAR(17), timevisit INT(11) NOT NULL default '0', primary key ( id ) ); I'm trying to retreive all records or access for certain days, for ei., I would like to see today's, yesterday's, and so on access. $day = date( 'd' ); $month = date( 'n' ); $year = date( 'Y' ); $my_timestamp = mktime( 0, 0 , 0, $month, $day, $year ); // create 10/16/2009 at 12:00am I'm trying to retreive the records by doing: "select * from network_access order by timevisit > $my_timestamp" but, get all the records in the table. If I "select * from network_access order by timevisit > $my_timestamp" I get the same thing. How can I compare the timestamp values? Thanks in advanced for your help.
  19. Hello, I have a table with ip values: 172.16.100.10 172.16.100.11 ..... 172.16.100.50 172.16.100.51 .... 172.16.100.100 172.16.100.102 172.16.100.103 and so on.... I would like to get a list in ascending order: The ip_address field is a varchar(15); select ip_address as ip from ip where ip_assigned='N' order by ip limit 5; but I get: 172.16.100.10 172.16.100.100 172.16.100.101 172.16.100.102 172.16.100.103 How can I get a real sort in mysql? Thanks in advaced.
  20. If I do this it works: document.getElementById("Visual").style.background = "url( ./images/p130.jpg )"; I'm getting the same value with variable pic, tested using window.alert(pic), but somehow it does not like it and is not changing the pic. Any ideas?
  21. I'm trying this technique but, is not working: function changePic(){ var pic = getPic(); document.getElementById("Visual").style.background = "url( pic )"; return true; }// end function changePic
  22. Hello. I would like to know how can I use javascript to change a css property in a file. For example: I have a css file named styles with: #HEADER { height:130px; background-image: url(p142.jpg); background-repeat: no-repeat; background-color: #CCCCCC; border-top: 3px solid Black; } I would like the bg image to change randomly by calling a js function. I don't know how to do it since css and js are in different files. I have this in the index.php page: <script language="JavaScript"> function getPic(){ var pic = new Array(); pic[0] = "./images/temp.jpg"; pic[1] = "./images/p128.jpg"; pic[2] = "./images/p129.jpg"; pic[3] = "./images/p130.jpg"; pic[4] = "./images/p131.jpg"; pic[5] = "./images/p132.jpg"; pic[6] = "./images/p133.jpg"; pic[7] = "./images/p134.jpg"; pic[8] = "./images/p135.jpg"; pic[9] = "./images/p136.jpg"; pic[10] = "./images/p137.jpg"; pic[11] = "./images/p138.jpg"; pic[12] = "./images/p139.jpg"; pic[13] = "./images/p140.jpg"; pic[14] = "./images/p141.jpg"; pic[15] = "./images/p142.jpg"; rdm = Math.floor( Math.random() * pic.length ); return pic[ rdm ]; } // end getPic function .... .... .... .... <div id="HEADER"></div> How can this be done? Thanks in advanced for your help.
  23. Hello. Last weekend I requested help on how to sort a multidimension array; I was requested to look into array_multisort() but, after reading about this function I'm still not able to get the results I need. I currently have the following array that gets populated in a for loop: $data[$num_records]['cust_id'] = $row["eq_cust_id"]; $data[$num_records]['cust_name'] = $customer_name; $data[$num_records]['cust_mac'] = $row["eq_mac_address"]; $data[$num_records]['cust_ip'] = $cust_ip; $num_records++; array_multisort( $data[]['cust_ip'], SORT_NUMERIC); After the loop I would like to be able to sort the array by 'cust_name' or 'cust_ip' but, can't figure out how. Please help. Thanks in advanced.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.