Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions access.profile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?php
require ('core.inc.php');
include('connect.php');
if(loggedin()) {
include ('headerlogin.php');
}else {
include_once ('header.php');
}
?>
<head>
<title> View Profile | The Hub </title>
<script type="text/javascript">
function viewContribution () {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}else {
xmlhttp = new ActiveObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById('typeOfQuery').innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('POST', 'source.code.profile.access.php', true)
xmlhttp.send ();
}
</script>
</head>
<div class="container-fluid row">
<div class="col-md-4">
<!--Card-->
<div class="card card-cascade narrower">

<!--Card image-->
<div class="view overlay hm-white-slight">
<?php
$sql= "SELECT * FROM profile WHERE session ='".$_SESSION['profile']."' ORDER BY id DESC LIMIT 1";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
$img = $row['profile_pic'];
$dirname = 'profile/'.$img;
$images = glob ($dirname."*");
if ($images) {
echo '<img src="'.@$images[0].'" class="img-fluid" alt="profile picture">';
}
}
?>
<a>
<div class="mask waves-effect waves-light"></div>
</a>
</div>
<!--/.Card image-->

<!--Card content-->
<div class="card-block text-center">
<?php
$sql= "SELECT * FROM registration WHERE email ='".$_SESSION['profile']."'";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
echo '<!--Title-->
<h4 class="card-title"><strong>'.$row["first_name"].' '.$row["last_name"].'</strong></h4>
<h5>'.$row["PhoneNumber"].'</h5>

<p class="card-text">My expertise lie in the following fields: '.$row["Abilities"].' </p>';
}
?>
<!-- Switch -->
<h6>Available for employment</h6>
<!--/.Card content-->

</div>
<!--/.Card-->
</div>
</div>
<div class="col-md-8" id="typeOfQuery">
<p>View source codes contributions by user
<button class="btn btn-md indigo" type="submit"><a onclick="viewContribution()" onmouseover="toastr.info('View source code files contribution by user within the community');" style="color: white;">here</a></button>
</p><hr>
<p><div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
Contributions made by
<?php
$sql= "SELECT * FROM registration WHERE email ='".$_SESSION['profile']."'";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
echo '<!--Title-->
<h4 class="card-title"><strong>'.$row["first_name"].' '.$row["last_name"].'</strong></h4>';
} ?>
</div></p><hr>
<?php
$sql= "SELECT * FROM profile WHERE session = '".$_SESSION['profile']."' ORDER BY id DESC LIMIT 1";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
$img = $row['profile_pic'];
$dirname = 'profile/'.$img;
$images = glob ($dirname."*");
if ($images) {
$sql= "SELECT * FROM prog_new WHERE session = '".$_SESSION['profile']."' ORDER BY id DESC";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
echo ' <div class="card card-block">
<div class="chip">
<img src="'.@$images[0].'" alt="Contact Person"> '.$row['first_name'].'
</div><hr>
<div class="col-md-8 text-center>">'.$row['news'].'</div>
</div>
';
}
}
}
?>
</div>

<?php
if (!loggedin()) {
include 'footer.php';
}else {
include 'loggedin.footer.php';
}
?>
147 changes: 147 additions & 0 deletions account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<head>
<title> Profile | The Hub </title>
<script type="text/javascript">
//ajax function to be called later in the code
function codeContribution () {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}else {
xmlhttp = new ActiveObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById('typeOfQuery').innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('POST', 'source.code.profile.php', true)
xmlhttp.send ();
}
</script>
</head>

<?php
require ('core.inc.php');
include('connect.php');
//checking whether or not the user is logged into an account
if (loggedin()) {
include ('headerlogin.php');
}else {
//if not logged in, do not show user page. Kill page and return error message
echo '<div class="card card-block text-center"><h5 style="color:red; font-style:bold;"> Unauthorised entry. </h5></div>';
die();
}
?>
<!--main wrapper-->
<div class="container-fluid row">
<div class="col-md-4">
<!--Card-->
<div class="card card-cascade narrower">

<!--Card image-->
<div class="hm-white-slight">
<?php
//selecting user details from profile table in database using email addresses saved as sessions
$sql= "SELECT * FROM profile WHERE session ='".$_SESSION['email']."' ORDER BY id DESC LIMIT 1";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
//selecting image name from profile table and searching through directory to see if image name exists
$img = $row['profile_pic'];
$dirname = 'profile/'.$img;
$images = glob ($dirname."*");
if ($images) {
//displaying image onto card after image name is found in directory
echo '<img src="'.@$images[0].'" class="img-fluid" alt="profile picture">';
}
}
?>
<a>
<div class="mask waves-effect waves-light"></div>
</a>
<!--link to upload profile picture unto card -->
<a class="button" href="upload.profile.pic.php"><i class="fa fa-camera"></i>upload Profile Photo </a>
</div>
<!--/.Card image-->

<!--Card content-->
<div class="card-block text-center">
<?php
//selecting details of user from registration table using email saved as sessions
$sql= "SELECT * FROM registration WHERE email ='".$_SESSION['email']."'";
$result = mysqli_query($link, $sql);
//saving row data into a variable and then outputting columns onto page
while (@$row = mysqli_fetch_array($result)) {
echo ' <!--Title-->
<h4 class="card-title"><strong>'.$row["first_name"].' '.$row["last_name"].'</strong></h4>
<h5>'.$row["PhoneNumber"].'</h5>
<p class="card-text">My expertise lie in the following fields: '.$row["Abilities"].' </p>';
}
?>
<!-- Switch -->
<h6>Available for employment</h6>
<div class="switch">
<label>
Yes
<input type="checkbox">
<span class="lever"></span>
No
</label>
</div>

