Session Vars Use one cookie Store data locally Language dependent Cookies Uses Size limit what to do if turned off Can they be trusted? When can you set them in PHP Login passwords always encrypted! probably set a session var or cookie if cookie Pick random number Verify random number Know this is vulnurable to snoop attack Data verification Javascript gives a good user experience but cannot be trusted Server side can be trusted. SQL ACID properties Atomic -- The transaction runs completely or not at all Consistent -- Each transaction moves from one consistent state to another Independent -- Every transaction runs as if it were the only one on the system Durable -- Data changes survive hardware and software failure. Abort Table vs database create table schema not null primary key types decimal(5,2) date and time types enum blob/longblob char[n] vs varchar[n] money autoincrement update tablename set columnname = value where ... delete from tablename where ... select columnname from tablename where .. order by columname limit 3 alter table ... drop tablename describe table tablename joins nested queries (and in vs =) insert into tablename values ( ...) database decomposition might cost speed reduces redundency and possibility of inconsistency Indexes What is an SQL injection attack (i.e. little bobby tables)!!!! Should media files be in the database PHP Built in arrays $_GET $_POST $_COOKIE $_SESSION $_REQUEST Error supression with @ isset($varname) empty($varname) Error checking with die Arrays Not really arrays indexed by key, which can be string not always the same type foreach ($array as $item) foreach($array as $key => $value) Cookies setcookie(...) $_COOKIE Session variables $_SESSION Needs cookies Loops while loops for loops foreach($array as $value) foreach($array as $index => $value) Functions print_r header("location: ...") Variables global superglobal $_REQUEST $_COOKIE $_POST $_GET Databases Know some way to fetch data like http://euclid.nmu.edu/~rappleto/Classes/CS465/PHP/Databases/Database_Example_Object.php.txt real_escape_string Error checking File Uploads See https://www.php.net/manual/en/features.file-upload.post-method.php Multi layer architecture Regular Expressions end of line chars ^ and $ Repeat chars * and + Maybe char ? Sets of chars [abc] and [^abc] Ranges of chars [a-z] Special sets like /s and /S modifiers like “/steve/i†Regular Expression PHP Methods preg_match and preg_match_all preg_replace preg_split PIP (Just that it exists) The Python installer program Uses a library of modules stored "in the cloud" pip3 install thing -- on the command line