I'm making an LDAP call with PHP - pretty straightforward. I'm putting the results into an indexed array. I want to strip some numbers off one of the fields but can't figure out how to make substr() work in my array. Do I need to make an associative array instead? Is there a very simple solution and I'm just a moran?
― Miss Misery xox (MissMiseryTX), Tuesday, 23 May 2006 12:13 (nineteen years ago)
use print_r() on the array to see what it looks like. should then just be a matter of accessing via a[b][c][d]... to get at array element.
― koogs (koogs), Tuesday, 23 May 2006 12:30 (nineteen years ago)
― Miss Misery xox (MissMiseryTX), Tuesday, 23 May 2006 12:34 (nineteen years ago)
― JW (ex machina), Tuesday, 23 May 2006 12:51 (nineteen years ago)
― ZOT! (davidcorp), Tuesday, 23 May 2006 12:53 (nineteen years ago)
and that is a good site.
― Miss Misery xox (MissMiseryTX), Tuesday, 23 May 2006 12:55 (nineteen years ago)
php.net/functionnameorwhatever
and it usually redirects me to what i need
― JW (ex machina), Tuesday, 23 May 2006 13:11 (nineteen years ago)
This website of mine has gone live today. I'm still finishing off bits of info, but I've noticed the Mailing List at the top doesn't work - it goes to a 500 Internal Error page.
I've done one of these several times before, and so naively assumed it would work and didn't test it. Now I'm panicking - the documentary maker himself is in the newspapers today, so I need urgent help on fixing this. The form itself goes like this:
<form action="mlist.php" method="post" name="mailer">
The input like this:
<input name="ADDRESS" type="text" size="25,1" maxlength="80" />
And 'mlist.php' goes like this:
<?php
$ADDRESS = stripslashes($ADDRESS); $filename = "list.html"; $fp = fopen( $filename,"r"); $OldData = fread($fp, 100000); fclose( $fp ); $Input = "$ADDRESS<br><br>";
$New = "$OldData$Input"; $fp = fopen( $filename,"w"); if(!$fp) die("&Cannot write $filename ......&"); fwrite($fp, $New, 1000000); fclose( $fp ); include("index.html");
?>
Can anyone please spot the obvious mistake? Again, thanks in advance.
― Huey in Melbourne (Huey in Melbourne), Saturday, 30 September 2006 03:29 (nineteen years ago)
― Forest Pines (ForestPines), Saturday, 30 September 2006 05:34 (nineteen years ago)
$_REQUEST['ADDRESS'] = stripslashes($_REQUEST['ADDRESS']); $filename = "list.html"; $fp = fopen( $filename,"r"); $OldData = fread($fp, 100000); fclose( $fp ); $Input = "$_REQUEST['ADDRESS']<br><br>";
― Huey in Melbourne (Huey in Melbourne), Saturday, 30 September 2006 06:18 (nineteen years ago)
$ADDRESS = $_REQUEST['ADDRESS'];
at the top, instead.
Secondly, do you have access to the server's error_log file? That usually records a semi-useful error message for a 500 Internal Error, rather more informative than the one that the browser displays.
― Forest Pines (ForestPines), Saturday, 30 September 2006 06:30 (nineteen years ago)
― Huey in Melbourne (Huey in Melbourne), Saturday, 30 September 2006 06:39 (nineteen years ago)
― Forest Pines (ForestPines), Saturday, 30 September 2006 06:42 (nineteen years ago)
Sadly, I can't find any reference to any log or statistic file.
Nor can I find, in the server's control panel, any feature whereby CGI has to be activated , or not, which is a problem I experience before.
Is there any other quick way of doing this that doesn't involve PHP, do you know?
― Huey in Melbourne (Huey in Melbourne), Saturday, 30 September 2006 07:35 (nineteen years ago)
In any case, a better way to write it would be
1) Open the file in append mode - fopen($filename, "a");2) Lock it3) Move to the end of the file - fseek ($file, 0, SEEK_END);4) Write to the file5) Close it
This should remove any concurrency problems - if you don't do this, two people using the site at the same time will wreck your data.
― Forest Pines (ForestPines), Saturday, 30 September 2006 07:46 (nineteen years ago)
I guess the stern email I sent to the server folks did something, though they haven't personally replied.
Thanks once again for your help.
― Huey in Melbourne (Huey in Melbourne), Sunday, 1 October 2006 07:42 (nineteen years ago)