forked from mary1afshar/bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
33 lines (28 loc) · 847 Bytes
/
Copy pathfunctions.php
File metadata and controls
33 lines (28 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
function check_login($connect) {
if(isset($_SESSION['user_id'])) {
// something is posted
$id = $_SESSION['user_id'];
$query = "select * from bridge_infomatics where user_id = '$id' limit 1";
$result = mysqli_query($connect, $query);
if ($result && mysqli_num_rows($result) > 0) {
$user_data = mysqli_fetch_assoc($result);
return $user_data;
}
}
//redirect to meet page
header("Location: meet.php");
die("Logged out!");
}
function random_num($length) {
$text ="";
if($length < 5){
$length = 5;
}
$len = rand(4, $length);
for ($i=0; $i < $len; $i++){
$text .= rand(0, 9);
}
return $text;
}
?>