This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
printf("Hello World!\n"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
// declare three variables. | |
int a = 0, b = 0, sum = 0; | |
printf("Please enter a number: \n" ); | |
// read first variable | |
scanf("%d", &a); | |
printf("Please enter second number: \n" ); | |
// read second variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cmath> | |
using namespace std; | |
int main() | |
{ | |
//-------defining variables and initializing them------------- | |
double num1, num2; | |
char operation, redo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Login</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php session_start(); ?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Registration</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
include 'include/class.user.php'; | |
$user = new User(); | |
$uid = $_SESSION['uid']; | |
if (!$user->get_session()){ | |
header("location:login.php"); | |
exit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// filename: include/register.php | |
session_start(); | |
//n | |
include 'class.user.php'; | |
$user = new User(); // Checking for user logged in or not | |
if (isset($_REQUEST['register'])){ | |
extract($_REQUEST); | |
$register = $user->reg_user($fullname, $uname,$upass, $uemail); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// filename: include/login.php | |
session_start(); | |
include 'class.user.php'; | |
if (isset($_REQUEST['login'])) { | |
$user = new User(); | |
extract($_REQUEST); | |
$login = $user->check_login($emailusername, $password); | |
if ($login) { | |
// Registration Success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// filename include/connection.php | |
define('DB_SERVER', 'localhost'); | |
define('DB_USERNAME', 'root'); | |
define('DB_PASSWORD', ''); | |
define('DB_DATABASE', 'oop'); | |
function db () { | |
static $conn; | |
if ($conn===NULL){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// filename: include/class.user.php | |
include 'connection.php'; | |
class User{ | |
public $db; | |
/*** for registration process ***/ | |
public function reg_user($name,$username,$password,$email){ | |
$conn = db(); |
OlderNewer