</div>
<!--/.Card content-->

</div>
<!--/.Card-->
</div>
<!--ajax function called into the following div-->
<div class="col-md-8" id="typeOfQuery">
<!--same form used in read.php to input user data into one table in database to be used by both pages -->
<form action="read.php" method="POST" enctype="multipart/form-data">
<div class="row">
<div class="input-group md-form">
<textarea class="md-textarea text-center" name="text" placeholder="Contribute to our open source community by posting relevant and appropriate content here. All posts here also appear inside our imteractive section, where it is available for all members to read" id="text" required></textarea></div>
<button type="submit" class="btn-indigo btn-block btn" name="submit">Post</button></div><hr>
</form>
<p>View your source codes contributions
<!--calling ajax funtion to reload this div to source code page when button is clicked-->
<button class="btn btn-md indigo" type="submit"><a onclick="codeContribution()" onmouseover="toastr.info('View your source code files contribution within the community');" style="color: white;">here</a></button>
</p><hr>
<p><div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
See your posts here.
</div></p> <hr>
<?php
//selecting data from table profile in database using email stored in session and ordering by magnitude
$sql= "SELECT * FROM profile WHERE session = '".$_SESSION['email']."' ORDER BY id DESC LIMIT 1";
$result = mysqli_query($link, $sql);
//fetching rows
while (@$row = mysqli_fetch_array($result)) {
//selecting image from directory using corresponding image name from database table
$img = $row['profile_pic'];
$dirname = 'profile/'.$img;
$images = glob ($dirname."*");
if ($images) {
//if the image exists, select from table prog_new where the user posts are stored.
//selecting data column by column using logged in user's email saved as session
$sql= "SELECT * FROM prog_new WHERE session = '".$_SESSION['email']."' ORDER BY id DESC";
$result = mysqli_query($link, $sql);
//fetching rows in table prog_new
while (@$row = mysqli_fetch_array($result)) {
echo ' <div class="card card-block">
<div class="chip">
<img src="'.@$images[0].'" alt="Contact Person"> '.$row['first_name'].'
</div><hr>
<div class="col-md-8 text-center>">'.$row['news'].'</div>
</div>
';
}
}
}
?>
</div>
<!--/ajax div end-->
</div>
<!--/wrapper end-->
<?php
include ('loggedin.footer.php');
?>
45 changes: 45 additions & 0 deletions all.users.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<title>Users | The Hub </title>
<?php
require ('core.inc.php');
include('connect.php');
if(loggedin()) {
include ('headerlogin.php');
}else {
include_once ('header.php');
}
$sql= "SELECT * FROM registration";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
echo '
<div class="container-fluid">
<div class="card-group">
<!--Card-->
<div class="card card-personal">
<!--Card content-->
<div class="card-block">
<a><h4 class="card-title">'.$row["first_name"].' '.$row["last_name"].'</h4></a>
<!--Text-->
<p class="card-text">'.$row['first_name'].'\'s expertise lie in the following fields: '.$row["Abilities"].'</p>

<hr>
<a class="card-meta"><i class="fa fa-user"></i>'.$row["PhoneNumber"].'</a>
<p class="card-meta float-right"><a href="verify.user.php?search_user='.$row['email'].'"> View Profile</a></p>
</div>
<!--/.Card content-->
</div>
<!--/.Card-->
</div><br>
<!--/Card group-->
</div>
';

}
?>

<?php
if (!loggedin()) {
include 'footer.php';
}else {
include 'loggedin.footer.php';
}
?>
29 changes: 29 additions & 0 deletions code.conduct.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
require ('core.inc.php');
if (loggedin()) {
include ('headerlogin.php');
}else {
include ('header.php');
} ?>
<title> Code of Conduct | The Hub </title>
<!-- intro section -->
<div id="intro" class="text-xs-center">
<div class="text-center" id="intro-section">
<img src="img/thehub.ico.jpg" width="60" height="60">
<div class="col-md-6 container">
<h2>Code of Conduct</h2>
<p>Feel free to use available source code in your projects anytime and anywhere you want, but be sure
to acknowledge the author of the source code you are using. Acknowledge The Programmers Hub community
in any project you complete using tools and materials from this platform. Do not try to tamper with the integrity of this website.
If you find a flaw in our programs, be sure to report to us immediately so we can fix it. Do not try to dupe or scam anyone using this platform.
Most importantly, above all else, have fun using the resources of this community.</p>
</div>
</div>
</div>
<!-- /. intro section -->
<?php
if (!loggedin()) {
include 'footer.php';
}else {
include 'loggedin.footer.php';
} ?>
30 changes: 30 additions & 0 deletions comment.find.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
require ('core.inc.php');
include('connect.php');
if (isset($_GET['comment'])&&!empty($_GET['comment'])) {
$target = mysqli_real_escape_string($link, $_GET['comment']);

$sql= "SELECT * FROM prog_new WHERE news ='".$target."'";
$result = mysqli_query($link, $sql);
$count = mysqli_num_rows($result);

if ($count==1) {
while (@$row = mysqli_fetch_array($result)) {
$name = $row['id'];
$_SESSION['question'] = $name;
header ('Location: comment.php');
}
}else {
if(loggedin()) {
include ('headerlogin.php');
}else {
include_once ('header.php');
}
echo '<div class="alert alert-danger">
Sorry, you cannot comment at the moment. We will work on fixing the problem as soon as possible. Thank you.
</div>';
die(); }
}else {
echo "no";
}
?>
Loading