php-general Digest 11 Mar 2011 18:21:39 -0000 Issue 7221

Topics (messages 311772 through 311773):

Re: Issue with Quick Email validation
        311772 by: NetEmp

Re: [PHP-WEBMASTER] php with htmlspecialchars function
        311773 by: Daniel Brown

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Great Going Bob!

Wishing you Lots of Fun ahead!

Cheers

NetEmp

On Fri, Mar 11, 2011 at 12:54 AM, <rob...@myself.com> wrote:

>  Yep, new to programming and starting with php
> -taken classes but don't have the experience yet
>
> Not asking for complete mail addresses probably work best in most
> companies, but we're so used to typing our complete address that I would
> need to have a control and removal of domain -only to add again for sending
> the mail.
>
> Yes the first part of this already has a separate account validation, it
> also logs a request into our internal support system.
> Naturally if a external mail address is filled in there will be no request
> created, and I could have stopped the script there.
> This way I can stop use of external mail, while a contractor that not yet
> have a account in our logging system will still be able to send a Email
> request
>
>
>   At a later stage I might add email validation and even pick up details
> such as phone numbers and titles, but for now this little extra piece was
> sufficient
>
> Thanks again,
> Bob
>
>  -----Original Message-----
> From: NetEmp <net.ser...@gmail.com>
> To: rquadl...@googlemail.com
> Cc: Richard Quadling <rquadl...@gmail.com>; rob...@myself.com;
> louis.huppenba...@gmail.com; php-gene...@lists.php.net
> Sent: Thu, Mar 10, 2011 3:46 pm
> Subject: Re: [PHP] Issue with Quick Email validation
>
>  Agreed with the method suggested by Richard here, this is surely a safer
> way.
>
>  @Robert - are you a newbie to PHP or also to web programing.. or as a
> matter of fact to programing..
>
>  Just to share that validating user's input is always advisable, esp. in
> the web world. Thus, even if you use the method suggested by Richard, but I
> shall then also advise you to apply proper validations at the input (like
> permissible characters, maximum length allowed etc..)
>
>  Cheers
>
> On Thu, Mar 10, 2011 at 5:19 PM, Richard Quadling <rquadl...@gmail.com>wrote:
>
>>  On 10 March 2011 11:07,  <rob...@myself.com> wrote:
>> > Thank you, that did get me past that part!
>> >
>> > Had also to put in else statement to call Email function, without doing
>> so the mail was sent even though giving error
>> >
>> > Robert
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > -----Original Message-----
>> > From: Louis Huppenbauer <louis.huppenba...@gmail.com>
>> > To: rob...@myself.com
>> > Cc: php-gene...@lists.php.net
>> > Sent: Thu, Mar 10, 2011 11:38 am
>> > Subject: Re: [PHP] Issue with Quick Email validation
>> >
>> >
>> > try != instead of ==, that should do the trick.
>> >
>> >
>> >
>> > 2011/3/10  <rob...@myself.com>:
>> >
>> >> Hi,
>> >
>> >> I'm newbie to PHP and this list, possible not a new question so forgive
>> me if
>> >
>> > it's a repeat
>> >
>> >> I have a form where I want the submitter Email ID to only be from one
>> domain
>> >
>> >>
>> >
>> >> Here's the part I'm having issues with
>> >
>> >>
>> >
>> >>                                        $domain = explode( "@", $who);
>> >
>> >>                        if ( $domain[1] == "company.com") {
>> >
>> >>                                        echo $domain[1];
>> >
>> >>                                        echo("<h3>Email invalid.</h3>");
>> >
>> >>                                        exit;
>> >
>> >>                                        }
>> >
>> >>
>> >
>> >> First Echo is just for me to check
>> >
>> >> I type in a correct Email ID, say m...@company.com
>> >
>> >>
>> >
>> >> The return of this is:
>> >
>> >>
>> >
>> >> company.com
>> >
>> >> Email invalid.
>> >> As far as I can see this if statement should not fall in, what am I
>> missing?
>>
>>  Why bother asking for the entire address? Just ask for the name part
>> and display the domain name on the form?
>>
>> <label for="email">Enter your email address: <input type="text"
>> name="email" id="email" />@company.com</label>
>>
>> sort of thing.
>>
>>
>> --
>> Richard Quadling
>> Twitter : EE : Zend
>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

--- End Message ---
--- Begin Message ---
On Fri, Mar 11, 2011 at 13:07, Lisa Nguyen <lisa.ngu...@jpl.nasa.gov> wrote:
> Hi
>
> I use one of your example to test the htmlspecialchars :
>
> <?php
> $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
> echo $new; // &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;
> ?>
>
> On my browse, it display like below
> <a href='test'>Test</a>
>
> Instead:
> Test
>
> Please help me how display on browse only "Test", not like view source.

    First, this isn't a support channel.  Please view
http://php.net/support for a brief list of available support methods.
The list you want is PHP General (CC'd on this email, and you can
subscribe at http://php.net/mailinglists ).

    Second, you're using htmlspecialchars(), which is converting the <
and > to &lt; and &gt; respectively, which will cause the browser to
display it as if it was source (though viewing the source of that
would show you the entities).

    Instead, check out strip_tags(), which is likely what you want:

        http://php.net/strip_tags

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--- End Message ---

Reply via email to