If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: string checking

  1. #1
    Senior Member
    Join Date
    May 2003
    Member #
    Hey, I have a column for the username in a table, and want to know if it is possible to check if a posted value has a "." in it?

    PHP Code:
     (some pseudocode)
    $user_name $_POST['user_name'];
    $user_name contains ".") {
    "no dots please";} 
    Also, to check the MIME type of a file to be uploaded, I use
    PHP Code:
    but read somewhere online that the MIME type can be spoofed.

    Should I trust my users or is there a way to check the extension of $_FILES['userfile']['type'] for values like .jpg,.png (allowed) rather than .exe,.com

    Thanks a lot in advance


  3. #2
    Senior Member
    Join Date
    Aug 2003
    Member #
    To check whether a dot exists in a string, use the stristr() function:

    To check the file extension, use pathinfo:
    Be sure to read the user-posted comments for pathinfo.
    eKstreme - Free website tools!
    fontfox - free fonts Hand-picked quality fonts.

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 01:35 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: