Jump to content
php.lv forumi

Txt Help


Braiens

Recommended Posts

Kads pasaka tas mazas rindinas kas lauj select from *.txt faila

Piem.

<code><font color="#000000">
<font color="#0000CC"><? 
$pass </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/file]file[/url]</font><font color="#006600">(</font><font color="#CC0000">"pass.txt"</font><font color="#006600">);
</font><font color="#FF9900">// un kas sheit butu jaliek lai vins auto select no ta faila
</font><font color="#006600">if (</font><font color="#0000CC">[url=http://lv.php.net/md5]md5[/url]</font><font color="#006600">(</font><font color="#0000CC">$parole</font><font color="#006600">)==</font><font color="#0000CC">$pass</font><font color="#006600">) {
echo </font><font color="#CC0000">"tu ievadiji paroli pareizi"</font><font color="#006600">;
} else {
echo </font><font color="#CC0000">"Tinies"</font><font color="#006600">;
}
</font><font color="#0000CC">?></font>
</font>
</code>

Link to comment
Share on other sites

<?

$pass = file("pass.txt");

 

if (md5($parole)==$pass[0]) {////site ieliec [0]

echo "tu ievadiji paroli pareizi";

} else {

echo "Tinies";

}

?>

Link to comment
Share on other sites

Re pacs sataisiju:

Fails forma.php

<code><font color="#000000">
<font color="#0000CC"><?
</font><font color="#006600">if (</font><font color="#0000CC">$parole </font><font color="#006600">== </font><font color="#CC0000">""</font><font color="#006600">) {
echo </font><font color="#CC0000">"<form  action="" method="</font><font color="#0000CC">post</font><font color="#CC0000">">
<input name="</font><font color="#0000CC">parole</font><font color="#CC0000">" type="</font><font color="#0000CC">text</font><font color="#CC0000">" value="">
<input type="</font><font color="#0000CC">submit</font><font color="#CC0000">" value="</font><font color="#0000CC">ap</font><font color="#CC0000">" name="</font><font color="#0000CC">ap</font><font color="#CC0000">">
</form>"</font><font color="#006600">;
} else {
</font><font color="#0000CC">$open </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/fopen]fopen[/url]</font><font color="#006600">(</font><font color="#CC0000">"pass.txt"</font><font color="#006600">,</font><font color="#CC0000">"r"</font><font color="#006600">);
while(!</font><font color="#0000CC">[url=http://lv.php.net/feof]feof[/url]</font><font color="#006600">(</font><font color="#0000CC">$open</font><font color="#006600">))
{
if(</font><font color="#0000CC">$line </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/fgets]fgets[/url]</font><font color="#006600">(</font><font color="#0000CC">$open</font><font color="#006600">, </font><font color="#0000CC">4096</font><font color="#006600">)) {
</font><font color="#0000CC">$pass </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/explode]explode[/url]</font><font color="#006600">(</font><font color="#CC0000">"_"</font><font color="#006600">, </font><font color="#0000CC">$line</font><font color="#006600">);
if (</font><font color="#0000CC">[url=http://lv.php.net/md5]md5[/url]</font><font color="#006600">(</font><font color="#0000CC">$parole</font><font color="#006600">)==</font><font color="#0000CC">$pass</font><font color="#006600">[</font><font color="#0000CC">0</font><font color="#006600">]) {
echo </font><font color="#CC0000">"tu ievadiji paroli pareizi"</font><font color="#006600">;
}
}
}
</font><font color="#0000CC">[url=http://lv.php.net/fclose]fclose[/url]</font><font color="#006600">(</font><font color="#0000CC">$open</font><font color="#006600">);
}
</font><font color="#0000CC">?></font>
</font>
</code>

un re fails pass.txt

<code><font color="#000000">
098f6bcd4621d373cade4e832627b4f6_
3591daf03f80ee638643d8e173087e83_</font>
</code>

Link to comment
Share on other sites

×
×
  • Create New...