22 users online (0 members and 22 guests)  


  Results 1 to 8 of 8

Related

  1. Radio Buttons Return Nothing    Forum: HTML Forum
    Replies: 7
  2. How to return to previous page    Forum: Javascript Forum
    Replies: 0
  3. Automaticaly return to top of page    Forum: HTML Forum
    Replies: 1
  4. return form info as webpage    Forum: PHP Forum
    Replies: 0
  5. Refreshing a window on return from a popup    Forum: Website Scripts Forum
    Replies: 3
  1. #1
    nickcol's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    uk
    Posts
    5

    geting return linefeed codes on php

    Hi, I have been trying to write a online catalogue for work using php4+apache+winxp+mysql to replace a very slow one.

    It all works but if i write to a text file, info which people have searched for when i edit it in notepad there are no linefeeds chr returns. ITS ALL ON ONE LINE.


    1. How do i when writing text to a file force a linefeed.???

    2. The same is true of the following
    readfile ("readme.txt" ); It does not show linefeeds.??

    its located at http://213.152.53.208/main.php for timebeing.

    how secure is it as the apache log shows quite a few \scripts\cmd.exe c:\dir 404 messages messages.

    Not bad for around 4 days work.

    Nick
    Last edited by HTML; 03-20-2007 at 08:40 PM.

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Windows XP is not secure to run a server at all. And the windows port of Apache is designed for testing on, not for running a host. I would not use this on the web.

    Linefeeds in windows are

    Code:
    \r\n
    Try using that string for line breaks (in UNIX, I think you only need the \n )
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    for readfile , if its showing in a browser then it qont show the linefeeds because you need to replace the \r\n or \n characters with <br /> for it to work. lookup ereg_replace in the php manual.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  4. #4
    sonofmidi's Avatar

    Status
    Offline
    Join Date
    Jan 2001
    Location
    NC, USA
    Posts
    75
    It is important to use 'a' as the mode. This will add the new entry to the end of the file. 'w' writes to the beginning.

    $string = 'this is a string';

    $file_handle = fopen('readme.txt', a);

    fwrite($file_handle, $string . "\n");

    fclose($file_handle);
    Last edited by sonofmidi; 05-10-2003 at 12:22 PM.

  5. #5
    nickcol's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    uk
    Posts
    5
    Thanks for the linefeed bit, It works ok now.


    Re Apache on win XP not Secure.

    Im only really trying it at the moment. The catalogue will never have any online ordering on it, only for our customers to view items.

    Nick

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    More worried about having it a server in any sense, really. Once they are on one box, they got your whole network to play with...
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    nickcol's Avatar
    New User

    Status
    Offline
    Join Date
    May 2003
    Location
    uk
    Posts
    5
    The server is on my home pc with adsl line Not at work.
    .

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hope you dont keep your credit card number on there..

    Honestly, running a win2k server with IIS would be more secure than a winxp box running apache (and thats saying something!).

    but at the end of the day, its up to you.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread