Results 1 to 4 of 4

Thread: Sendmail\Database related questions

  1. #1
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Sendmail\Database related questions

    I have a few questions. When working with a sendmail.php or whatever you want to call it how would you check for HTML tags? I can't find a functions to do it... I suppose just looking for "<" and ">" would work, would it not? Anyways next question. I don't understand this whole database thing, I know how to access it, and all that. What I don't get is how you actually look at a section of data. Like it recently hit me what fgets() does, great end at the line break...but what if I wanted it to begin the second line down, or third, etc? I just don't get it... Well, time to wait for a reply.

    -Tim

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    I have a few questions. When working with a sendmail.php or whatever you want to call it how would you check for HTML tags? I can't find a functions to do it... I suppose just looking for "<" and ">" would work, would it not?
    are the tags a part of the user input.... eg something the user enters into a text input / textarea field?
    what exactly do you want to do with the html tags?
    you could replace the left and right signs with their unicode equivalent, which would prevent them from causing any harm.
    PHP Code:
    str_replace('<''&lt;'$tring);
    str_replace('>','&gt;'$tring); 

    I don't understand this whole database thing, I know how to access it, and all that. What I don't get is how you actually look at a section of data. Like it recently hit me what fgets() does, great end at the line break...but what if I wanted it to begin the second line down, or third, etc? I just don't get it
    if you wish to insert line breaks before the start of a new html field then that would require a couple of things. First you would need to know how you would like to delimit (separate) the content, then you would need to know how far down you would like to push everything. This can be done at two times. it can be done before you insert them into the database, or you can do it after you pull from the database.
    research the implode() and explode() methods on http://www.php.net

  3. #3
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    No harm no foul I suppose. Yes, it will be processing 3 fields. A 2 textboxs, and 1 textarea. I had nothing specific in mind about what to do with them, just somehow prevent them from doing anything.

    if you wish to insert line breaks before the start of a new html field then that would require a couple of things. First you would need to know how you would like to delimit (separate) the content, then you would need to know how far down you would like to push everything. This can be done at two times. it can be done before you insert them into the database, or you can do it after you pull from the database.
    research the implode() and explode() methods on http://www.php.net
    Everything I've ever looked at on php.net I couldn't understand, I found their examples...well, crappy. I always had good results with w3schools, but anyways I'll check those out.

    Thanks

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    I had nothing specific in mind about what to do with them, just somehow prevent them from doing anything.
    nothing as in do not process them or nothing as do not include them at all

    if you want to keep the html tags, eg... some code is posted to you to review, you can review
    Code:
    htmlspecialchars($tring)
    if you would like to just get rid of the tags all together you can review
    Code:
    strip_tags($string)
    in either event I would check into removing excess whitespace before / after the input entered with
    Code:
    trim($tring)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •