Total Pageviews

Monday, April 25, 2011

Class Notes 4-25-11

Arrays:
·         Mechanism that can expand or shrink to any size that collects data
·         Keeps it in a set
·         Can be all kinds of data types, doesn’t have to all match
·         Taking care of the order & the key that uses to identify it.
Associative array: manually takes care of the index, & the number of elements in the array
$aPicnic = array('Sandwich'=>'Turkey','Drink'=>'Pop','Dessert'=>'Cupcake');
Note: arrow has NO space, must be >
function makeLinks($linkArray)
{
    $myReturn = '<ul class="links">';
    foreach($linkArray as $url => $text)
    {
        $myReturn .= '<li><a href="' . $url . '">' . $text . '</a></li>';  
    }  
    return $myReturn . '</ul>';  
}
Rotation: pieces of content that rotates through (with modulus widget) to allow pages appear dynamic
Unix, Command Line, File Permission
Designed to run on nothing, does not require OS or much hardware
Web server: simple piece of hardware, hands files to you
Web hosting vs mySQL server:
NOTE: To be able to talk to a server, you need a SECURE connection & know the commands
REQUIREMENTS:
1.       zephir.seattlecentral.edu
2.       Horsey01
3.        

File Permission:

3 levels of access:
 Read(see it but not change it),
write(lets you write it but you can’t see it), &
 execute (For a program to run from the server, a file or directory may need to be set to have "execute" capability. UNIX is aware of running programs, and will disallow access to a program if the execute permissions do not allow access)
Read/Write Execute (RWX): The 3 permissions described above make up rwx, read-write-execute, which apply to directories and files, all of which must be set properly for our PHP web applications
Files (controls itself) & folders(controls the content within it) both have file permission involved
Unix Permission Values:  7 is the lucky number
     (when a file has all 3 levels, contains a 7 permission value)
·         Read = 4
·         Write = 2
·         Execute = 1
Therefore, for full RWX access to a file or folder, we would set it to 0777, which is 'world writable' and the riskiest possible setting. (only time you need 7 in the last number, when you aren’t able to upload the file

  drwxr-xr--       4096    Aug 31 22:32    myDirectory
directory or not

d or -
owner-'s access: Non-event

rwx 
Public (what is on web)
Is this file world writable? (7 is indicator)
·         Most cases is a 5
(read/executable)
·         Images wont show up if 5 isn’t here

COMMANDS:
d: stands for directory
rwx : permission of the owner
r-x :permission of the group,
       means 5 (read & executable)
r-- : permission of everyone else
      means 4 (read permission only)
chmod: change mode                    ex: chmod “filename” 0777 (changes the file permission to ‘world writable’

Windows: Putty          Mac: Terminal

Logging onto Putty, make sure you click “never” when you’ve never logged on this computer before (“close window on exit”)

Permission set:
   -rw-rw-r--
1st – d or a dash –
2nd
3rd
4th – 2 is dangerous (writable), 3 dangerous
      4 is ok (readable)
      5 is ok
      6 is dangerous
      7 is dangerous





NOTE: the cursor does not move
Domain is controlled by Seattle Central (email address network login)

“ ~ ” represents “root”

 Password needs to be created for mySQL
 (mySQL on zephir)
            (same as email password)

Then you type in:
  mysql –u dpham004 –p
         (password here)




Authentication: I know who you are (your account exists)
Authorization: can you touch file or not (permission settings)
MySQL monitor:  Command line in MySQL



“database changed” means it grants who gains access


Deletes the table of
Dump means “cut” and put it somewhere else
> use dpham004
>  show tables;  (stores like things)
> show databases; ( )
>  drop table test_Customers;




Database: is like engine of the car, what makes it run
                you are designing the schema & structures of the database

Portable Programs:

  • ·         Portable version of firefox
  • ·         Putty
  • ·         Notepad++
·          
·          

Assignment 4: Email form handler: ReCaptcha (recognizes people from robots, sustainable string docs)



No comments:

Post a Comment