Jump to content

apacheguy

Members
  • Posts

    108
  • Joined

  • Last visited

Everything posted by apacheguy

  1. Hi all, I recently transitioned to Apache 2.4 from 2.2. I'm looking to take advantage of mod_authz_dbd to replace my Basic Auth scheme I had in place before. Per the docs on this module (http://httpd.apache.org/docs/trunk/mod/mod_authz_dbd.html), I can execute a custom statement to log a user in like this: Trouble is, I want it to log the user IP address. Apache supposedly supports calling ENV VARS from with httpd.conf, but for some reason the following code does not work: It inserts %{REMOTE_ADDR} instead of the actual ip address value. Any idea how I can get this to work?
  2. Brilliant! I just made a few minor changes to your code, but it is finally where I want it to be. Your code had the images in 1 column with 3 rows, but I wanted that switched to 3 columns and 1 row. Here is the resulting CSS: <style media="screen" type="text/css"> /* <!-- */ body{ margin: auto; width: 100%; padding: auto; } #container{ width: 100%; height: auto; margin: auto; } #grid{ padding: 100px; margin: auto; } .grid-element{ width: 33%; display: inline-block; margin: auto; } a.clickable-div { display: block; height: 100%; width: 100%; text-decoration: none; } .img { height:auto; width:inherit; max-height:50%; max-width:50%; } .button { color: #900; font-weight: bold; font-size: 150%; text-transform: uppercase; display: block; width: 50%; } /* --> */ </style>
  3. Ok, first off CSS is definitely not my strong suit so bear with me here. This is my code: <style media="screen" type="text/css"> /* <!-- */ .clear{ clear:both; } #grid{ width: 100%; } .grid-element{ width:33%; float:left; } a.clickable-div { display: block; height: 100%; width: 100%; text-decoration: none; } .img { height:auto; width:inherit; max-height:100%; max-width:100%; } .button { color: #900; font-weight: bold; font-size: 150%; text-transform: uppercase; display: block; width: 50%; } /* --> */ </style> <div id="grid"><div class="grid-element" align="center"> <img src="images/light_offline.png" class="img"> <p><h1>Hue Lamp 1 </h1></div><div class="grid-element" align="center"> <a href="action.php?light=2&state=false"> <img src="images/light_off.png" class="img"></a> <p><h1>Hue Lamp 2 </h1></div><div class="grid-element" align="center"> <a href="action.php?light=3&state=false"> <img src="images/light_off.png" class="img"></a> <p><h1>Hue Lamp 3 </h1></div></div><p> <div align="center"> <form method="POST" action="action.php"> <input type="hidden" name="scene" value="02b12e930-off-0"> <input type="submit" value="Scene 1" class="button"> </form> <p><form method="POST" action="action.php"> <input type="hidden" name="off"> <input type="submit" value="All Off" class="button"> </form> </div> This is the browser output. A couple things are wrong: 1. Why aren't the images scaling so they are all the same size? I assigned the same CSS class to each of the images but they are all appearing differently. The original images are all the same size. 2. Why are my buttons in the far right corner? I want to have them centered below the images so as to prevent the horizontal scroll bar, which I hate.
  4. Yep, the range column was the problem all along. Thanks! Shouldn't the error message engine be smart enough to have pointed out that I was using a reserved keyword? The lack of description in MySQL errors is frustrating, as there was no hint to what was causing the problem.
  5. Thanks for those replies. I removed $date from my query since it is already the default value for that column. No luck. Same error: Putting quotes around the values does not help either. Same error. Ugh
  6. I've banged my head enough trying to figure out this problem and have given up. I've inserted data into an SQL DB before without any problems. Not sure what's going on here. This is my code: $charge = function_read("vehicles/" . $status[0]['id'] . "/command/charge_state"); $miles = mysqli_real_escape_string($con, $charge['battery_range']); $battery_level = mysqli_real_escape_string($con, $charge['battery_level']); mysqli_query($con,"INSERT INTO battery (Date, Range, Percent, Sleep) VALUES ($date, $miles, $battery_level, 1)"); echo $con->error; This is the error message (completely worthless, IMHO). Could it be any less descriptive? MySQL table is configured as follows: Date timestamp CURRENT_TIMESTAMP Range decimal(5,2) Percent tinyint(3) Sleep tinyint(1) 0 Any ideas?
  7. Yeah, I was afraid of that. No, unfortunately I need to implement server-side Basic Auth (ie. not through a php script). The reason I wrote login.php was not to authenticate the users, but instead set a cookie and log the login to a database. Good idea, though!
  8. Hello, I am running Apache 2.2.24 and I want to configure the server to route all HTTP Basic Auth through a single php script. Take the directory structure below as an example: /htdocs/protected /htdocs/protected/image1.gif /htdocs/protected/index.html /htdocs/protected/login.php So, if the user tries to access image1.gif, they would be presented with a login prompt and, upon successful login, would be redirected through login.php, before being allowed to access image1. Is this possible? Thanks very much!
×
×
  • 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.