コード例 #1
0
ファイル: viewcr.php プロジェクト: 0xc0d3r/Attendance-Portal
require "functions.php";
function viewcr($branch, $class, $gender)
{
    include 'config/db.php';
    include 'config/settings.php';
    include 'config/globals.php';
    $dbname = $branchyear . '_Users';
    $table = $branchyear . '_CRs';
    //if(!mysql_select_db($dbname)) die(mysql_error());
    $q = "select Id, Name, Gender, Branch, Class from {$table} where (Branch = '{$branch}' and Class = '{$class}') and Gender = '{$gender}' ;";
    $res = mysql_query($q) or die(mysql_error());
    $n = mysql_num_rows($res);
    $row = mysql_fetch_array($res);
    $d = $dict[$row['Gender'] . '1'];
    $name = ucwords(strtolower($row['Name']));
    $branch = $row['Branch'];
    $class = $row['Class'];
    echo "Do you want to replace <b>{$name}</b>, <b>{$d}</b> CR of <b> {$branch}{$class} </b>";
}
if (!check('BA')) {
    echo "Error : You are not authorised to perform this operation";
} else {
    if (isset($_POST['view'])) {
        $branch = addslashes($_POST['Branch']);
        $class = addslashes($_POST['Classno']);
        $gender = addslashes($_POST['Gender']);
        viewcr($branch, $class, $gender);
    } else {
        echo "Error : Invalid input";
    }
}
コード例 #2
0
ファイル: key.php プロジェクト: 0xc0d3r/Attendance-Portal
\t\t\t<option value=''>Gender</option>
\t\t\t<option value="M">Boys</option>
\t\t\t<option value="F">Girsl</option>
\t\t\t</select>
\t\t</div>
\t</div><br>
\t<input type="submit" class="btn btn-primary " name='view' value='Browse &rarr;' /><br><br><br>
\t</form>
a;
    } else {
        echo '<br><br>';
        //print_r($_POST);
        $branch1 = $globalbranch;
        $class1 = addslashes($_POST['cls']);
        $gender1 = addslashes($_POST['Gender']);
        if (strlen(trim($class1)) == 0) {
            echo "<script>show_error('Error : Class should not be null');</script>";
            exit;
        }
        if (strlen(trim($gender1)) == 0) {
            echo "<script>show_error('Error : CR Gender should not be null');</script>";
            exit;
        }
        viewcr($branch1, $class1, $gender1);
    }
    echo "</div></div><div class='span3'>";
    sidepanel();
    echo "</div></div>";
    display_footer();
    echo "\n</body>\n</html>";
}