Flashcards
DYNAMIC WEB (Reviewer for ME)
Cards in this deck (92)
- 1is a collection of program or sequence of instructions that is interpreted or carried out by another program rather than by the computer processor.script
- 22 TYPES OF SCRIPTING1. Client-side
2. Server-side - 3the script is processed by the server Like: Apache, ColdFusion, ISAPI and Microsoft's IIS on Windows.server-side scripting
- 4such as JavaScript runs on the web browser.Client-side scripting
- 5Advantages of Server-Side Scripting1. Dynamic content.
2. Computational capability.
3. Database and file system access.
4. Network access (from the server only).
5. Built-in libraries and functions.
6. Known platform for execution
7. Security improvements - 6- Hypertext Preprocessor - Rasmus Lerdorf in 1994PHP
- 7It is a powerful server-side scripting language for creating dynamic and interactive websites.PHP
- 8can contain text, HTML tags and scriptsPHP files
- 9is a line that is not read/executed as part of the program. Its only purpose is to be read by someone who is editing the code!comment
- 10containers" for storing informationVariables
- 11Rules for PHP variables1. Starts with the $ sign, followed by the name of the variable
2. A variable name must start with a letter or the underscore character
3. A variable name cannot start with a number
4. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
5. Variable names are case sensitive ($y and $Y are two different variables) - 12created the moment you first assign a value to itvariable
- 13can be declared anywhere in the script.Variables
- 14PHP has three different variable scopes1. local
2. global
3. static - 15A variable declared outside a function and can only be accessed outside a function.Global scope
- 16A variable declared within a function and can only be accessed within that functionLocal scope
- 17used to access a global variable from within a functionglobal keyword
- 18PHP also stores all global variables in an array called$GLOBALS[index]
- 19holds the name of the variableindex
- 20Normally, when a function is completed/executed, all of its variables are deleted. However, sometimes we want a local variable NOT to be deletedstatic keyword
- 21two basic ways to get output1. echo
2. print - 22can output one or more stringsecho
- 23can only output one string, and returns always 1print
- 24language construct, and can be used with or without parenthesesecho and print
- 25- a sequence of characters - can be any text inside quotes - can use single or double quotesstring
- 26Data Types1. String
2. Integer
3. Floating point numbers
4. Boolean
5. Array
6.Object
7. NULL - 27is a number without decimalsinteger
- 28Rules for integers1. An integer must have at least one digit (0-9)
2. An integer cannot contain comma or blanks
3. An integer must not have a decimal point
4. An integer can be either positive or negative
5. Integers can be specified in three formats: decimal (10-based), hexadecimal (16-based - prefixed with 0x) or octal (8-based - prefixed with 0) - 29function returns the data type and value of variables:var_dump()
- 30is a number with a decimal point or a number in exponential form.floating point number
- 31- can be either TRUE or FALSE - often used in conditional testingBooleans
- 32stores multiple values in one single variablearray
- 33a data type which stores data and information on how to process that dataobject
- 34- represents that a variable has no value - identifies whether a variable is empty or notNULL
- 35- returns the length of a string, in characters - often used in loops or other functionsstrlen() function
- 36function is used to search for a specified character or text within a stringstrpos()
- 37- variables except that once they are defined they cannot be changed or undefined - an identifier (name) for a simple valueConstants
- 38Arithmetic Operators1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Modulus
6. Exponentiation - 39used to write a value to a variable.Assignment Operators
- 40String Operators1. Concatenation
2. Concatenation assignment - 41Increment / Decrement Operators1. Pre-increment
2. Post-increment
3. Pre-decrement
4. Post-decrement - 42used to compare two values (number or string)Comparison Operators
- 43Comparison Operators1. Equal
2. Identical
3. Not equal
4. Not equal
5. Not identical
6.Greater than
7. Less than
8. Greater than or equal to
9. Less than or equal to - 44Logical Operators1. And
2. Or
3. Xor
4. And
5. Or
6. Not - 45used to compare arraysArray Operators
- 46Array Operators1. Union
2. Equality
3. Identity
4. Inequality
5. Inequality
6. Non-identity - 47used to perform different actions based on different conditions.Conditional Statements
- 48Conditional Statements1. if statement
2. if...else statement
3. if...elseif....else statement
4. switch statement - 49executes some code only if a specified condition is trueif statement
- 50executes some code if a condition is true and another code if the condition is falseif...else statement
- 51selects one of several blocks of code to be executedif...elseif....else statement
- 52- selects one of many blocks of code to be executed - used to perform different actions based on different conditions.switch statement
- 53prevent the code from running into the next case automaticallybreak
- 54used if no match is founddefault
- 55the same block of code to run over and over again in a rowLoops
- 56Loops1. while
2. do...while
3. for
4. foreach - 57loops through a block of code as long as the specified condition is truewhile Loops
- 58loops through a block of code once, and then repeats the loop as long as the specified condition is truedo...while
- 59- loops through a block of code a specified number of times - used when you know in advance how many times the script should run.for
- 60- loops through a block of code for each element in an array - works only on arrays, and is used to loop through each key/value pair in an array.foreach
- 61Parameters:1. init counter
2. test counter
3. increment counter - 62Initialize the loop counter valueinit counter
- 63Evaluated for each loop iteration. If it evaluates to TRUE, the loop continues. If it evaluates to FALSE, the loop ends.test counter
- 64Increases the loop counter valueincrement counter
- 65which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having to do anything specialsuperglobals
- 66The PHP superglobal variables areGLOBALS
$_SERVER
$_REQUEST
$_POST
$_GET
$_FILES
$_ENV
$_COOKIE
$_SESSION - 67a PHP super global variable which is used to access global variables from anywhere in the PHP script (also from within functions or methods).GLOBALS
- 68is a PHP super global variable which holds information about headers, paths, and script locations.$_SERVER
- 69is used to collect data after submitting an HTML form.$_REQUEST
- 70- is widely used to collect form data after submitting an HTML form - is also widely used to pass variables.$_POST
- 71can also be used to collect form data after submitting an HTML form$_GET
- 72an array of variables passed to the current script via the URL parameters•$_GET
- 73is an array of variables passed to the current script via the HTTP POST method$_POST
- 74a piece of data that is automatically copied between the client and serverCookie
- 75can be set by the client (as in the last unit) or by the server.Cookies
- 76state stored across requestsSession
- 77basically an add-on to the basic http functionality of a websiteSession
- 78Pros of sessions1. Stores information between requests
2. Much more secure than the simple cookie-based approach - 79Cons of sessions1. Requires your web server to have write-access to some sort of storage medium
2. Requires user to access site every few minutes - 80- Little bits of data that are stored on client but also copied automatically to the server - Useful for storing little bits of data on the client, but they are visible to everybodyCookies
- 81- Data is stored on the server (e.g., filesystem), keyed by a random number - The random number is sent as a cookie to the browser - And the random number expires after a little whileSessions
- 82You need to save a larger amount of data between requests, or when the data needs to be secretSessions
- 83You need to save a small amount of data between requests, and it doesn't need to be kept secretcookies
- 84Examples of information not to store in unencrypted cookiesPasswords
Credit card numbers
Social security numbers
Student ID numbers
Birthdates
List of diseases the user has contracted
Anything that must be kept secret - 85A cookie is created with the _______ function.setcookie()
- 86used to retrieve a cookie value.PHP global variable $_COOKIE
- 87session is started with the _________ functionsession_start()
- 88To remove all global session variables and destroy the sessionsession_unset() and session_destroy():
- 89special variable, which can hold more than one value at a time.Arrays
- 90can hold many values under a single name, and you can access the values by referring to an index number.Arrays
- 91used to create an arrayarray()
- 92are arrays that use named keys that you assign to them.Associative arrays
Information
- Description
- Flashcards on DYNAMIC WEB (Reviewer for ME), created by Ria Alephene on 30/07/2017.
- Created by
- Ria Alephene
- Views
- 0
- Rating