PHP/HTML


Oct
26

0


open phpMyAdmin and enter this into the “SQL” tab
{code type=php}update jos_content set hits=0{/code}

Oct
21

0


{code type=php}date(“F j, Y, g:i a”);
date(“m/d/y”);
date(“n/j/Y”);
date(“Ymd”);
date(“D M j G:i:s T Y”);
date(“H:i:s”);

date(“D, F jS”);
date(“l, F jS Y”);
date(“g:i A”);
date(“r”);
date(“g:i:s A D, F jS Y”);
{/code}

May 19, 2012, 6:34 pm
05/19/12
5/19/2012
20120519
Sat May 19 18:34:36 UTC 2012
18:34:36

Sat, May 19th
Saturday, May 19th 2012
6:34 PM
Sat, 19 May 2012 18:34:36 +0000
6:34:36 PM Sat, May 19th 2012


Remember they ARE CaSe sEnsItIVe:

DAYS

d - day of the month 2 digits (01-31)
j - day of the month (1-31)
D - 3 letter day (Mon - Sun)
l - full name of day (Monday - Sunday)
N - 1=Monday, 2=Tuesday, etc (1-7)
S - suffix for date (st, nd, rd)
w - 0=Sunday, 1=Monday (0-6)
z - day of the year (1=365)

MONTH

F - Full name of month (January - December)
m - 2 digit month number (01-12)
n - month number (1-12)
M - 3 letter month (Jan - Dec)
t - Days in the month (28-31)


YEAR

L - leap year (0 no, 1 yes)
o - ISO-8601 year number (Ex. 1979, 2006)
Y - four digit year (Ex. 1979, 2006)
y - two digit year (Ex. 79, 06)

WEEK

W - week of the year (1-52)


TIME

a - am or pm
A - AM or PM
B - Swatch Internet time (000 - 999)
g - 12 hour (1-12)
G - 24 hour c (0-23)
h - 2 digit 12 hour (01-12)
H - 2 digit 24 hour (00-23)
i - 2 digit minutes (00-59)
s - 2 digit seconds (00-59)
u - Microseconds (654321)

OTHER

e - timezone (Ex: GMT, CST)
I - daylight savings (1=yes, 0=no)
O - offset GMT (Ex: +0200)
P - offset GMT with colon (Ex: +02:00)
T - TimeZone Abbreviation (Ex: CST, EST)
Z - offset in seconds (-43200 - 43200)
r - full RFC 2822 formatted date


Full Date & Time

c - ISO 8601 Date (Ex:2010-10-27T13:51:20-06:00)
r - RFC 2822 Date (EX: Wed, 27 Oct 2010 13:51:20 -0600)
U - Seconds since Unix Epoch (January 1 1970 00:00:00 GMT)

Sep
8

Robots Meta

Posted in PHP/HTML by Admin

0


About the Robots <META> tag

In a nutshell

You can use a special HTML <META> tag to tell robots not to index the content of a page, and/or not scan it for links to follow.

For example:

<html>
<head>
<title>...</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</head>

the NOFOLLOW directive only applies to links on this page. It’s entirely likely that a robot might find the same links on some other page without a NOFOLLOW (perhaps on some other site), and so still arrives at your undesired page.

Don’t confuse this NOFOLLOW with the rel=”nofollow” link attribute.

The “NAME” attribute must be “ROBOTS”.

Valid values for the “CONTENT” attribute are: “INDEX“, “NOINDEX“, “FOLLOW“, “NOFOLLOW“. Multiple comma-separated values are allowed, but obviously only some combinations make sense. If there is no robots <META> tag, the default is INDEX,FOLLOW“, so there’s no need to spell that out. That leaves:

<META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">
<META NAME="ROBOTS" CONTENT="INDEX, NOFOLLOW">
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

Sep
6

0


{code type=php}echo $_SERVER['PHP_SELF'];{/code}
{code type=php}echo $_SERVER['SCRIPT_NAME'];{/code}
{code type=php}echo $_SERVER['REQUEST_URL'];{/code}
{code type=php}echo getenv['SCRIPT_NAME'];{/code}
{code type=php}echo getenv['REQUEST_URL'];{/code}

Sep
6

0


Quick Reference

}		&#125;   Right curly brace
{		&#123;   Left curly brace
©		&#169;   Copyright
¢		&#162;   Cent sign
<		&#060;     Less than
=		&#061;     Equals sign
>		&#062;     Greater than
?		&#063;     Question mark
@		&#064;     Commercial at
¼		&#188;   Fraction one-fourth
½		&#189;   Fraction one-half
¾		&#190;   Fraction three-fourths

Sep
6

PHP/HTML

Posted in PHP/HTML by Admin

0


Data Types

integer, float, boolean, string, array, object, resource, NULL


Variable Declarations

$variablename = “value”;

$anothervariable = & $variablename; (Assign by Reference)


Declare Array

$arrayname = array();


Initialize Array

$arrayname = array(<value1> , <value2> , <value3>);

$arrayname = array(<key> => <value> , <key> => <value> ; (Define Keys)

$multiarray = array(<key> => array(value1> , <value2>)); (Multi-dimensional)


Common Array Functions

sort(<array>); (Sort array assigns new keys)

asort(<array>); (Sort array maintain keys)
rsort(<array>); (Sort array in reverse, new keys)

arsort(<array>); (Sort array in reverse, maintain keys)

count(<array>); (Count elemerts)
count(<array>,COUNT_RECURSIVE); (Count multidimensional array)

array _push(<array>, <value>); (Push item onto end of array)

array_pop(<array>); (Pop item off end of array)


Text Comments

// Comment text
/* Multi-line

    comment text */
# Comment text


Arithmetic Operators

+ (Addition)
- (Subtraction)

* (Multiplication)
/ (Division)

% (Modulus)


Retational Operators

== (Equal)

=== (Equal with type comparison)
!= (Not equal)

<> (Not equal)
!== (Not Equal with type comparison)
< (Less than)

> (Greater than)
<= (Less than or equal to)

>= (Greater than or equal to)


 Logical Operators

! (logical NOT)

&& (logic AND)
|| (logical OR)

xor (logical XOR)


Assignment Operators

= (Assign)

+= (Addition)
-= (Subtraction)

*= (Multiplication)
/= (DMsion)
.=(Concatenation)

%= (Modulus)
&= (And)

|= (Or)
^= (Exclusive Or)
«= (Left Shift)

»=(Right Shift)


String Concatenation

. (Period)


String Manipulation

substr(<string> , <start>, [<length>]);

strlen(<string>);
trim(<string>);
Itrim(<string>); // Trim Left
rtrim(<string>); // Trim Right

strtolower(<string>);
strtoupper(<string>);
str_replace(<search> , <replace> , <string>, [<count>]);

strpos(<string>, <search>);
strcmp(<string1> , <string2>); (Binary safe string comparison)
strcasecmp(<string1> , <string2>); (Binary safe case-insensitive comparison)

explode(<delim> , <string> ,[<limit>]); (Break string into array)
implode(<delim> , <array>); (Join array into string separated by delim)


Cookies

setcookie (<cookiename> , [<value>],[<expire_time_in_secs_since_epoch>]);
$_COOKIE ['cookiename'];
(Returns value of cookie)


Sessions

session_start(); (Create session)
$_SESSION['key_name'] = value; (Set session variable)
$variablename = $_SESSION['key_name']; (Retrieve value from session variable)
session_destroy(); (Destroy session)


Error Handling

try {
<statements that may cause error>;
}
catch (<Exception Class> $exception_name);

{
<statements to execute when error is caught>;
}

Page 2 of 212