Skip to content

Commit

Permalink
Front end programing for survey/ All form PHP/ Updated DB/ created da…
Browse files Browse the repository at this point in the history
…ta login page to view form data

temporary datalogin.php login credentials can be found in config.php
file
  • Loading branch information
robcapell committed Jun 14, 2013
1 parent 41c070b commit b3c758d
Show file tree
Hide file tree
Showing 7 changed files with 739 additions and 290 deletions.
7 changes: 6 additions & 1 deletion config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php
$con = mysqli_connect("localhost", "root", "root", "XFR");
//datalogin.php sign in info for simon below
$formdatausername = "admin";
$formdatapassword = "password";

//DB settings below
$con = mysqli_connect("localhost", "root", "password", "XFR");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
Expand Down
103 changes: 103 additions & 0 deletions datalogin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php
if ( isset( $_POST['loginsubmit'] ) )
{
include('config.php');

$myusername=$_POST['username'];
$mypassword=$_POST['password'];

$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

if ($myusername == $formdatausername && $mypassword == $formdatapassword){
session_register("myusername");
session_register("mypassword");
header("location:formdata.php");
}
else {
echo "Wrong Username or Password";
};
};

?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>XFR FORM DATA</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="style.css">
<script src="jquery.js"></script>
<script src="js/bootstrap.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body data-spy="scroll" data-target="nav">
<div id="navbttnwrapper"><div id="navbttn"></div></div>
<nav>
<!-- <div class="content"> -->
<ul class="nav">
</ul>
<!-- </div> -->
</nav>
<section id="layout">
<div class="content clearfix">
<form style="margin: 200px auto; width:220px;" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
<input type="text" name="username" placeholder="username">
<input type="password" name="password" placeholder="password">
<input type="submit" name="loginsubmit" id="submit1" value="Sign In">
</form>

</section>
</div>
<footer style ="height: 400px; text-align: center;">
<p>Site created by Transfer Creative. Copyright © 2013 THEXFR LLC. All rights reserved.</p>
</footer>
<script>
/*####### STICKY NAV SCRIPT ##########*/
var nav_pos = $('nav').offset().top;
var i = 0;
var sticky_nav = function()
{
var top_pos = $(window).scrollTop(); // our current vertical position from the top

if ( (top_pos > nav_pos) && ($(window).width() > 640) )
{
$('#sticky_navigation').css({ 'position': 'fixed', 'top':0, 'left':0, 'z-index':9999999});
}
else
{
$('#sticky_navigation').css({ 'position': 'relative', 'top':0, 'left':0 });
}
};

$(window).scroll(function()
{
if (i <= 1)
{
nav_pos = $('nav').offset().top;
i = 1;
};
sticky_nav();
});

$(window).resize(function()
{
nav_pos = $('nav').offset().top;
});

$(document).ready(function()
{
$('#navbttn').click(function()
{
$('nav').toggleClass('open');
$('nav').slideToggle(250);
});
});

</script>
<script>window.scrollTo(0, 1);</script>
</body>
</html>
5 changes: 5 additions & 0 deletions datasignout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
session_start();
session_destroy();
header("location:datalogin.php");
?>
216 changes: 161 additions & 55 deletions formdata.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<?php
session_start();
if(!session_is_registered(myusername)){
header("location:datalogin.php");
}
?>
<!doctype html>
<html lang="en">
<head>
Expand All @@ -13,73 +19,173 @@
<body data-spy="scroll" data-target="nav">
<div id="navbttnwrapper"><div id="navbttn"></div></div>
<nav>
<div id="sticky_navigation_wrapper">
<div id="sticky_navigation">
<!-- <div class="content"> -->
<ul class="nav">
<li id="about1"><a href="#about">ABOUT</a></li>
<li><a href="#layout">THE LAYOUT</a></li>
<li><a href="#membership">MEMBERSHIP</a></li>
<li><a href="#connect">CONNECT</a></li>
<li><a href="#blog">BLOG</a></li>
<li id="subscribe1"><a href="#top">SUBSCRIBE TO UPDATES</a></li>
<li id="about1"><a href="datasignout.php">SIGN OUT</a></li>
</ul>
<!-- </div> -->
</div>
</div>
</nav>
<section id="layout">
<div class="content clearfix">
<div class="form-wrap">
<?php
include('config.php');
$i = 0;

