function login($email, $pass) { include "finalapp_hosted_dbconn.php"; $sql = "SELECT fname, lname, email, pass, validated\n\t\t\t\t FROM login\n\t\t \t\t WHERE email = '{$email}'\n\t\t \t\t AND pass = '******'"; $retval = mysql_query($sql, $conn) or die("Failed"); if (mysql_num_rows($retval)) { while ($row = mysql_fetch_assoc($retval)) { $user = $row['email']; $pass = $row['pass']; $validated = $row['validated']; $fname = $row['fname']; $lname = $row['lname']; if ($validated == "n") { echo "not approved"; } else { $msg = getApproved($email); echo $msg; } //end else } // end while } else { echo "wrong"; } // end else mysql_close($conn); }
<?php session_start(); function getApproved() { include "finalapp_hosted_dbconn.php"; $email = $_SESSION['email']; $sql = "SELECT listid FROM approved WHERE email = '{$email}'"; $retval = mysql_query($sql, $conn) or die("Failed"); $approvedList = array(); if (mysql_num_rows($retval)) { while ($row = mysql_fetch_assoc($retval)) { $approvedList[] = $row['listid']; } } $_SESSION['approvedList'] = $approvedList; } getApproved();