Yuav Nkag Rau Npe Hauv Koj Lub Xaib

Cov txheej txheem:

Yuav Nkag Rau Npe Hauv Koj Lub Xaib
Yuav Nkag Rau Npe Hauv Koj Lub Xaib

Video: Yuav Nkag Rau Npe Hauv Koj Lub Xaib

Video: Yuav Nkag Rau Npe Hauv Koj Lub Xaib
Video: npawg lem: yug los tsis tsim nyog koj lub siab hlub. nkauj tawm tshiab 2024, Hlis ntuj nqeg
Anonim

Txheej txheem cuv npe twb tau tsim muaj nyob rau hauv lub neej ntawm cov neeg siv Is Taws Nem thiab muaj kev paub zoo rau lawv. Txawm li cas los xij, cov webmasters novice tsis ib txwm muaj qhov kev paub tsim nyog los nruab xws li kev paub npe rau npe ntawm lawv tus kheej cov peev txheej.

Yuav nkag rau npe hauv koj lub xaib
Yuav nkag rau npe hauv koj lub xaib

Cov Lus Qhia

Kauj ruam 1

Ua ntej tshaj, nruab Apache tus neeg rau zaub mov ntawm koj lub computer. Tom qab ntawd tsim cov ntaub ntawv zoo li no ntawm koj lub xaib:

1) index.php - nplooj ntawv tseem ceeb;

2) reg.php - nplooj ntawv sau npe;

3) auth.php - kev tso cai;

4) userdb.db - teev cov npe siv.

Kauj ruam 2

Teeb tsa tus qauv ntawm tus neeg siv lub hauv paus nrog tsis nkag (npe), dhau (codeword lossis password), lub luag haujlwm (qib nkag mus), npe (npe), cov ntaub ntawv (ntaub ntawv). Rau txhua tus neeg siv, txoj hlua sib cais ntawm daim foos user1% 1-1% user_pas% 1-1% user_role% 1-1% user_name% 1-1% user_info yuav tsim.

Kauj ruam 3

Tsim cov ntawv rau npe thiab tso cai. Piv txwv ntawm daim ntawv tso cai:

Kauj ruam 4

Cov ntaub ntawv auth.php cov ntaub ntawv muaj cov foos ib txwm ua, kab

Kev tso npe thiab lwm cov ntaub ntawv, cov ncauj lus kom ntxaws ntxiv txog qhov uas tuaj yeem nrhiav tau ntawm cov chaw tshwj xeeb.

Kauj ruam 5

Tom ntej no, sau daim ntawv rau npe - sau ntawv. Hauv qab no yog ib feem ntawm tsab ntawv:

$ fp1 = cov ntaub ntawv ("userdb.d");

foreach ($ fp1 li $ key => $ tus nqi) {

$ tus neeg siv = exploode ("0-1%", $ tus nqi);

yog ($ _ POST ['nkag mus'] == $ neeg siv '' 1 '] thiab md5 ($ POST [' dhau ']) == $ neeg siv [' 2 ']) {

$ $ = 0; ech "Tus neeg siv zoo li no twb muaj nyob hauv cov ntaub ntawv";}

yog ($ us! = 1) {$ fp = fopen ("userdb.d", "a +");

$ mytext = preg_replace ("! / r / n!","

", $ _POST ['login']."% 1-1% ". Md5 $ _POS.

Kauj Ruam 6

Txuas txhua nplooj ntawv tsim los ua index.php. Ib qho piv txwv txog qhov yuav tsum tig tawm:

<

Kauj Ruam 7

Tom qab nqa tawm cov kev siv saum toj no, sim mus rau qhov kev sim npe rau npe. Yog tias txhua yam mus zoo, cov ntaub ntawv tshiab yuav tshwm sim hauv cov ntaub ntawv tsim - sau npe nyiaj.

Pom zoo: