PDA

View Full Version : Why This Error?


Colossus
06-16-2003, 05:59 PM
<title>Password Generator</title>
</head>
<body>
<?php
$String="This is the text which will be encrypted so that we may create random and secure passwords!";
$Length=8; ##Change this value to indicate how long your passwords should be. There is a 32 character limit. ##
$String=md5($String)
$StringLength= strlen($String);
srand ((double) microtime() * 1000000
$Begin=rand(0,($StringLength-$Length-1));
## Pick an arbitrary starting point. ##
$Password=substr($String, $Begin, $Length);
$TotalCost= $Number*$Bud;
print ("Your recommended password is: <P><BIG>$Password</BIG>\n");
?>
</body>
</html>

I get an unexpected T_VARIABLE on line 11, what have I done wrong?

Thanks.

pardicity3
06-16-2003, 06:37 PM
You need to end every one of your statements with a sem-colon ( ; )

I modified your code to show your mistakes:
<title>Password Generator</title>
</head>
<body>
<?php
$String="This is the text which will be encrypted so that we may create random and secure passwords!";
$Length=8; ##Change this value to indicate how long your passwords should be. There is a 32 character limit. ##
$String=md5($String);
$StringLength= strlen($String);
srand ((double) microtime() * 1000000);
$Begin=rand(0,($StringLength-$Length-1));
## Pick an arbitrary starting point. ##
$Password=substr($String, $Begin, $Length);
$TotalCost= $Number*$Bud;
print ("Your recommended password is: <P><BIG>$Password</BIG>\n");
?>
</body>
</html>
Also, do you know what version of PHP you are using? If it is more current than 4.2.0 you don't need to use the srand() function any more.

Colossus
06-16-2003, 07:11 PM
Thanks :)

BTW - PHP Version 4.3.1 :)