Exemplo n.º 1
0
				<td> <hr> </td> 
				<td> <hr> </td> 
				<td> <hr> </td> 
				<td> <hr> </td> 
				<td> <hr> </td> 
			</tr>
<?php 
$user_id = $_SESSION["user_id"];
include 'mysql.php';
if ($resid) {
    $count = MySQLi_Query($resid, "select frnd_two_id from are_friends where frnd_one_id = {$user_id} union select frnd_one_id from are_friends where frnd_two_id = {$user_id}");
    echo "<tr align='center'> <td colspan='5'>Your Friends:- </td> </tr> <tr align='center'> <td colspan='5'><table align='center' >";
    echo " <table align='center' cellspacing='5' cellpadding='5'> \n\t\t\t\t<tr> <th> Name: </th> <th> Email: </th> <th> Gender: </th> </tr>";
    while (($rows = MySQLi_Fetch_Row($count)) == True) {
        $query = "select name,email,gender from students where id = {$rows['0']} ";
        $result = MySQLi_Query($resid, $query);
        if ($result) {
            while (($rows = MySQLi_Fetch_Row($result)) == True) {
                echo "<tr align='center'>";
                echo "<td> {$rows['0']} </td> <td> {$rows['1']} </td> <td> {$rows['2']} </td>";
                echo "</tr>";
            }
        }
    }
    echo "</table> ";
}
?>
		</table>
			<footer align='center'>
			&copy; All Rights Reserved.	
			</footer>
    if (MySQLi_Connect_Errno()) {
        echo "<tr align='center'> <td colspan='5'> Failed to connect to MySQL </td> </tr>";
    } else {
        $check_email = MySQLi_Query($res_id, "select name from students where email='" . $email . "'");
        $r_email = MySQLi_Fetch_Row($check_email);
        if ($r_email) {
            echo "<tr align='center'> <td colspan='5'> <font color='red'> Email already Registered, Registration Failed!  </font>  </td> </tr>";
        } else {
            $count = MySQLi_Query($res_id, "select (max(id)+1) as count  from students");
            $count_id = MySQLi_Fetch_Assoc($count);
            if ($count_id["count"]) {
                $query = "insert into students values (" . $count_id["count"] . ",'{$name}','{$email}',{$age},'{$gender}','{$password}')";
            } else {
                $query = "insert into students values (1,'{$name}','{$email}',{$age},'{$gender}','{$password}')";
            }
            $res = MySQLi_Query($res_id, $query);
            if ($res) {
                echo "<tr align='center'> <td colspan='5'> <font color='green'> Registration Successful! </font> You may login now from here:- <a href='login.php'>Login</a></td> </tr>";
            } else {
                echo "<tr align='center'> <td colspan='5'> <font color='red'> Registration Failed! </font> </td> </tr>";
            }
        }
        MySQLi_Close($res_id);
    }
}
?>
 			
		</table>
			<footer align='center'>
			&copy; All Rights Reserved.	
			</footer>