$surveyresults = mysqli_query($con,"SELECT * FROM start UNION ALL SELECT * FROM work UNION ALL SELECT * FROM sell UNION ALL SELECT * FROM transfer ORDER BY form");

?>
$countrows = mysqli_num_rows($surveyresults);
print ("<table class='allformdata'>");
print ("<tr>");
print ("<th scope='col'>Total Survey Submissions:</th>");
print ("<th scope='col'>$countrows</th>");
print ("</tr>");
print ("</table>");

<footer>
<div class="content clearfx">
<ul class="buttons">
<li><img src="images/facebook2.png" alt="FACEBOOK"></li>
<li><img src="images/twitter2.png" alt="TWITTER"></li>
<li><img src="images/email.png" alt="EMAIL"></li>
<li><img src="images/call.png" alt="CALL"></li>
<li><img src="images/locate.png" alt="MAP"></li>
</ul>
<div class="column" id="column1">
<h3>NAVIGATION</h3>
<ul id="footernav">
<li><a href="#top">TOP</a></li>
<li><a href="#about">ABOUT XFR</a></li>
<li><a href="#layout">THE LAYOUT</a></li>
<li><a href="#membership">MEMBERSHIP</a></li>
<li><a href="#connect">CONNECT</a></li>
<li><a href="#">BLOG</a></li>
</ul>
</div>
<div class="column" id="column2">
<h3>INORMATION</h3>
<ul>
<li><a href="mailto:[email protected]">[email protected]</a></li>
<li>(267) 908-4104</li>
<li><a target="_blank" href="https://www.facebook.com/thexfr">FACEBOOK.COM/THEXFR</a></li>
<li><a target="_blank" href="http://www.twitter.com/thexfr">TWITTER.COM/THEXFR</a></li>
<li><a target="_blank" href="http://www.instagram.com/thexfr">INSTAGRAM.COM/THEXFR</a></li>
<li>THE TRANSFER STATION</li>
<li class="address">114 GREEN LANE</li>
<li class="address">PHILADELPHIA, PA 19127</li>
</ul>
</div>
<div class="column" id="column3">
<h3>THE XFR TEAM</h3>
<ul class="positions">
<li>ADAM ROGERS <span class="position">CO-FOUNDER + STRATEGIC DIRECTOR</span> <a href="mailto: [email protected]">EMAIL</a></li>
<li>SIMON ROGERS <span class="position">CO-FOUNDER + CREATIVE DIRECTOR</span> <a href="mailto:[email protected]">EMAIL</a></li>
<li>FRANKIE ZELNICK <span class="position">COMMUNICATIONS DIRECTOR</span> <a href="mailto:[email protected]">EMAIL</a></li>
<li>BRIAN MURRAY <span class="position">PARTNER</span></li>
<li>IMAR HUTCHINS <span class="position">PARTNER</span></li>
</ul>
print ("<table class='allformdata'>");
print ("<thead>");
print ("<tr>");
print ("<th scope='col'>Form</th>");
print ("<th scope='col'>IP</th>");
print ("<th scope='col'>Date and Time</th>");
print ("<th scope='col'>First Name</th>");
print ("<th scope='col'>Last Name</th>");
print ("<th scope='col'>Business Name</th>");
print ("<th scope='col'>Email Address</th>");
print ("<th scope='col'>About</th>");
print ("<th scope='col'>How did they hear</th>");
print ("<th scope='col'>Main Service</th>");
print ("<th scope='col'>Start Up Kit</th>");
print ("<th scope='col'>Office Assistant</th>");
print ("<th scope='col'>Retail Solution</th>");
print ("</tr>");
print ("</thead>");

