Jump to content

gm04030276

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gm04030276's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. write a function and call it on page load!
  2. try this... <?php $file = fopen("/path/to/file.txt"); while($line = fgets($file)){ $items = explode ( "\t", $line ); echo "<table> <tr> <th align = 'left'>First Name</th> #(watch your open/closing tags, i changed from /td to /th) <td align = 'left'>$items[0]</td> </tr> <th align = 'left'>Surname</th> #(watch your open/closing tags, i changed from /td to /th) <td>$line[1]</td> </tr> ...</table> }
  3. yea, thats because your just looking at the file on your computer, not getting the server to parse it and do its thing with it, you need to go to http://localhost/apache2-default/greetings.php to view it from the server!
  4. sort of a bad way to do it, all on one page because then the server has to read your whole site worth of files EVERY time the page is loaded, unless they are cached/in memory/whatever... suggestion if you want to keep it on one page, use a switch statement to include the file you need aswell as run the function so your only including the necessary files!! as to passing variables, whatever way you make up the url to go to the next page, html link in form? just make it as a php variable first so <?PHP $link = "normal_address?var1=???&email=".$email_address; <form action="<?php echo $link; ?>" method="post">... then it will be accessible via the $_POST['email'] variable in php. ...or you could try using php sessions! wonderful things!
  5. also if you just go to http://localhost/ and don't have an index.(php|html|etc) page there, then it will just show you the folders in that directory, you should see the apache-default folder there and when you more your greetings.php file, it should appear with it.
  6. ah don't put it in the apache-default folder! the default root on (k)ubuntu is /var/www/ so you need to put your file there.../var/www/greetings.php currently you would need to put http://localhost/apache-default/greetings.php
  7. Use InnoDB (i think) table format and then add a fulltext index to the fields you want to be able to search. You'll need to find a bit more information on this as its been a while since i did this but something like SELECT *,search FROM `table` WHERE MATCH('text_field_input') AGAINST(`field`) AS `search` ORDER BY `search` DESC; This (should, again, been a while, you might have to play with the syntax) will take your input, match it against a field and display the results from the highest matched percentage to the lowest (out of 1, * by 100 if you want actual percentage to display).
  8. Is it possible to include a directory of php files into a script using the require() function and a wildcard character? i.e. require('directory/to/include/*.php);
  9. thats what it was the whole flippin time! thank you soooo much! woohoo!
  10. so i want to send it the file rather than the file handle! well that makes lots of sense!!!! gdgd! lets go try that!
  11. putting the date into the variable by not concatenating them is ok, i got it just to print that to screen to see if that was were the prob was and it said the name right, as far as i can tell, the filename is getting changed from what is in the variable because i have got it to print out at several places to make sure it was alright it says in the error message Warning: filesize(): Stat failed for Resource id #3 (errno=2 - No such file or directory) in /home/fhlinux210/c/closertohim.co.uk/user/htdocs/path to file/logsapp.php on line 20 so i asume that that means the name has been changed to resource id #3 (i dont really know much about reading error messages in php, i know what i need to know to do what i need to do!) it keeps saying the file doesnt exist but im sure the file name (capitalization aswell!) is correct at least going into the filesize function, it all seems to go wrong there and i havent changed it, because it doesnt make sense, i was right the first time in comparing one to the other. ill try the string concatenation for the date anyway and just keep tweeking, see what happens!
  12. there are no extensions on the files (should there be, i was wondering that) i will try the ABSOLUTE path, i was using the path from the directory i was in ie ../../../folder/file and that didnt work so i tried using the url. i will try with absolute path now and post back
  13. im just browsing here and wondered if you could use a flatfile database or a mysql database to hold and retrive the information for checking the email/ip against??
  14. this is a script which i wrote to handle a request from a form in my self built admin portal. The form simply asks for the date via 3 drop down menus, day, month and year and a password and is then sent here in the hope of opening the log file for that date as the logs are written into files by what date it is using gmdate("Mdy"); for the filename. i cannot get this script to open the file though, it keeps saying: (note i have edited some of the file paths for obvious reasons, i have however checked them all to be right) [color=red]Warning: filesize(): Stat failed for Resource id #3 (errno=2 - No such file or directory) in /home/fhlinux210/c/closertohim.co.uk/user/htdocs/the path to script/logsapp.php on line 20[/color] [color=blue]<?php $pass = md5($_REQUEST['pass'] );                [color=green]script asks for password to view files[/color] $passfil = fopen("../../../passhash.txt", "r"); $passr = fread($passfil, 32); fclose($passfil); $day = $_REQUEST['day'] ; $month = $_REQUEST['month'] ; $year = $_REQUEST['year'] ; if($pass == $passr){ $date = "$month$day$year"; $location = "http://www.closertohim.co.uk/folder/folder/" .$date; echo $location; $datafil = fopen("http://closertohim.co.uk/folder/folder/" . $date, "r"); if(filesize($datafil) > 0){ $data = fread($datafil, filesize($datafil)); }else{ echo "error in log file size\n$!"; } include('logs.php'); }else{ echo "Incorrect password, please try <a href=\"logs.php\">again</a>"; } ?>[/color]
×
×
  • 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.