Documente Academic
Documente Profesional
Documente Cultură
Register
In this module is just like as it says Registration of a user, the table structure is same as the above. Once
the user press register button the submitted data will be added to the table, and can be used for
checking whether the user name and password is valid or not.
Dash Board
Is a place where user can see after login page, it contains group creation, status update and browsing
the file of a groups or a folder created.
The right hand side menu bar for user. The user can choose 2 others module such as chat and private
messaging
if ($_FILES['file']['name']) {
//if no errors in file name or file is valid...
if (!$_FILES['file']['error']) {
$new_file_name = strtolower($_FILES['file']['tmp_name']);
//rename file to lower string
if ($_FILES['file']['size'] > 10485760) {
//The above line will check whether the file is greater than 10 mb or not if its too large then it will show
error
$valid_file = false;
echo 'Oops! Your file\'s size is to large.';
echo '<a href="index.php">Go back</a>';
}
Php will usually take upload file to the temporary folder then erase it once the session is over thats why
we need to use move_upload_file() function to specify where to store. So it wont get deleted once the
session is over
SESSION
How session is generated in php?
public function log_in($username, $password) {
$sql = "select * from users where username='".$username."' AND password='".$password."'";
$query = parent::query($sql);
$num = mysql_num_rows($query);
if($num == 1)
{
$row = mysql_fetch_assoc($query);
$_SESSION['uid'] = $row['uid'];
$_SESSION['uname'] = $row['username'];
$_SESSION['name'] = $row['name'];
$_SESSION['email'] = $row['email'];
return 1;
}
}
As we can see in the code above once the sql query is executed, Then it will check whether the
username and password Is valid or not.
If its valid then we will use $_SESSION[] function to generate the session we can specify session value by
using data from database also
EX
$_SESSION['uid'] = $row['uid'];
In this case we fetch data user id which is UID make it equal to $_SESSION[uid]
So that we can use further in any other web pages