• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/109

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

109 Cards in this Set

  • Front
  • Back

Http Protocal

What is GET?

A get is a request that receives data from a web server by specifing parameters in the URL portion of the request

What is POST?

A post is used when you want to send data to a server

What are the data length restrictions of GET?

Get method adds data to the URL, therefore restricting the length (URL Max is 2048).

What are the data length restrictions of POST?

No restrictions.

What are the data type restrictions of GET?

Only ASCII characters allowed.

What are the data type restrictions of POST?

No restrictions. Binary data also allowed.

What are the security risks of GET?

Get is less secure because data is being sent through the URL

What are the security risks of POST?

POST is safer because the parameters are not stored in browser history and web server logs.

What are $_GET and $_POST used to do?

Receive client data

The server is...

A party responsible for serving pages

The client is...

A party the requests pages from the server. Then displays them to the user.



Example: Client is the web browser

The user is...

The user uses Client in order to surf the web, fill in forms etc

Server Languages

PHP, Python, ASP.Net, Java etc.

Client languages

JavaScript, HTML, CSS

Want does LAMP stand for?

Linux, Apache, MySQL, PHP

Regex ^

Start of a string

Regex $

End of a string

Regex (a|b)

A or b

Regex (..)

Group selection

Regex [abc]

Match any character in the set

Regex [^abc]

Not match in a set

Regex [a-z]

Match in a range

Regex \d

Shortcut for [0-9]

Regex \s

Match space or tab

Indexed Array

$arrayname = array("values","more values");



echo $arrayname[0];



OUTPUT: values

Multi Dimensional Array

$arrayname = array(array("Volvo", 22, 19));



echo $arrayname[0][2];



OUTPUT: 19

Associative Array

$arrayname = array("value" => "35");



echo $arrayname["value"];



OUTPUT: 35

What is a Superglobal?

Superglobals are bulit-in variables that are always available in all scopes. (Associative arrays)



Example: $_GET, $_POST, $_SESSION, $_COOKIE

Explode function

Cuts string and makes it into a array



print_r(explode ($string));

Implode Function

Converts array into a string



echo implode(" ", $array);

What's a Cookie?

A cookie is a small file that the server embeds on the users computer

What's a session?

A session is used to store user data to be used across multiple pages. The variable passed will last until the page closes.

Connect to database

$con = @mysqli_connect("server","username","password","database");

What are die and exit used for?

Are functions used to terminate script execution

Select a database

@mysqli_select_db($con, "database");

Close database

mysqli_close($con);

Manipulate Database(Query)

$queryResult = @mysqli_query($con, $queryString);

Selecting Records

$row = mysqli_fetch_row($queryResult);



while ($row) {


echo $row[0];


}

Create a Xhr Request

var xhr = createRequest();

DOM get element id

var place = document.getelementbyid("error");

Open xhr using GET

xhr.open("GET", URL, true);



True = asynchronous


False = synchronous

Open xhr using POST

xhr.open("POST", dataSource, true);



True = asynchronous


False = synchronous

window request for new browsers

if (window.XMLHttpRequest) {


xhrObj = new XMLHttpRequest();


}

window request by old browsers

if (window.ActiveXMLObject) {xhrObj = ActiveXObject("Microsoft.XMLHTTP);

PHP Datatypes

String, Float, Boolean, Array, Object, NULL

PHP Operators

Addition, Subtraction, Multiplication, Division, Modulus, Exponention

What is an example of Modulus?

$x % $y



Gets the remainder of x divided by y

What's the value of ++x, if x = 10

11

What's the value of x++, if x = 10?

10

What's an xor operator do?

$x or $y



Returns true if either x or y is true but not both

$x === $y

Returns true if x and y have the same key value pair in the same order and of the same types

DOM get element by id

<h1 id="demo"> heading <h1>



document.getElementById("demo").innerHTML = "hello";



OUTPUT: hello

DOM indexed tag name

<h1> heading <\h1>


<h1> heading02 <\h1> document.getElementByTagName("h1")[0].innerHTML = "hello";



OUTPUT:


hello


heading02

What's a callback response?

When the data from the server gets called back to the client page



xhr.onreadystatechange = function()

Add an event Listener to p1

var event = document.getElementById('p1');



event.addEventListener('click', function, true);



OR



event.AttachEvent('onclick', function);


}

Close a query result

mysqli_free_result($queryResult);

What's used to implement the Ajax Model

HttpRequest Object

What is used to send data back to the client(AJAX)?

responseText



domElementObj.innerHTML = xhr.responseText

AJAX Get request data?

xhr.open("GET", "dataSource.js?fname=Harry&lname=Smith" , true);



xhr.send();

AJAX post request data?

xhr.open("POST", "dataSource.js" , true);



xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");



xhr.send("fname=Harry&lname=Smith");

Readystate = 4

Has data been loaded

status = 200

Has the data transmission been completed without error

ResponseText holds response as?

A string

ResponseXML holds response as?

a XML DOM object

AJAX execution order

1. JavaScript Call


2. AJAX Engine


3. Json/XML Data

Embed JavaScript

<script type="text/javascript">



<script>

Readystate 0

Unsent

Readystate 1

Opened

Readystate 3

Header_reciever

Readystate 4

Loading

Readystate 5

Done

Count array elements

count($arrayname);

similar_text($string1, $string2);

Returns number of characters that two strings have in common

levenshtein($string1, $string2);

Returns the number of characters that two strings have in common

stren($string);

Returns the total number of characters in a string

str_word_count($string);

Returns words in a string

strpos($string, 'a');

returns the letter place in a string



ex. $string = adam;



OUTPUT: 1

strchr()

Starts at a start of string

strrch()

Starts at the end of a string

substr("hello world", 6);

cuts string from specified point



OUTPUT: world

str_replace("word","newword",$string);

Replaces word in string

strtok($string, "token");

Separates string by token

DROP DATABASE

Removes all tables from the database & deletes the database

Maintaining State

Means to temporarily store information about a web server & it's web site visits

setCookie(); placement?

Before HTML tag

Write a cookie statement

setCookie("cookiename","cookievalue", time() + (864300 * 30), "/");

Reading a cookie

$_COOKIE[$cookiename]

Delete a cookie

setCookie("cookiename", " ", time() - 3600);

Delete Session

session_start();


$_SESSION = array();


session_destroy();

serializing

Is the process of converting an object to a string



$checking = serialize($bankAccount);

Unserializing

Covert serialized data into a object

array_shift($arrayname);

Removes the first element of an array from the beginning

array_unshift($arrayname, "a");

Adds one or more elements to the beginning of an array

array_pop($arrayname);

Function removes the last element from the end of an array

array_push($arrayname, "blue", "green");

Adds one or more elements to the end of an array

array_splice($arrayname, start#, length#);

Adds or removes array elements

Indexed sort functions

sort() rsort()

Associative sort functions

ksort() krsort()

Form button click

<button onclick="myFunction()">Click me</button>

JavaScript Object

XML element define structure

Bubbling or Capturing

Bubbling(false)

Return error number of connection

mysqli_connect_errno();

Return error message connection

mysqli_connect_error()

Returns last mySQL error code

mysqli_errno($conn);

Returns last mySQL error message

mysql_error($conn);

Returns 5 digit error code from last mySQL operation

mysqli_sqlstate($conn);