All pastes #370987 Raw Edit

Anonymous

public text v1 · immutable
#370987 ·published 2007-02-25 01:00 UTC
rendered paste body
<?php

include ("../includes/settings.php");
include ("../includes/site_functions.php");
include ("../includes/db.php");

//turn people who want to be experts into experts
//get all user information first
//wtbexpert means Want To Be experts

echo "User(s) who wish to become an expert";

if (isset($_POST['Submit'])){
$array = count($_POST['box[]']);

var_dump($_POST['box[]']);




}
else {
make_expert();
}



function make_expert(){

//$query = "select * from `user` where `user`.`wtbexpert`= 'y'";
$query = "select * from `user` ";
$result = mysql_query($query) or die(mysql_error());

echo "<form name=\"form1\" method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
echo "<table width=\"547\" border=\"0\">";
$num = 0;
while($row = mysql_fetch_array($result)){
$x = mysql_num_rows($result);
    echo "<tr>";

    $num=$num+1 ;
    //do on and off of data, to make reading easier
    //deterimine if result is odd of even.

            //make grey
          if ( $num&1 ) {

            $color = "#CCCCCC";
            echo "<td width=\"27\" bgcolor=\"".$color."\"><input type=\"checkbox\" name=\"box[]\" value=\"".$num."\" /></td>";
            echo "<td width=\"88\" bgcolor=\"".$color."\">". $row['username']."</td>";
            echo "<td width=\"438\" bgcolor=\"".$color."\">". $row['email']."</td>";
            echo "<td width=\"68\" bgcolor=\"".$color."\">view".$num."</td>";
          }
          else {
            $color = "#EAEAEA";
            echo "<td width=\"27\" bgcolor=\"".$color."\"><input type=\"checkbox\" name=\"box[]\" value=\"".$num."\" /></td>";
            echo "<td width=\"138\" bgcolor=\"".$color."\">". $row['username']."</td>";
            echo "<td width=\"338\" bgcolor=\"".$color."\">". $row['email']."</td>";
            echo "<td width=\"68\" bgcolor=\"".$color."\">view".$num."</td>";
          }

    echo "</tr>";

}
echo "<tr>";
$color1 = "#FFFFff";
    echo "<td width=\"27\" bgcolor=\"".$color1."\"></td>";
    echo "<td width=\"538\" bgcolor=\"".$color1."\"></td>";
    echo "<td width=\"68\" bgcolor=\"".$color1."\"><input type=\"submit\" name=\"Submit\" value=\"Submit\" /></td>";
echo "</tr>";
echo "</table>";
echo "</form>";

}





?>