Nandini Posted August 28, 2008 Share Posted August 28, 2008 Hi all I want to validate one field named as "register string" I want validate this string in the formate of "username:password@host" OR "username:password@host:port/username" OR "username:password@host:port" here username, password and host values are fetching from database. But for port there is no text field and no database field. But we can allow port number. Can any one one tell me how can i validate this field. here is my validate condition: if( (( (($_POST['register'])<>($p_username.":".$p_secret."@".$p_host)) && (($_POST['register'])<>($p_username.":".$p_secret."@".$p_host.":".some port."/".$p_username)) ) ) { $errmsg = "<ul class='square'><li>Invalid register string.</li></ul>"; } Can any one help me Link to comment https://forums.phpfreaks.com/topic/121659-php-strings/ Share on other sites More sharing options...
bluejay002 Posted August 28, 2008 Share Posted August 28, 2008 that could be possible but ill prefer regex for that... you can use preg_match() for that. just check for the proper regex... there's a regex section in this forum. Link to comment https://forums.phpfreaks.com/topic/121659-php-strings/#findComment-627622 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.