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 | |
add_filter( 'the_password_form', 'custom_password_form' ); | |
function custom_password_form() { | |
global $post; | |
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); | |
$o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-pass.php" method="post"> | |
' . __( "This post is password protected. To view it please enter your password below:" ) . ' | |
<label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" /> | |
</form> | |
'; |
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
:-webkit-input-placeholder { | |
font-size: 12px; | |
font-style: italic; | |
color: #CCC; | |
} | |
:-moz-placeholder { | |
font-size: 12px; | |
font-style: italic; | |
color: #CCC; | |
} |
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
<? | |
if (isset($_REQUEST["id"]) && ($_REQUEST["id"]<>"")) { | |
$data1=mysql_query("SELECT * FROM your_table WHERE id=".$_REQUEST["id"]); | |
$data=mysql_fetch_array($data1); | |
$from =mymail@mydomain.com; | |
$to = $data["email_field"]; | |
$user = $data["name_field"]; | |
$subject = "Enter your subject line here"; /*or if it comes from the table*/ $subject = $data["subject_field"]; | |
$header="From:" . $from . "\r\n " ."Reply-To:". $from ; | |
$body="Hello ". $user .",\n\nFirst line\n\nYour message goes here, \nbest regards,\nyour_name and such\n"; |
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
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
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
function dirList ($directory) { | |
// create an array to hold directory list | |
$results = array(); | |
// create a handler for the directory | |
$handler = opendir($directory); | |
// keep going until all files in directory have been read | |
while ($file = readdir($handler)) { |
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
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=ADDRESS'); | |
$information = $xml->xpath("/xml_api_reply/weather/current_conditions/condition"); | |
echo $information[0]->attributes(); |
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
<? | |
// define your query | |
$your_query = "SELECT * FROM yourtable WHERE match1=\'yes\' AND match2<>\'yes\' AND ondate >=".date("Ymd").""; | |
// count the number of rows returned that match the query | |
$rowcnt = mysql_num_rows(mysql_query($your_query)); | |
// generate a random number between 0 and the number of rows found (always -1) |