Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
[PHP]Generowanie losowego ciągu liczb, małych/dużych liter, znaków
#1
Poniższa funkcja generuje losowy ciąg znaków, składający sie z liczb, małych/dużych liter i znaków.
Jako argument pobiera długość ciągu.

Kod PHP:
function GenRandom($howlong

$chars "abcdefghijklmnoprstuwxyzq"
$chars .= "ABCDEFGHIJKLMNOPRSTUWZYXQ"
$chars .= "1234567890"
$chars .= "~`!@#$%^&*()_+-={}[]:\";'<>?,./\|";
$pass ""
$len strlen($chars) - 1
for(
$i =0$i $howlong$i++) 
  { 
   
$random rand(0$len); 

       
$output .=  $chars[$random]; 
   } 
return 
$output
}; 
Chcesz pomóc? Wstaw jako sygnature na innym forum:
[Obrazek: 993a3cb39134bda0.gif]
Kod znajdziesz tutaj: http://forum.pcmod.pl/viewtopic.php?pid=522#p522

Asus P5K WS :: E2160 @ 3,63GHz BOX :: 2x1GB Geil Ultra DDR2 800MHz CL4 :: Galaxy 7600GS 128MB 1.4ns 500/1400 @ 600/1800 16k 03 :: Seagate ST3250410AS 250GB :: Amacrox Warrior AX-450PNF
Odpowiedz
#2
a co dopisać jak byśmy chcieli aby losowane znaki się powtarzały
Odpowiedz
#3
Creating a robust and secure system for generating random strings, including numbers, lowercase/uppercase letters, and special characters, is crucial in the academic world. Researchers and students often deal with sensitive data, so privacy is important. When seeking Online Dissertation Help London UK , having a reliable data encryption system and secure access is invaluable. It's not just about the content itself; it's also about protecting the research process, making the quest for academic excellence a seamless and protected journey.
Odpowiedz


Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości