Jump to content

meltingpoint

Members
  • Posts

    194
  • Joined

  • Last visited

Everything posted by meltingpoint

  1. gwolgamott-- I really appreciate the time and help. each $hold[$k] would contain an array with numeric index and values that range from single word to multiple words. That is why I am trying to test each $hold[$k] using preg_grep() as it tests the entire array for the pattern found in $search. If it does match- I want to echo out the $hold[$k] array that the match was in. I have tried a number of times with if statements, foreach and for and each time it prints all the $hold[$k] arrays. It is as if it does not evaluate the condition. I hope that make it a little clearer and hope that it aids in the solution to this problem. Much thanks- Andy
  2. I'm stuck..............could you give an example. Additionally- it is imperative that the index of each, represented by $k, remain in tact and not be renumbered. Thanks
  3. Sorry guys....I have tried the following with negative results for ($i = 1; $i <= count($hold)-1; $i++) { $k = count($hold)-$i; if(preg_grep("`\b$search`i", $hold[$k]) == False); { echo " Sorry No Match"; } if(preg_grep("`\b$search`i", $hold[$k]) == True); { // $cat = $hold[$k][1]; $name = $hold[$k][2]; // echo "<tr>"; echo "<td class='td tc w200 ol14'><a href=\"dcdataedit.php?dccat=$cat&dcrequest=$k\" target='_top'>View / Edit / Delete</a></td>"; echo "<td class='ff tc w200 fwb ol14'>$cat</td>"; echo "<td class='td tc w200 ol14'>$name</td>"; echo "</tr>"; } } What am I doing wrong?
  4. Ok. Have been working on this for some time and cannot get it. $search_variable // //-------loop through $hold (reverse order) creating an multi-dim array indexed by $k for ($i = 1; $i <= count($hold)-1; $i++) { $k = count($hold)-$i; // //------------need to test if $search_variable is in each of the newly //------------indexed arrays keeping the indexing in order //------------if the $search_variable is in the array- echo the variables in that array // $cat = $hold[$k][1]; $name = $hold[$k][2]; // echo "<tr>"; echo "<td class='td tc w200 ol14'><a href=\"dcdataedit.php?dccat=$cat&dcrequest=$k\" target='_top'>View / Edit / Delete</a></td>"; echo "<td class='ff tc w200 fwb ol14'>$cat</td>"; echo "<td class='td tc w200 ol14'>$name</td>"; echo "</tr>"; } I have tried numerous methods and in each- It does not seem to want to allow for an if statement inside the loop. Additionally- it keeps printing all the arrays- not just the ones that have the $search_variable match. Any suggestions welcome. Andy
  5. $filedata = "data.txt"; $openedfile = fopen($filedata); if($openedfile) { while(!feof($openedfile)) { $line = trim(fgets($openedfile)); if(!empty($line)) { list($date, $task_name, $information, $url ....etc with each "," seperated info); if($date == '2010/01/01') { echo "<table>"; //what ever data you wish to display here echo "</table>"; } } } fclose($openedfile); or you could also define a $begin_date and $end_date and test to see if the desired date is between those two dates and then display the data accordingly. Also- instead of tesing '2010/01/10' you could define the $desired_date and plug that in like so; if($date == $desired_date) Hope that helps...
  6. I use this on my forms. You need to echo the rand number in a text field in order for it to be passed along to the form processing script. Simply echo the rand number in the INITIAL VALUE of the text field. Now it will be passed along to the processing script like any other input from the form and you can do with it as you please. I suspect that the reason why it is not working for you is one of two reasons; 1- you simply have it as an echo statement and not in a text field. 2- if you are echoing it in the INITIAL VALUE of the text field on the form- then i suspect thtat the name of the text field does not match the $_POST variable that you have in the processing script. Cheers-
  7. ...............or, in the case of flat file system, you could store the user names and passwords outside the public_html which would make hem in accessible to the public even if the directory was exposed somehow. Admittedly though......hashing a password would be the best. Just giving more than one option/possibility.
  8. Why not simply have them enter their email address- then email the user name and or password of that user who has THAT EMAIL. In this- only the person with that email address will get their password. This makes things much simpler. Cheers
  9. if your url is- <a href="permissions_admin.php?account_action=add"> then on the page "permissions_admin.php" you will have to assign that to a variable to use it like so; $account_action = ($_GET['account_action']); This will assign account_action to $account_action and it will properly echo. As to the $session_user - you have not specified in your script that you posted where that is coming across an not sure why it is in the url unless you are using cookies.
  10. No worries................been there a ton of times Cheers-
  11. <strong>Total Hits</strong><br /> <?php $total ?><br /><br /> <strong>Unique Hits</strong><br /> <?php $total_unique ?> Are you trying to DISPLAY the Total Hits and Unique Hits? If so then you need put the echo in there- <strong>Total Hits</strong><br /> <?php echo $total; ?><br /><br /> <strong>Unique Hits</strong><br /> <?php echo $total_uniques; ?>
  12. aebstract.............thanks. Just thought someone running php scripts logging form information might know that answer or have run across problems with such a thing. Thanks
  13. Does anyone know if there is a limit to the number of characters that can be put in a text area? Thanks in advance
  14. salathe- How would one EFFECTIVELY do this? go through line by line..................
  15. .....what is your if statement testing? if ($username&&$password) { I do not believe that it is testing anything. Empty? Null? If exists? How about........ if (!empty($username or $password)) { or if ($username == "") or ($password == "") { Give that a try and see what happens.
  16. If it is returning a blank message- make sure to check that your variables are not miss-spelled. For instance- you define one message as $first_msg = "whatever"; then in the if statement you refer to it as $error = $first_message -----in this instance the page will be called but be blank as it cannot echo $first_message as it is not defined.
  17. oops- the exit should have ; and not exit;
  18. In the first part you have- Location twice (see below). I believe that it is not parsing that and moving onto the echo statement which is outputting to the browser which will result in the output to header error. header("Location: "Location:http://localhost/social/uregister.php""); Additionally- if that is where you want it to go after the error is detected- then there should be an exit; directly after to prevent the script from continuing. It should look like so-- header("Location: http://localhost/social/uregister.php"); exit; echo $resultUser;
  19. I create an error_pg.php or error_message.php page that it formated similar to other pages on my website (keeps same feel and look) but its main purpose is to echo out error messages. Lets call that page- error_msg.php. At the begining of the body of that page- define your messages. For example; $no_access = "<center>Sorry- could not connect to the Database</center>"; $no_file ="<center>Sorry that file could not be found</center>"; In the middle of that page I have the following; <? echo $message; ?> now on the other page- lets do the testing and error reporting. Try something like this; if (what ever condition) { $message = $no_access; include("error_msg.php"); exit: } In this- your code will run until it has an error. The error is defined and then the error display page (error_msg.php) is included and the message is displayed. Works great. Cheers-
  20. Like mjdamato said...it really is dependent on the code you are using to extract the info. At 588 bytes per line X 1,000 you have a file that is 588,000 bytes large or 574kb or .56Mb. I have heard that, with efficient coding, when you get to the 10 Mb size it can slow down the response noticeably. Just a ball park to work with in the event that you are not (as I am not) sophisticated enough to design and run the testing program the mjdamato was referring to. Cheers-
  21. Put that piece of code that you want to echo in a separate php script - then do an if statement if( $a == $b) { include("script_with_echo.php"); } else { include("another_script_with_echo.php"); } Obviously the if statement will be made to what ever condition you are wand to set- I just used $a == $b as an example. Does that give you an idea to build upon?
  22. $openedfile =fopen($myfile, "r"); // if(!$openedfile) { echo "File could not be opened- please notify the Web Administrator<br>"; exit; } // //--------------------If no errors the script continues and we open and lock the file--------------------- // if(flock($openedfile, LOCK_EX)) { // $hold[$record_count] = explode("|", trim(fgets($openedfile))); while(!feof($openedfile)) { $record_count++; $hold[$record_count] = explode("|", trim(fgets($openedfile))); } // // flock($openedfile, LOCK_UN); fclose($openedfile); } By running the script I create a multidimensional array where each line of the text file is an array with in one large array. So I would have an array $hold where $hold[1] or $hold[234] would represent a specific record from the text database. Lets say I want to remove $hold[56] form $hold. What would the best way to do that be? I can unset($hold[56]) -----but how would I then write the remaining arrays in $hold back to the text database?
  23. I am not trying to take $_SESSION variables BETWEEN domains. I am trying to have $_SESSION variables work on a single domain (the one with the SSL) and they are not working. To be clear- $_SESSION variables are not working on my one domain with SSL.
  24. Ok.........but the domain that is the problem has the SSL. I am not passing $_SESSION variables between an SSL site and a non-SSL site. The $_SESSION variables are initiated on and stay within the SSL Site. So your saying the browser is http and the site (server) is https and therefore the $_SESSION variables will not work?
×
×
  • 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.