Jump to content

musclehead

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

musclehead's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm trying to connect to a remote Postgresql DB w/ the following: RHEL 4 PHP 4.3.9 PostgreSQL(libpq) Version 7.4.19 When I attempt to do a simple pg_connect to the remote host, I'm getting the following in my error_log: PHP Warning: pg_connect(): Cannot create new link. Too many open links (0) I can connect to the database via CLI remotely using pgsql, so the connection to the database is fine and I can view data, etc. I'm new to the Postgresql world, so any advice would be of great assistance!
  2. I've been "Google-ing" around looking for a concise explanation of how to connect to an LDAP server using PHP, but I can't seem to get anything to work. I can successfully connect and bind anonymously to LDAP, but I can't get any farther than that. I'm simply trying to search for a username within LDAP and if it exists, return true - that's it! Can anyone help me out?
  3. Sorry for the delay in responding - problem had nothing to do w/ the code - permissions were not set correctly to instantiate a session in the first place, thus everything was getting lost. All is good now - thanks for your help!
  4. I have a bizzare session problem that I can't seem to figure out. I've used sessions a great deal in the past, and this is absolutely baffling me! I'm doing some very simple checks against a session variable to either alert the user or not. For some weird reason, when I refresh the page, the session variable is no longer set. I can't figure out why - it's simple enough. If the variable in the script itself is greater than the session variable (or if the session variable is not set at all), set the session variable and move on. On the reload of the script, if the original alert value has not incremented, nothing should happen. If it HAS gotten bigger, it should reset the session variable with the new value. <? session_start(); $alert = 0; while (...some condition...){ $alert += 1; } if (($alert > $_SESSION['alert']) || !isset($_SESSION['alert'])){ echo "<script>alert('something');</script>"; $_SESSION['alert'] = $alert; } ?> What am I missing?!?!?!
  5. Has anyone had any luck w/ creating a PHP page that authenticates using MS-CHAPv2 to a radius server? I don't see much for packages available (FC4)...
  6. I'm looking for a solution to password-protecting files and/or folders without using .htaccess. I have it setup currently w/ a basic authentication and session model. User "A" logs in and is redirected to the "protected" page w/ session handling to prevent users from getting their directly. However, I have PDF files linked from that protected page which could be easily linked to without logging in. Any ideas?
  7. Positive - I'm not getting any error messages, notices, nothing...it just simple doesn't appear, and I'm totally and completely stumped.
  8. Hi everyone...I'm sure this is a ridiculously-easy question, but I'm killing myself trying to figure it out. I have a date string field, let's say: $theDate = '12-25-2008'; When I echo that variable, it displays beautifully...however, when I try this: echo strtotime($theDate); I get nothing...absolutely nothing is printed on the page...I am completely and utterly stumped...someone cure my insanity/stupidity! Thanks!
  9. My head is spinning trying to figure out the correct syntax to do a regex to validate an IP address. I'm dealing w/ a /16 class network, so I only need to worry about the last 2 segments of the IP address and ensure they are valid (0-254). I have a simple comparison against the first 2 segments, as they will always be the same, but I'm trying to get a regular expression to check the last 2 segments of the IP address to ensure they're valid. I'd post code I've tried, but it's a mess...so I'll spare everyone the horror. Thanks!!!
  10. I'm looking for a way to determine the OS version via PHP. I'm using the HTTP_USER_AGENT stuff and getting OS and browser fine, but I need to specifically determine which version of MAC OS (i.e. 10.4, 10.5) is visiting the page. Anyone have any advice?
  11. That did the trick! I don't have any select items in the form, so the script was originally bailing on: var theSelects = obj.getElementsByTagName("select") var sel = theSelects.childNodes[i]; /getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&"; Commenting that out did the trick - works perfectly! Thanks for your help!
  12. This is the AJAX: var http_request = false; function makeRequest(url, parameters) { http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch(e){ try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch(e){} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open('GET', url + parameters, true); http_request.send(null); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { result = http_request.responseText; alert(result); } else { alert('There was a problem with the request.'); } } } function get(obj) { var getstr = "?"; for (i=0; i<obj.childNodes.length; i++) { if (obj.childNodes[i].tagName == "INPUT") { if (obj.childNodes[i].type == "text") { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } if (obj.childNodes[i].type == "checkbox") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } } if (obj.childNodes[i].type == "radio") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } } } if (obj.childNodes[i].tagName == "SELECT") { var sel = obj.childNodes[i]; getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&"; } } makeRequest('get.php', getstr); }
  13. I've successfully created a PHP form that submits and returns the checkbox values selected in the form via Ajax. The input tag is fairly simple: <form action="javascript:get(document.getElementById('myForm'));" name="myForm" id="myForm"> <input type="checkbox" name="cb1" value="one" /><br /> <input type="checkbox" name="cb2" value="two" /><br /> <input type="checkbox" name="cb3" value="three" /><br /> <input type="button" name="button" value="Submit" onclick="javascript:get(this.parentNode);"> </form> This works perfectly returning the value of the checkbox selected when the form is submitted (without refreshing the page). However, when I attempt to format the page (putting the inputs into a div or table), it stops working. I can't for the life of me figure out why. It works before formatting in Firefox and IE, but fails in both when the inputs are aligned at all. Can anyone shed some light on this? The
×
×
  • 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.