Exemplo n.º 3
0
 $MySQL = @MySQLi_Connect($__SETTINGS['db-server'], 'root', $__SETTINGS['db-root'], $__SETTINGS['db-name'], $__SETTINGS['db-port']);
 if ($MySQL) {
     #-------------------------------------------------------------------------
     $Query = SPrintF("UPDATE `mysql`.`user` SET `Super_priv` = 'Y' WHERE `user` = '%s';", $__SETTINGS['db-user']);
     #-------------------------------------------------------------------------
     $Result = @MySQLi_Query($MySQL, $Query);
     if ($Result) {
         #-----------------------------------------------------------------------
         $Query = SPrintF("GRANT ALL ON `%s`.* TO '%s'@'%%';", $__SETTINGS['db-user'], $__SETTINGS['db-name']);
         #-----------------------------------------------------------------------
         $Result = @MySQLi_Query($MySQL, $Query);
         if ($Result) {
             #---------------------------------------------------------------------
             $Query = 'flush privileges;';
             #---------------------------------------------------------------------
             $Result = @MySQLi_Query($MySQL, $Query);
             if ($Result) {
                 #-------------------------------------------------------------------
                 Message('Права для пользователя успешно установлены');
                 #-------------------------------------------------------------------
                 $__STEP_ID = 8;
             } else {
                 Error(SPrintF('Не удалось выполнить запрос (%s) (%s)', $Query, MySQLi_Error($MySQL)));
             }
         } else {
             Error(SPrintF('Не удалось выполнить запрос (%s) (%s)', $Query, MySQLi_Error($MySQL)));
         }
     } else {
         Error(SPrintF('Не удалось выполнить запрос (%s) (%s)', $Query, MySQLi_Error($MySQL)));
     }
 } else {
Exemplo n.º 4
0
			</tr>
			
			<?php 
//Session_start();
if (isset($_SESSION["user_id"])) {
    $id = $_SESSION["user_id"];
    $query = "select * from messages where receiver_id=" . $id . " order by id desc";
    $res_id = MySQLi_Connect('localhost', 'root', '@connectme', 'shangout');
    if (MySQLi_Connect_Errno()) {
        echo "<tr align='center'> <td colspan='5'> Failed to connect to MySQL </td> </tr>";
    } else {
        $result = MySQLi_Query($res_id, $query);
        $data = MySQLi_Fetch_Row($result);
        if ($data) {
            $query = "select name,email from students where id=" . $data[1] . "";
            $sender = MySQLi_Query($res_id, $query);
            $sender = MySQLi_Fetch_Row($sender);
            //if($data) {
            echo "<tr align='center'> <td colspan='5'> <table cellpadding='4' cellspacing='5' width='100%' style='table-layout:fixed'> <col width='100%'> ";
            echo "<td>From:- <font color='blue'>" . $sender[0] . " </font> [" . $sender[1] . "] </td> </tr>";
            echo "<tr> <td style='word-wrap:break-word'>Message:-" . $data[3] . "</td> </tr>";
            echo "</table> </td> </tr>";
        } else {
            echo "<tr align='center'> <td colspan='5'> <font color='lightblue'> No Messages! </font> </td> </tr>";
        }
        MySQLi_Close($res_id);
    }
} else {
    echo "<tr align='center'> <td colspan='5'> <font color='red'> Sorry, You not Logged in! </font> Login again:- <a href='login.php'>Login</a> </td> </tr>";
}
?>
     $res4 = MySQLi_Fetch_Row($result4);
 }
 if ($res4[0] == NULL and $res4[1] == NULL) {
     $flo = 0;
 } else {
     if ($res4[0] == 0 and $res4[1] == 0) {
         $flo = 1;
     } else {
         $flo = 2;
     }
 }
 //START:- Exclude those who are engaged and self;
 $query2 = "select status from are_friends where frnd_one_id=" . $_SESSION["user_id"] . " and frnd_two_id=" . $rows[0] . "";
 $query3 = "select status from are_friends where frnd_one_id=" . $rows[0] . " and frnd_two_id=" . $_SESSION["user_id"] . "";
 $result2 = MySQLi_Query($res_id, $query2);
 $result3 = MySQLi_Query($res_id, $query3);
 if ($result2 == true) {
     $res2 = MySQLi_Fetch_Row($result2);
 }
 if ($result3 == true) {
     $res3 = MySQLi_Fetch_Row($result3);
 }
 if ($rows[0] == $_SESSION["user_id"]) {
     $flori = 1;
 } else {
     $flori = 2;
 }
 if ($res2[0] == 1 or $res3[0] == 1 or $flo == 1 or $flori == 1) {
 } else {
     echo "<tr align='center'> <td align='left'>" . $rows[1] . "</td> <td align='left'> <form method='POST' action='sendfr.php'>\n\t\t\t\t\t\t\t<input type='hidden' name='h1' value='" . $rows[0] . "'>\n\t\t\t\t\t\t\t<input type='hidden' name='h2' value='" . $rows[1] . "'>\n\t\t\t\t\t\t\t<input type='submit' name='sfr' value='Send Request'>\n\t\t\t\t\t\t\t</form></td> </tr>";
 }