Waarschijnlijk zie ik in onderstaand stukje script iets verschrikkelijks stoms over het hoofd.
Als ik in de regel met 'startwaarde: $A $B $C $D $mode eindwaarde' de comments weghaal zie ik dat op dat punt de variabelen $A t/m $D allemaal de standaardwaarde 2 hebben. Maar if $A=1 (niet waar dus de code niet uitvoeren) voert hij de code erna wel uit.
Waarom werken de if-statements niet? Wat zie ik over het hoofd?
ter info:PHP Code:<?php
$mode = $_GET['Mode'];
$pub = "";
$A = 2;
$B = 2;
$C = 2;
$D = 2;
if ($mode > 8) {
$mode = $mode - 8;
$A = 1;
}
if ($mode > 4) {
$mode = $mode - 4;
$B = 1;
}
if ($mode > 2) {
$mode = $mode - 2;
$C = 1;
}
if ($mode > 1) {
$mode = $mode - 1;
$D = 1;
}
$pub = $pub . '<table border="0" cellpadding="0" cellspacing="0">';
// $pub = $pub . "<tr><td>startwaarde: $A $B $C $D $mode eindwaarde</td></tr>";
if ($A = 1) {
$pub = $pub . '<tr><td><a href="http://www.webhostingstuff.com/verified/TornadoSolutions.html" title="Tornado Solutions Guarantee" target="_blank"><img src="http://www.webhostingstuff.com/images/hosting-ethics/TornadoSolutions.gif" alt="Tornado Solutions Guarantee" border="0"></a></td></tr><tr><td><a href="http://www.webhostingstuff.com" title="business web hosting" target="_blank"><img src="http://www.webhostingstuff.com/images/ethics/business-web-hosting.gif" alt="business web hosting" border="0"></a></td></tr>';
}
if ($B = 1) {
$pub = $pub . '<tr><td><a href="http://www.webhostingstuff.com/uptime/TornadoSolutions.html" title="Tornado Solutions Uptime" target="_blank"><img src="http://www.webhostingstuff.com/images/server-uptime/TornadoSolutions.gif" alt="Tornado Solutions Uptime" border="0"></a></td></tr><tr><td><a href="http://www.webhostingstuff.com" title="business web hosting" target="_blank"><img src="http://www.webhostingstuff.com/images/uptime/business-web-hosting.gif" alt="business web hosting" border="0"></a></td></tr>';
}
if ($C = 1) {
$pub = $pub . '<tr><td><a href="http://www.webhostingstuff.com/addcomments/TornadoSolutions.html" title="Write Tornado Solutions Review" target="_blank"><img src="http://www.webhostingstuff.com/images/host-review/TornadoSolutions.gif" alt="Write Tornado Solutions Review" border="0"></a></td></tr><tr><td><a href="http://www.webhostingstuff.com" title="web hosting" target="_blank"><img src="http://www.webhostingstuff.com/images/host-reviews/web-hosting.gif" alt="web hosting" border="0"></a></td></tr>';
}
if ($D = 1) {
$pub = $pub . '<tr><td><a href="http://www.webhostingstuff.com/review/TornadoSolutions.html" title="Tornado Solutions Review" target="_blank"><img src="http://www.webhostingstuff.com/images/hosting-review/TornadoSolutions.gif" alt="Tornado Solutions Review" border="0"></a></td></tr><tr><td><a href="http://www.webhostingstuff.com" title="web hosting" target="_blank"><img src="http://www.webhostingstuff.com/images/review/web-hosting.gif" alt="web hosting" border="0"></a></td></tr>';
}
echo $pub
?>
</table>
het script laat 4 webhostingstuff iconen zien. (te zien op de website in mn sig, rechts op de site) Door een bitcode (bv 1010) om te rekenen naar decimaal en mee te geven aan Mode kan ik in dit geval alleen iconen 1 en 3 weergeven. Code 1001 laat dan bijvoorbeeld alleen 1 en 4 zien en 1111 laat alles zien. Maar dit wil dus nog niet helemaal.

Likes:



