Why would you expect that to be true? $customers is either an array or false, and $hostname is a string. Perhaps you mean to fetch on $customers['somefieldhere']? Using extract is unwise as well; if any of those fields happen to be 'customers', than the entire loop could become infinite. Avoid using extractions.
You have a few redundant braces around as well. These won't actually harm the processing instructions, but does make readability more difficult when you don't have any indentation in the code.
And I should note now, that as of 5.5 MySQL library is now officially deprecated (yay). You should convert to MySQLi or PDO instead.
What is this supposed to actually do? - You mention url locking and then in there you're using cURL but I don't see anything that refers to any sort of 'lock'.
Secondly, your code formatting makes it hard to read. There is a link in my signature about coding styles - you might like to take a look. Why? Because when you're asking others to help you, it helps us if we can actually read your code, understand what part of the code relates to what if conditional etc. If not, it makes it rather difficult to follow the logic flow.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Why would you expect that to be true? $customers is either an array or false, and $hostname is a string. Perhaps you mean to fetch on $customers['somefieldhere']? Using extract is unwise as well; if any of those fields happen to be 'customers', than the entire loop could become infinite. Avoid using extractions.
You have a few redundant braces around as well. These won't actually harm the processing instructions, but does make readability more difficult when you don't have any indentation in the code.
And I should note now, that as of 5.5 MySQL library is now officially deprecated (yay). You should convert to MySQLi or PDO instead.
How would I extract the data correctly and use the strings from the extracted data, to you know. Hard to explain you know what I'm trying to do though >_>.
I will try PDO later on, firstly I need to get this working
None of that worked, besides that part I made was fine, it's just the url locking I need help with, if you could help me with that then that'll be great
How would I extract the data correctly and use the strings from the extracted data, to you know. Hard to explain you know what I'm trying to do though >_>.
I will try PDO later on, firstly I need to get this working
Assign them manually. You know the field names, set the variables up to reflect them. extract is *almost* as dangerous as register_globals is.
Not sure why you think that will fix anything. As is you can never issue an output for a request being sent since its blocked into an elseif compared only to method of "A". A better approach is to simply clean it up. I presume that the $_GET['m'] isn't actually valid as you have in the first if block; nowhere is $_GET['m'] ever used.
$sUrl = 'http://serverip/request.php?' . $sQrystr; if (false !== ($ch = curl_init($sUrl))) { $rtm = curl_setopt($ch,CURLOPT_TIMEOUT,1); if (curl_exec($ch)) { // was successfully *sent* } } else { // could not establish a server connection } }
You can also use a check for the $method to verify it matches one of 'S', 'C' or 'A', I didn't bother in this one. Untested but works okay in my head.
Assign them manually. You know the field names, set the variables up to reflect them. extract is *almost* as dangerous as register_globals is.
Not sure why you think that will fix anything. As is you can never issue an output for a request being sent since its blocked into an elseif compared only to method of "A". A better approach is to simply clean it up. I presume that the $_GET['m'] isn't actually valid as you have in the first if block; nowhere is $_GET['m'] ever used.
$sUrl = 'http://serverip/request.php?' . $sQrystr;
if (false !== ($ch = curl_init($sUrl)))
{
$rtm = curl_setopt($ch,CURLOPT_TIMEOUT,1);
if (curl_exec($ch))
{
// was successfully *sent*
}
}
else
{
// could not establish a server connection
}
}
You can also use a check for the $method to verify it matches one of 'S', 'C' or 'A', I didn't bother in this one. Untested but works okay in my head.
No offense but could you please help me fix the hostname locking error.
I know everything else works, I just need help fixing my project.
No offense but could you please help me fix the hostname locking error.
I know everything else works, I just need help fixing my project.
As Tango pointed out, you still haven't defined what you mean by "locking". Perhaps you are trying to send multiple requests and are attempting to open multiple curl sessions? You'll probably need to close your current one first (via curl_close). Otherwise, I'm not sure what you mean by locking either :/
As Tango pointed out, you still haven't defined what you mean by "locking". Perhaps you are trying to send multiple requests and are attempting to open multiple curl sessions? You'll probably need to close your current one first (via curl_close). Otherwise, I'm not sure what you mean by locking either :/
When I ment locking I mean Hostname locking as a whitelist the only domains/hostname i want to be able to send the request is hosts in the customers table. Did that clear up things?
Nope, that doesn't clear it up. Is that related to my comparison check I put in the first reply? Also, $customers would result in false where you have it there since its located outside of the loop.
Nope, that doesn't clear it up. Is that related to my comparison check I put in the first reply? Also, $customers would result in false where you have it there since its located outside of the loop.
Could you fix that for me? maybe it'll work. Keep it simple though.
Not really, I'm not sure exactly what you are trying to do here. Are you trying to connect to a field set for each customer? I'm not sure why you are checking the $_SERVER's SERVER_NAME if that were the case though.
When I ment locking I mean Hostname locking as a whitelist the only domains/hostname i want to be able to send the request is hosts in the customers table. Did that clear up things?
Not in the slightest.
Something about you have whitelist of domains are hosts in the table?
Re-read what you've written - it's really not very clear.
Perhaps you should start again by telling us step by step, what this project is and what it should do step by step
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.