Jump to content

arfa

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by arfa

  1. hey scootstah.! Barely had I found the flash plugin for firefox - I turn around and - presto - the answer to my problem. Totally worked. Many thanks.
  2. Going back to an old script after upgrading to php5... This is not my code - PEAR.PHP - used as part of a backup script I wrote/modded ___________________ The relevant comment in the script * IMPORTANT! To use the emulated destructors you need to create the * objects by reference: $obj =& new PEAR_child; _________________ The error msg in the browser Deprecated: Assigning the return value of new by reference is deprecated in C:\Program Files\EasyPHP-5.3\www\brama\backup\PEAR.php on line 562 Deprecated: Assigning the return value of new by reference is deprecated in C:\Program Files\EasyPHP-5.3\www\brama\backup\PEAR.php on line 565 __________________ The relevant code line in the script. if ($skipmsg) { 562 $a = & new $ec($code, $mode, $options, $userinfo); return $a; } else { 565 $a = & new $ec($message, $code, $mode, $options, $userinfo); return $a; } I have had a few blips going to ver5 but this one I can't seem to rectify. Any leads welcome. Thanks
  3. And on reading the manual (again) more closely I do indeed see: array_push "Returns the new number of elements in the array." Thanks
  4. Adding a value to an array. Why won't this work? $notify_list=file($filename); $notify_list = array_push($notify_list,"$user_em"); foreach($notify_list as $key => $val) { echo "$val<BR>"; } It prints the number of records. the file() is clearly an array and foreach prints as expected. I wonder if it is something to do with the \n at the end of each line? I could easily loop and manually build the new array but.... It seems so simple.
  5. You are right - I no longer seem to have permission. Weird. I am having a look at SSH - quite new to me. Thanks for the lead. I am also downloading a few "unix permissions basics" pages This is really bugging me.
  6. You may find an existing script but your requirements are pretty specific so best have a go at coding it yourself.
  7. You don't make clear what the problem is. What error are you getting? Why not read using file() - this gives you an array by line.
  8. I have a hacker on/in my site and the trick seems to be to change permissions on various files. Obviously I need to fix the hole and eject the hacker but, in the meantime I am having trouble resetting permissions. The file(s)/dirs in question are owner www-data [as opposed to ftpweb or base owner] I have tried resetting perms using: - my ftp client - no! - Using a backdoor chmod app on the same server within the same root - no! - A small php script chmod.php I wrote: <?php echo "<form action=chmod.php method=POST> <input type=text name=path size=50> <input type=submit value=CHMOD>"; if (isset($_POST['path'])) { $path = $_POST['path']; chmod($path,0755); echo $path; unset($_POST['path'],$path); } ?> I have this installed in the dir above the dir I want to change and have tried both absolute and relative paths. No change. Is there something missing in this code or is there an alternative. The directories have been changed to: 40700 - drwx------ GRrrrrrrr..... and other frustrated emoticons. Any suggestions? thanks - arfa
  9. arfa

    ereg_replace

    thanks for the heads up on php6 Generally there seems to be a very slow uptake of php5 And, thanks for the str = str works just fine.
  10. arfa

    ereg_replace

    A simple one? -- for those that know how. I am trying to strip everything from a string that is NOT a-z, 0-9 I started with: ereg_replace("[^a-z0-9]",'',$string); Tried various other permutations. Oh dear... What should I be doing? thanks - arfa
  11. Snow is on the way; wood cut but keys unpoked for a while thanks again - it works just fine - arfa
  12. Great that I am not the only one that sitting for hours poking keys and punching a mouse ) thanks for the quick turnaround. Yes, I can run phpinfo but this just gives me a list of the install. I was wondering if there was an on-the-fly test for curl, as in... if (!file_exist('sdf.txt') {...} else {...} if no curl then I would set size and '0' and bypass the whole routine
  13. cache filesize - hmmmmm? The page build is around a podcast database which will be modified (hopefully) regularly. The testing I have done (on dial-up) seems quick enough for on-the-fly. It does give me the thought to running the curl script when the file is uploaded (by an non-tech volunteer) and writing the value to the database. Is there some way to test if curl is installed. It is not on my local PHP build (EasyPHP 1. and gives a fatal error. I am downloading ver2.0 >> Call to undefined function: curl_init() This is a minor point but I like to cover the bases. >> they have a hidden forward in there I studied the code and, apart from the "FOLLOWLOCATION" line couldn't see the diff. Where is the 'hidden forward'? thanks again - arfa
  14. way cool for curl I see the more I learn the more I see there is to learn. Many thanks rhodesa Stephen: that could work but strlen does not accurately represent filesize. also, this whole thing with remote files means (certainly in this case) file_get_contents returns an error: file not found or some such. thanks to all - yet another case closed
  15. great to hear back from you Yes, the curl code works on the phpfreaks logo I tried this on another server to eliminate that possibility. both returned 43246 but, modify the URL in the same (test) file pointing to www.archive.org and it returns '0' The full URL is: http://www.archive.org/download/ConnectionAndAlienation/20080221AVIRADHAMMO_32kb.mp3 Feed it to a browser and it loads the file -- it *is* there.!!! @$@#$@ readfile() works OK for the download script and, while I don't fully understand wrappers we have "allow_url_fopen" working???? So, what could be missing? this kind of thing is what makes it challenging/fun/... thanks again - arfa
  16. thanks for the 2 replies 1: looked at the wrappers info and continue to boggle at how much I don't know Any leads as to how to implement this would be much appreciated 2: Tried the curl code - thanks rhodesa Alas, it returned a big '0' Is there any way of testing that the remote host will run curl? cheers - arfa
  17. I work well in PHP but am entering a new area here. The scenario: I have mp3's remotely hosted [archive.org], have written code to force a download but... it would be nice to have access to the filesize - both to display next to the download and, to tell the downloader so it can display xkb of yMb on the progress bar. So, ___________________ *first question*: How to test that the host will allow filesize() or some equivalent I have used: if (ini_get('allow_url_fopen') == '1') and returned true Using either filesize() or stat() gives error other suggestions? ____________ *second question*: A simple routine (or links to). There are several on the web using many approaches but, none of them work for me. It would be good to have an answer q1 so I can be more clear how to approach q2 One of those 'not exactly sure where to start' things for me. thanks - arfa
  18. ooops, hit the post button.... rasmus/file.gif", "wb"); I am definitely not on a win server (but should get into the 'portability' habit) via my PHP chmod script using: chmod("$fname", 0666); I was getting: Warning: chmod() [function.chmod]: Operation not permitted in /home/ftp/.../....../.. but now see that this is only for directories. This thread is a bit of a space waster - other than forcing me to write out my process, and examine the various steps and presumptions along the way - AND learn as a result. sorry about that thanks for your tolerance
  19. thanks for the replies. A bit more testing and it seems we are writing. The problem still remains with chmoding - via my FTP prog - error message= Operation not permitted. May not be supported on remote site. Or, via PHP using: chmod("$fname", 0666);
  20. A standard file write routine - generating the file $fname on the first run. [code=php:0] $fh = fopen($fname, 'w'); fwrite($fh,$data); fclose($fh); [/code] On the current server the file, $fname, is written with permission and status: -rw-r--r--  www-data So... trying to later write to the file doesn't work. Being www-data it resists standard fTP chmod command. It also fails: chmod("$fname", 0666); Any suggestions or comments here would be most welcome. thanks
  21. yes, radio buttons would work if there was an either-or option but the idea with the checkbox is a multiple choice. In my case two out of five. I am not sure but wouldn't  if(chk_box == "off") generate an error. What is chk_box? - undefined variable? and $_POST['chk_box'] doesn't register. thanks - arfa
  22. I want to test if various checkboxes have been checked - or, more importantly, to report an error if left unchecked. code example: [code] if(isset($_POST['checker'])) {    foreach ($_POST as $name => $value) {     echo "name=$name & value=$value<BR>";     if(empty($value)) {echo "empty $name<BR>";}     if(is_string($value)) {echo "string $name<BR>";} }} echo "<BR><BR><form action=check.php method=POST> <input type=checkbox name=chk_box> check this<BR>     <input type=text name=another> another<BR> <input type=submit name=checker value=submit></form>"; [/code] The (empty) text input prints the name and can be tested as empty but unless the checkbox is checked the box is 'invisible'. The checkbox is either 'on' or 'off' so I test for is_string. Same result. Even the empty text input still registers as a string, but the checkbox... nothing. I suspect I am missing one of those 'obvious when you know' bits of info. Any pointers to the obvious, or even obscure, are most welcome.
  23. Greetings Ken, Nice to have a very clear 'NOT'. I would very much appreciate an expansion of your thoughts. Part of the process here is one of learning. The how and why. Certainly PHP can mail and can send attachments. What are the limitations? Too slow, too risky, unreliable...? I am not so proud as to use a pre-made script but I would like to know why I might mess up with my own. I hope you have the time to reply. Thanks
  24. I have the idea that sending bulk mail in batches is the thing to do. Script timing out [max_input_time ?], spam, and such. About 500 on the mail list. I send in lots of 100. Are batches a good idea? Not necessary? Other thoughts? Attachments: I have got the script sending an attachment - in a single batch loop. But, from the PHP manual >> file will be deleted from the temporary directory at the end of the request... I presume this means the end of the first batch. So, I hesitate to charge off exploring alternatives without your guidance. My script hand is slow and debugging can be tediously slow - especially with mail script as it can only be done on-line and I am on 36k dial-up at the moment. My first thought is to literally upload the file to my server and unlink on completion of the last batch . Set me on the path of righteousness my friends !  ;D thanks
  25. I am building a wee search script but am stuck trying to cover multiple occurences and get tangled in a myriad of if() loops. I am searching standard html & text files, so no SQL Scenario: $simple_string = 'I am stuck trying to cover multiple occurences of keywords in proximity'; $querry = 'stuck multiple'; open file(s) strip tags if (strstr($simple_string,$querry) { $pos[]=strpos($simple_string,$querry); } In the example above two values are returned for $pos I set up a +$end -$start for $pos to return a string and we have two strings - eg: > am stuck trying > cover multiple occurences My ideal in the above example would be to return just one 'merged' string. > am stuck trying to cover multiple occurences ###### How does $pos determine its position relative to another $pos??? ###### Here is my script start so far: $page_dir='./files_here'; $dh = opendir($page_dir); // just one DIR for now         while ($files = readdir($dh)) {             if (ereg(".\.htm$","$files")) { // test htm files                 $file_array[] = $files;    // all files as array                 $rec_num = count($file_array)-1;  }}                       $one_bit='';  $hits='';  $text=''; $runner=''; $plod=''; foreach ($file_array as $incl) { $str=file_get_contents("$page_dir/$incl");                     $linker = str_replace('.htm','',$incl); // for result reporting             $tagless = strtolower(strip_tags($str));                             $full_len = strlen($tagless);  // total string length                   for ($s=0; $s<=$str_num; $s++){          // loop each word of string                   if (strstr($tagless,$str_pop[$s])) {      // found one word of string                         $hits++;                             $pos[] =strpos($tagless,$str_pop[$s]); // where is it                 if ($pos>=$long ) {$x=$pos-$long;} else{$x=$pos-$pos;}                   if ($pos+$long<=$full_len) {$y=$pos+$long;} else{$y=$full_len;}                             $less_end = $full_len-$y;             $one_bit .= substr($tagless,$x,-$less_end)."<BR>"; // got one hit = one sting bit }}} I tried an array of $pos and then tried to compare proximity of results. if else if or and... I have tried several other different approaches to get tidy result strings but it gets very convoluted and fuzzy in my head. Or, maybe there another approach to this? The site is relatively simple so I am not particularly concerned with weighting although suggestion on how to track this would also be welcome. thanks - arfa
×
×
  • 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.