print ("<tbody>");
while($row=mysqli_fetch_array($surveyresults)) {
if ($i % 2 == 0) {
$stripe = 'even';
} else {
$stripe = 'odd';
};

print ("<tr class='$stripe'>");
print ("<td>$row[form]</td>");
print ("<td>$row[ip]</td>");
print ("<td>$row[dt]</td>");
print ("<td>$row[firstname]</td>");
print ("<td>$row[lastname]</td>");
print ("<td>$row[businessname]</td>");
print ("<td>$row[email]</td>");
print ("<td>$row[about]</td>");
print ("<td>$row[referrer]</td>");
print ("<td>$row[mainservice]</td>");
print ("<td>$row[startupkit]</td>");
print ("<td>$row[officeassistant]</td>");
print ("<td>$row[retailsolution]</td>");
print ("</tr>");
$i++;
};
print ("</tbody>");
print ("</table>");
print ("</div><hr>");


$subscribers = mysqli_query($con,"SELECT * FROM subscribers ORDER BY dt");

print ("<div class='form-wrap'>");
$countrows = mysqli_num_rows($subscribers);
print ("<table class='allformdata'>");
print ("<tr>");
print ("<th scope='col'>Total Subcribers:</th>");
print ("<th scope='col'>$countrows</th>");
print ("</tr>");
print ("</table>");

print ("<table class='allformdata'>");
print ("<thead>");
print ("<tr>");
print ("<th scope='col'>IP</th>");
print ("<th scope='col'>Date and Time</th>");
print ("<th scope='col'>First Name</th>");
print ("<th scope='col'>Last Name</th>");
print ("<th scope='col'>Email Address</th>");
print ("</tr>");
print ("</thead>");

print ("<tbody>");
while($row=mysqli_fetch_array($subscribers)) {
if ($i % 2 == 0) {
$stripe = 'even';
} else {
$stripe = 'odd';
};
print ("<tr class='$stripe'>");
print ("<td>$row[ip]</td>");
print ("<td>$row[dt]</td>");
print ("<td>$row[firstname]</td>");
print ("<td>$row[lastname]</td>");
print ("<td>$row[email]</td>");
print ("</tr>");
$i++;
};
print ("</tbody>");
print ("</table>");
print ("</div><hr>");

$contacted = mysqli_query($con,"SELECT * FROM connect ORDER BY dt");

print ("<div class='form-wrap'>");
$countrows = mysqli_num_rows($contacted);
print ("<table class='allformdata'>");
print ("<tr>");
print ("<th scope='col'>Total Comment/Message Submissions:</th>");
print ("<th scope='col'>$countrows</th>");
print ("</tr>");
print ("</table>");

print ("<table class='allformdata'>");
print ("<thead>");
print ("<tr>");
print ("<th scope='col'>IP</th>");
print ("<th scope='col'>Date and Time</th>");
print ("<th scope='col'>First Name</th>");
print ("<th scope='col'>Last Name</th>");
print ("<th scope='col'>Business Name</th>");
print ("<th scope='col'>Email Address</th>");
print ("<th scope='col'>Phone</th>");
print ("<th scope='col'>Comments</th>");
print ("</tr>");
print ("</thead>");

print ("<tbody>");
while($row=mysqli_fetch_array($contacted)) {
if ($i % 2 == 0) {
$stripe = 'even';
} else {
$stripe = 'odd';
};

print ("<tr class='$stripe'>");
print ("<td>$row[ip]</td>");
print ("<td>$row[dt]</td>");
print ("<td>$row[firstname]</td>");
print ("<td>$row[lastname]</td>");
print ("<td>$row[businessname]</td>");
print ("<td>$row[email]</td>");
print ("<td>$row[phone]</td>");
print ("<td>$row[comments]</td>");
print ("</tr>");
$i++;
};
print ("</tbody>");
print ("</table>");
print ("</div>");
?>
</section>
</div>
<footer style ="height: 400px; text-align: center;">
<p>Site created by Transfer Creative. Copyright © 2013 THEXFR LLC. All rights reserved.</p>
</div>
</div>
</footer>
<script>
/*####### STICKY NAV SCRIPT ##########*/
Expand Down
Loading

0 comments on commit b3c758d

Please sign in to comment.