[Resolved] String checking acting up

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

liam_d

The original NP Emo KidEstablished Member
Impact
25
string checking acting up

Hi all basically i am trying to check if a string starts with "<embed" or "<object" and if it doesn't then give an error, i have found out if i do this then it never works:

PHP:
if(substr($_POST['code'], 0, 6) != "<embed" || substr($_POST['code'], 0, 7) != "<object")

but if i do just one so if you remove the or bit for "<object" it works, but it won't let me do both together, any ideas?!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Solved, needed && not ||, thanks got to Mike aka AllDrops.com
 
0
Close
Perhaps if would be good to use strtolower or strtoupper to perform a case-insensitive comparison. A regular expression could be used too.
 
0
Close
Yeah i have already been advised to do so :)
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back