Base64_encode
| From: | Liz | Date: | Wed, 17 Oct 2001 11:45:28 +0000 |
| Subject: | Base64_encode | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-3678@lists.php.net to get a copy of this message | ||
Can anyone verify with me that the base64_encode doesn't seem to handle
>4K??
Such as.. The following causes PHP to crash under windows.. But seems OK
under linux. (Sorry its spammy, but this was my working example)
<?
$mystring="<html>
<head>
<title>Purchasing Requirements</title>
<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=iso-8859-1\">
<link rel=\"stylesheet\" href=\"purchasing.css\"
type=\"text/css\">
</head>
<body bgcolor=\"#CC9966\" text=\"#000000\">
<table width=\"100%\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\">
<tr bgcolor=\"#993300\">
<td height=\"20\" width=\"612\"><b><font
color=\"FAE6C9\"
size=\"+1\">PURCHASING REQUIREMENTS</font></b></td>
<td height=\"20\" width=\"235\" align=\"right\"
bgcolor=\"#993300\">
<a href=\"tracker.php\"><font color=\"FAE6C9\"
size=\"2\">Track</font></a>
</td>
</tr>
</table>
<br>
<table width=\"100%\" border=\"0\" cellspacing=\"1\"
bgcolor=\"#993300\">
<tr valign=\"top\">
<td width=\"12%\" bgcolor=\"#FFCC99\" height=\"18\"><font
size=\"2\"><b>Your Name</b></font></td>
<td width=\"34%\" bgcolor=\"#CC9966\" height=\"18\"><font
size=\"2\">$username
</font></td>
<td width=\"12%\" bgcolor=\"#FFCC99\" height=\"18\"><font
size=\"2\"><b>Department</b></font></td>
<td height=\"18\" bgcolor=\"#CC9966\" colspan=\"3\"><font
size=\"2\">$department
</font></td>
</tr>
<tr valign=\"top\">
<td bgcolor=\"#FFCC99\"><font
size=\"2\"><b>Email</b></font></td>
<td bgcolor=\"#CC9966\"><font size=\"2\">$useremail
</font></td>
<td colspan=\"4\" bgcolor=\"#CC9966\"
rowspan=\"3\"> </td>
</tr>
<tr valign=\"top\">
<td bgcolor=\"#FFCC99\"><font size=\"2\"><b>Phone
#</b></font></td>
<td bgcolor=\"#CC9966\"><font size=\"2\">$userphone
</font></td>
</tr>
<tr valign=\"top\">
<td bgcolor=\"#FFCC99\"><font
size=\"2\"><b>Authoriser</b></font></td>
<td bgcolor=\"#CC9966\"><font size=\"2\"> $authoriser
</font></td>
</tr>
<tr valign=\"top\">
<td bgcolor=\"#FFCC99\">
<p><font size=\"2\"><b>Type of
request</b></font><font
size=\"2\"><b>st</b> </font></p>
</td>
<td bgcolor=\"#CC9966\"><font size=\"2\">$requesttype
</font></td>
<td colspan=\"4\" bgcolor=\"#CC9966\"><font
size=\"2\">The items
will be $methodtype
<br>
The items will be $recharge to $rechargedto
</font></td>
</tr>
<tr valign=\"top\" bgcolor=\"#FFCC99\">
<td colspan=\"4\" bgcolor=\"#FFCC99\"><b><font
size=\"2\">Description</font></b></td>
<td><b><font size=\"2\">Quantity</font></b></td>
<td><b><font size=\"2\">Cost</font></b></td>
</tr>";
$tcost=0;
$titems=0;
for ($i=0; $i<count($description); $i++)
{
$mystring .="
<tr bgcolor=\"#CC9966\">
<td colspan=\"4\"><font
size=\"2\">".$description["$i"]."
</font> </td>
<td width=\"13%\"> <font
size=\"2\">".$quantity["$i"]."
</font> </td>
<td width=\"11%\"> <font
size=\"2\">".$cost["$i"]."
</font> </td>
</tr>";
$titems=$titems+doubleval($quantity["$i"]);
$tcost=$tcost+(doubleval($cost["$i"])*doubleval($quantity["$i"]));
}
$mystring .=" <tr bgcolor=\"#CC9966\">
<td colspan=\"4\" bgcolor=\"#FFCC99\"><font
size=\"2\">
<b>TOTAL</b> </font> </td>
<td width=\"13%\"> <font size=\"2\">
<b>$titems</b>
</font> </td>
<td width=\"11%\"> <font size=\"2\">
<b>$tcost</b>
</font> </td>
</tr>
<tr valign=\"top\" bgcolor=\"#FFCC99\">
<td colspan=\"6\"><font
size=\"2\"><b>Justification</b></font></td>
</tr>
<tr valign=\"top\">
<td colspan=\"6\" bgcolor=\"#CC9966\">
<font size=\"2\">$justification</font>
</td>
</tr>
<tr valign=\"top\">
<td bgcolor=\"#FFCC99\"><b><font size=\"2\">Date
required</font></b></td>
<td colspan=\"5\" bgcolor=\"#CC9966\"><font
size=\"2\">
<font size=\"2\">$daterequired</font>
</font></td>
</tr>
</table>
</body>
</html>
";
$newstr=base64_encode($mystring);
?>