brown2005 Posted November 22, 2006 Share Posted November 22, 2006 Hi, I had a function for this, but I can not find it, so I was wondering if anybody could please help.i have to inputsemail usernamewhat i want is say someone hasemail = '[email protected]'username = 'myemail4751?'i want this not to be allowed as they have entered the whole of the email before the @.any ideas please of a function/code? Link to comment https://forums.phpfreaks.com/topic/28088-checking-if-email-and-username-has-same-thing/ Share on other sites More sharing options...
Orio Posted November 22, 2006 Share Posted November 22, 2006 What do you mean? Can you give 2 examples of something valid and two for invalid?Orio. Link to comment https://forums.phpfreaks.com/topic/28088-checking-if-email-and-username-has-same-thing/#findComment-128501 Share on other sites More sharing options...
brown2005 Posted November 22, 2006 Author Share Posted November 22, 2006 email = '[email protected]'username = 'myemail4751?'that is invalid because the username has used myemail which is in the email address.anything that is totally different is valid, i.e.email = '[email protected]'username = 'ruggedlady3242' Link to comment https://forums.phpfreaks.com/topic/28088-checking-if-email-and-username-has-same-thing/#findComment-128505 Share on other sites More sharing options...
brown2005 Posted November 22, 2006 Author Share Posted November 22, 2006 i dont know if it is possible, but i though it would be a good idea to protect peoples email addresses more. Link to comment https://forums.phpfreaks.com/topic/28088-checking-if-email-and-username-has-same-thing/#findComment-128506 Share on other sites More sharing options...
Orio Posted November 22, 2006 Share Posted November 22, 2006 I dont think it's a good idea doing that. For an example, all of my email addresses contain "orio" in them. If I would see I cant use the combination of Orio as the username and an email containing orio in it, I'd simply wouldnt register.But if you still want to apply something like that, you can use the [url=http://www.php.net/strpos]strpos()[/url] function:[code]if(strpos($email, $user) !== FALSE) die("The email cant contain the username!");[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/28088-checking-if-email-and-username-has-same-thing/#findComment-128511 Share on other sites More sharing options...
brown2005 Posted November 22, 2006 Author Share Posted November 22, 2006 ok, ill have a think about it.i could use it on username and password though, which i think would be a good idea to stop u having the same username and password.. do you think? Link to comment https://forums.phpfreaks.com/topic/28088-checking-if-email-and-username-has-same-thing/#findComment-128517 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.