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
login_page.php | |
<form action="verify.php" method="post"> | |
User Name:<br> | |
<input type="text" name="username"><br><br> | |
Password:<br> | |
<input type="password" name="password"><br><br> | |
<input type="submit" name="submit" value="Login"> | |
</form> | |
verify.php |
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 | |
if (function_exists('register_sidebar')) { | |
register_sidebar(array( | |
'before_widget' => '<li id="%1$s" class="widget %2$s">', | |
'after_widget' => '</li>', | |
'before_title' => '<h2 class="widgettitle">', | |
'after_title' => '</h2>', | |
)); | |
} |
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 | |
if(isset($_POST['submit'])){ | |
# connect to the database here | |
# search the database to see if the user name has been taken or not | |
$query = sprintf("SELECT * FROM users WHERE user_name='%s' LIMIT 1",mysql_real_escape_string($_POST['user_name'])); | |
$sql = mysql_query($query); | |
$row = mysql_fetch_array($sql); | |
#check too see what fields have been left empty, and if the passwords match | |
if($row||empty($_POST['user_name'])|| empty($_POST['fname'])||empty($_POST['lname'])|| empty($_POST['email'])||empty($_POST['password'])|| empty($_POST['re_password'])||$_POST['password']!=$_POST['re_password']){ | |
# if a field is empty, or the passwords don't match make a message |
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
functions.php | |
<?php | |
function loggedIn(){ | |
//Session logged is set if the user is logged in | |
//set it on 1 if the user has successfully logged in | |
//if it wasn't set create a login form | |
if(!$_SESSION['loggd']){ | |
echo'<form action="checkLogin.php" method="post"> | |
<p> |
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
<? | |
if ($_REQUEST['action']=="add"){ | |
$userfile = $HTTP_POST_FILES['photo']['tmp_name']; | |
$userfile_name = $HTTP_POST_FILES['photo']['name']; | |
$userfile_size = $HTTP_POST_FILES['photo']['size']; | |
$userfile_type = $HTTP_POST_FILES['photo']['type']; | |
///////////////////////// | |
//GET-DECLARE DIMENSIONS // |
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 | |
$username = "your_name"; | |
$password = "your_password"; | |
$hostname = "localhost"; | |
//connection to the database | |
$dbhandle = mysql_connect($hostname, $username, $password) | |
or die("Unable to connect to MySQL"); | |
echo "Connected to MySQL<br>"; |
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
This takes 3 functions to complete the inactive session task. | |
1. We need to check if the person is actually logged in using our isLogged function | |
2. We need the function to check the time the page loaded, and when the last page was loaded | |
3. We need a function to log the user out after inactivity. | |
It is reccomended that you place the 3 functions in the same file, and have this file | |
included on EVERY page that requires a login to view the page. | |
Function sessionX() MUST come after session_start() |
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
$("a[href^='http']").each(function() { | |
$(this).css({ | |
background: "url(http://www.google.com/s2/u/0/favicons?domain=" + this.hostname + | |
") left center no-repeat", | |
"padding-left": "20px" | |
}); | |
}); |
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
$.urlParam = function(name){ | |
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); | |
return results[1] || 0; | |
} | |
// example.com?param1=name¶m2=&id=6 | |
$.urlParam('param1'); // name | |
$.urlParam('id'); // 6 | |
$.urlParam('param2'); // 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
.prevent-text-breakouts { | |
-ms-word-break: break-all; | |
word-break: break-all; | |
word-break: break-word; | |
-webkit-hyphens: auto; | |
-moz-hyphens: auto; | |
hyphens: auto; | |
} |
NewerOlder