AFAIK, you need to reverse the test and change a bit the regex, try this:
} elseif( ! preg_match("|^http(s)?://(www.)?mydomain.com/([a-z]+)/invoice/(\d+)$|i", $url) ){
$msg = '<div class="msg"><div class="error">'.$lang['er_01'].'</div></div>';
سؤال
I'm building a php system which allow users to resend their invoices that need to be rechecked,
My problem is i need to make a condition to my system so it can't accept any url expect urls that looks like the following example
$url = http://mydomain.com/$id/invoice/$num
http://mydomain.com/murad/invoice/6589445564555
http://mydomain.com/ludmilla/invoice/9764564252
code:
} elseif(preg_match("|^http(s)?://(www.)?mydomain.com/([a-z]+)/(.*)?$|i", $url)){
$msg = '<div class="msg"><div class="error">'.$lang['er_01'].'</div></div>';
but it didn't work , Can i know how to make it work correctly ?
لا يوجد حل صحيح
نصائح أخرى
AFAIK, you need to reverse the test and change a bit the regex, try this:
} elseif( ! preg_match("|^http(s)?://(www.)?mydomain.com/([a-z]+)/invoice/(\d+)$|i", $url) ){
$msg = '<div class="msg"><div class="error">'.$lang['er_01'].'</div></div>';