raivis Posted November 22, 2004 Report Share Posted November 22, 2004 Kādam vajadzētu izskatīties reģistācijas formas kodam, kur PAROLEI jābūtu 7 - 10 simbolu garai, tā nedrīkstētu saturēt mīkstinājuma zīmes/garumzīmes ? //<input type="password" name="password" maxlength="10"> if $password = no 7-10 simboliem, bez mīkstinājuma zīmēm!; { $password = htmlspecialchars(strtolower(stripslashes($password))); $file = join("", file($data)); $fp = fopen($data, "w"); fputs($fp, "$password|\r\n"); fputs($fp, $file); fclose($fp); echo "Ok!"; } else { echo "Parolei jābūt 7 - 10 simbolu garai, bez mīkstinājuma zīmēm/garumzīmēm!"; } Link to comment Share on other sites More sharing options...
bubu Posted November 22, 2004 Report Share Posted November 22, 2004 if (preg_match(/^[^āšņģŽš...]{7,10}$/', $password)) { // ... vietā saraksti visus mīkstos/garos burtus ... } Link to comment Share on other sites More sharing options...
Venom Posted November 23, 2004 Report Share Posted November 23, 2004 if (preg_match(/^[^āšņģŽš...]{7,10}$/', $password)) { // ... vietā saraksti visus mīkstos/garos burtus ... } pie tam, vajadzīgā kodējumā (koda kodējums==lapas kodējums, ja tas ir utf-8, vajadzētu pielikt /u parametru pregam), ja gribi pieļaut tikai angļu burtus, izmanto attiecīgi #[a-z]{7,10}#i pregu Link to comment Share on other sites More sharing options...
bubu Posted November 23, 2004 Report Share Posted November 23, 2004 #^[a-z]{7,10}$# Link to comment Share on other sites More sharing options...
рпр Posted November 23, 2004 Report Share Posted November 23, 2004 #^[a-z]{7,10}$# kapēc lai nevarētu saturēt lielos burtus un ciparus? #^\w{7,10}$# Link to comment Share on other sites More sharing options...
bubu Posted November 23, 2004 Report Share Posted November 23, 2004 Es nezinu. Jautājums vispār bija: PAROLEI jābūtu 7 - 10 simbolu garai, tā nedrīkstētu saturēt mīkstinājuma zīmes/garumzīmes Tā ka tikai teikts, ka nedrīkst būt mīkstie/garie burti. un viss. to arī pirmajā savā atbildē uzrakstīju. Link to comment Share on other sites More sharing options...
raivis Posted November 23, 2004 Author Report Share Posted November 23, 2004 KUR KĻŪDA? <?php $password = "āšerdgfgffdAĀ76sffhfgh;,.?"; if (preg_match("/^[a-z0-9]{7,10}$/", $password)) { echo "False.."; } else { echo "True.."; } ?> Link to comment Share on other sites More sharing options...
Venom Posted November 23, 2004 Report Share Posted November 23, 2004 tev teikts, ka var būt tikai angļu burti un cipari, ā utml tur neietilpst Link to comment Share on other sites More sharing options...
raivis Posted November 23, 2004 Author Report Share Posted November 23, 2004 Bet vajadzētu uzrādīt False.., bet uzrāda True.. Link to comment Share on other sites More sharing options...
fassko Posted November 23, 2004 Report Share Posted November 23, 2004 Bet vajadzētu uzrādīt False.., bet uzrāda True.. samaini vietaam!!! Link to comment Share on other sites More sharing options...
raivis Posted November 23, 2004 Author Report Share Posted November 23, 2004 Bet vajadzētu uzrādīt False.., bet uzrāda True.. samaini vietaam!!! Ne tāds ir mans mērķjis ,- tad jau tikpat labi es varētu uzrakstīt vienkārši echo "False.."; Link to comment Share on other sites More sharing options...
bubu Posted November 23, 2004 Report Share Posted November 23, 2004 <?php $password = "āšerdgfgffdAĀ76sffhfgh;,.?"; if (preg_match("/^[\w\d]{7,10}$/i", $password)) { echo "Parole sastāv no burtiem un/vai cipariem garumaa 7-10"; } else { echo "Parole ir greiza"; } ?> Link to comment Share on other sites More sharing options...
raivis Posted November 23, 2004 Author Report Share Posted November 23, 2004 Un.. ja parolē nedrīkstētu izmantot LIELOS BURTUS A-Z - drīkstētu izmantot tikai mazos burtus a-z)...? Link to comment Share on other sites More sharing options...
Venom Posted November 24, 2004 Report Share Posted November 24, 2004 tad jānoņem "case-insensitive" modifikātors, tur kur $/i att. uz augšejo gan varētu likt unicode-piezīmi ar /u NB, paeksperimentēt ar regulārām izteiksmēm vari šeit Link to comment Share on other sites More sharing options...
raivis Posted November 25, 2004 Author Report Share Posted November 25, 2004 (edited) Un.. ja parolē nedrīkstētu izmantot LIELOS BURTUS A-Z - drīkstētu izmantot tikai mazos burtus a-z un skitļus)...? NEIZDODĀS! uzrāda EROR.. --- $password = "Aate65i0"; if (preg_match("/^[\w\d]{7,10}/u", $password)) { echo "Parole sastāv no burtiem un/vai cipariem garumaa 7-10"; } else { echo "Parole ir greiza"; } Edited November 25, 2004 by raivis Link to comment Share on other sites More sharing options...
Recommended Posts