You are on page 1of 23

ICT2613/102/1/2021

Tutorial letter 102/1/2021

Internet Programming
ICT2613

Semester 1

School of Computing

Additional Information and Assignments 1 & 2


 

IMPORTANT NOTICE!!

Electronic communication with lecturers must be done through a myLife email account.
Always state the module and your student number in communication.

1 INTRODUCTION AND WELCOME


Welcome to ICT2613, Internet Programming. Please read this tutorial letter carefully.

Note that ICT2613 is a fully online-presented course. No course material is posted to students.
When study material is uploaded on myUnisa in Additional Resources, you will be informed via
an e-mail to your myLife account.

Tutorial 101 contains some important information about the module. Software for the module is
available on Osprey website, http://osprey.unisa.ac.za/download/Disk/

Best wishes with your studies!

ICT2613 Tuition Team

2 PURPOSE OF AND OUTCOMES FOR THE MODULE


2.1 Purpose

This module will provide an intermediate web-developer with the knowledge to analyse contents
and problems, design, develop and maintain an appropriate web-based solution and skills to
supply solutions and with the values needed to develop an appreciation for a principled working
methodology within a changing society.
The student will be able to design and implement a new infrastructure in a web-based
environment.
Qualified students will able to design, develop and maintain web-sites and provide long term
principled decisions in a changing society to specific international standards of precision,
robustness, reliability, cost-effectiveness, solution-specific within a specified time-frame and
client-satisfaction.
Students will be able to analyse, design and develop appropriate web-based solutions in a
changing environment.

2.2 Outcomes

Specific outcome 1
Demonstrate an understanding of basic program operations in a web-based/internet
environment.
Range
Input/Output, basic arithmetic operations, logical operations, saving code
Assessment criteria
Code that requests input and produces output is written for a web-based / internet environment;
the use of operators to perform calculations and make logical decision is applied in such a way
that correct output is produced; demonstration includes the saving of work and retrieval.
Specific outcome 2
Demonstrate an understanding of and utilize the web-based / internet environment..
Range
Toolbox, Object properties, Objects, Toolbars, Events, Methods, Design window and code
window.
Assessment criteria
Code that contains the range elements is used. How it all forms part of an application to solve
a problem is explained and implemented logically.
Specific outcome 3
Demonstrate an understanding of and use variables in a web-based / internet e n v i r o n m e n t .
Range
Variable t y p e s , s c o p e , c o n s t a n t s , c o n v e r s i o n
Assessment criteria
Types of variables and how they may be manipulated are explained; when and from which
parts of the code variables are accessible are explained; the use of constants is demonstrated
and the motivations for using them are explained; the conversion of one type to another is
demonstrated and why it is useful is explained.
Specific outcome 4
Demonstrate an understanding of structures and their use in a web-based/internet environment.
Range
Loops decision making, arrays, repetition, functions
Assessment criteria
Code that involves structures is demonstrated to show how these structures are use in
decision making repetitions and variable structures.
Specific outcome 5
Demonstrate an understanding of and use basic exception handling in a web-based / internet
environment.
Range
Catch exception. Provide a way to handle the exception while code keeps running.
Assessment criteria
The student demonstrates in code how an exception is captured. The demonstration also
includes code to deal with the exception to prevent a program from halting.

3 LECTURER, TUTOR AND CONTACT DETAILS


3.1 Lecturer and tutor

Lecturer: Dr Anitta Thomas, thomaa@unisa.ac.za, 011 670 9181, C03-40, C Block, The Science
Campus, Cnr Pioneer and Christian de Wet streets, Florida Park, Roodepoort.

Note: E-mail is the preferred mode of communication. You can expect a reply to your e-mail
within 48 working hours.

E-tutor: You will receive an e-mail with the details of your e-tutor when an e-tutor is allocated to
you.

3.2 School of Computing

Tel: +27 11 670 9200


E-mail: computing@unisa.ac.za
 

3.3 University

Please go to www.unisa.ac.za, and follow the link Contact Us.

3.4 Forum

We will use myUnisa discussion forum this semester. Please participate in the forum.

3.5 Telephone

Should you wish to contact the lecturer telephonically, a n d b e f o r e y o u m a k e a c a l l ,


please visit http://osprey.unisa.ac.za and the " S O C r egistered s tudents" page (which you
must f i r s t personalize for yourself). This page shows which module lecturers are in office,
thereby preventing frustration on your side when calls go unanswered because lecturers may
be in meetings/workshops, at conferences etc.

However, we request that you rather use the forum for c o u r s e content/presentation queries.
Send an email when you have queries outside the course content/presentation, e.g. a personal
issue. Either way, a traceable electronic record of your query is available.

3.6 E-mail

You must use your myLife e-mail account to send e-mails to the lecturer. Please provide the
module code in the subject line.

4 MODULE RELATED RESOURCES


4.1 Prescribed book

Please see Tut 101 for the prescribed book.

4.2 Software

This software is available on Osprey website (http://osprey.unisa.ac.za/download/Disk/). The link


contains all the necessary software that is referred to in the prescribed textbook. We have also
included some additional software that you might find useful as well. Please see
SoftwareInformation.pdf in the list of included software. Further installation instructions
are given in the later sections of this tutorial letter.

4.3 S t u d y material

 Tutorial letters 101, 102, 103 and 104


 Chapters 1-12 of the prescribed textbook
 Software
 Additional resources folder on myUnisa may contain additional study material

5 TEXTBOOK APPROACH
The prescribed handbook teaches all the skills you need to develop almost any type of database-
driven web site with PHP and MySQL.

The content is presented in "paired pages" (see screenshot below) with the essential syntax,
guidelines, and examples on the right page and the perspective and extra explanation on the left
page. The in-chapter exercises on the right-hand side are used to explain and illuminate the
theory which is presented on the left-hand pages. In this manner you add code to an in-chapter
exercise application as you progress through the chapter.

The code and solutions to most of the exercises/applications are made available. The intention
is for you to try and complete the exercises/applications on your own, and when you can’t do so,
you can refer to the solutions.

This is a programming module and thus, it is vital to practice programming on a computer with
the necessary software. The textbook and the assignments give sufficient programming
experience.

5 SOFTWARE
Step 1: Install server environment, editor and course files.

 Appendix A (Windows) and Appendix B (Mac) cover installation of the server


environment, an editor and course files (book applications and source code). All the
software for Windows is available on the Osprey link, so you do not have to download it
as directed in these appendixes.
Note: on newer versions of Windows, do not install XAMPP to your C:/Program Files
folder since you are prevented from writing to this folder.
 Note that the server environment and editors are tools that may, depending on the
configuration of your PC, present unique installation and usage problems that we cannot
possibly support. We suggest you Google or make use of the forum – perhaps other
people/students have experience the same problem/s.
 If you make use of a Unisa Computer Laboratory, note that another independent MySQL
installation may be installed on the PC’s. This may cause problems when you try to start
MySQL through the XAMPP interface/panel. The solution is to check for another MySQL
icon in the taskbar to the bottom right (in the past it was a small traffic robot icon, but we
cannot be sure as laboratory installations change from year to year). Ensure this
particular MySQL service is not running (stop it by right-clicking the icon -> WinNT -> Stop
service) or through the Running Services application. Then restart the MySQL service
from the XAMPP panel.
 Also note that if you run Skype, it will clash with XAMPP since the latter installation also
makes use of port 80. Please Google for support on resolving this issue, or post your
problem on the forum.
 The complete PHP manual (with a search option of PHP functions) is available as a
windows help-file in the Osprey link. If you are using Windows XP SP2 or later, you need
to “unblock” the file by right-clicking on it in Windows Explorer and selecting the
“Properties” menu item, then clicking on the “Unblock” button (on Windows Vista this is
 

within the “Security” options). Failure to unblock the documentation file may result in error
messages including “Navigation to the webpage was canceled” due to Windows security
restrictions.

Step 2: Work through each of the prescribed chapters.

1. Refer to the folder TextbookResources in the link on Osprey for the course files (book
applications and source code)
2. For every chapter, read the text presented on the left page, and where applicable,
run/adapt the code presented on the right page (in-chapter exercises), which, if you have
followed the steps in the book appendix, is available in the books_app folder in your root
web folder.
3. Complete the exercises presented at the end of each chapter. Starting code is available in
the ex_starts folder.
4. The solutions to all these exercises are available in the ex_solutions folder. This
implies that you can simply copy the solutions and run them, or just read through them -
but as stated earlier, you should use the solutions to learn. Thus, try and complete an
exercise on your own, and only use the solution when you get stuck. If you do not follow
this route, you will not learn to program.

6 ASSIGNMENTS

Assignment 1 (chapters 1-6)

Complete your assignment as follows:

 Capture the correct answer for each question


 Visit myUnisa and carry your answers over onto the answer sheet

Question 1

Which of the following is an example of a web server?

1. phpMyAdmin
2. MySQL
3. Apache
4. htdocs

Question 2

A web application is typically a type of _______________________.

1. client-server application
2. database application
3. client-side application
4. server-side application
Question 3

All of the following except one are examples of web browsers. Which of the following is not a web
browser?

1. Chrome
2. Oracle
3. Internet explorer
4. Firefox

Question 4

What extension of a filename is typically associated with a static web page?

1. .asp
2. .php
3. .htm
4. .pl

Question 5

To deploy a PHP application on your own computer, you copy the application root directory to the
______________.
1. htdocs directory of the MySQL server
2. htdocs directory of the Apache server
3. xampp directory of the Apache server
4. xampp directory of the MySQL server

Question 6

Which one of the following declares a constant?

1. define(-TAX-, 14);
2. define($TAX, 14);
3. define('TAX', 14);
4. define($tax, 14);

Question 7

Which one of the following declares a boolean?

1. $var = 1;
2. $var = TRUE;
3. $var = "TEST";
4. $var = array();

Question 8

Which one of the following statements store 10 in $result after execution?

1. $result = 6 + 2 * 2;
2. $result = 2 + 2 + 1 * 2;
 

3. $result = 10 % 2 * 2;
4. $result = 11 - 1 / 2;

Question 9

Study the code below:

$num = 0;
if($num < 0)
$num *= -1;
else
$num += 1;

What is the value of $num after the execution of the above lines of code?

1. -1
2. 0
3. 1
4. 2

Question 10

What is the output produced by the following code?

$count = 1;
while($count <= 5){
echo $count + ($count-1);
$count ++;
}

1. 12345
2. 1021324354
3. 1357
4. 13579

Question 11

Which is a data type used for a column in a database table?

1. PRIMARY
2. FOREIGN
3. INT
4. INDEX

Question 12

All the statements except one are true about relational databases. Choose the incorrect
statement regarding relational databases:

1. A database can have multiple tables


2. A database table can have many primary keys
3. A database table can have many foreign keys
4. A database table can have many rows and columns
Question 13

Which type of SQL statement returns a result set?

1. UPDATE
2. CREATE
3. INSERT
4. SELECT

Question 14

Which of the following statements is correct about the SQL statement given below?

SELECT vendorName, invoiceTotal


FROM vendors INNER JOIN invoices
ON vendors.vendorID = invoices.vendorID
WHERE invoiceTotal >= 500
ORDER BY vendorName DESC

1. The maximum number of rows that the result set can have is three
2. The result set has rows from the table invoices
3. The maximum number of columns that the result set can have is two
4. The result set has rows sorted in descending order of vendorID

Question 15

Which of the following can be used with a SELECT SQL statement?

1. INNER JOIN
2. WHERE BY
3. FROM THE
4. BY ORDER

Question 16

Which PHP class can be used to connect to a MySQL database?


1. PDO
2. DB
3. Argument
4. DataConnect

Question 17

Which one of the following is incorrect about PDO?

1. PDO facilitates database access in PHP


2. One can specify the name of the database table when creating a PDO object
3. Creation of a PDO object can result in errors that can be handled using try catch statement
4. A PDO object can be created using three arguments
 

Question 18

Study the statement below:

$db = new PDO($a, $b, $c);

Which one of the following is correct about this statement?

1. $a contains the database name


2. $b contains the password
3. $c contains the username
4. $a, $b and $c contains the exception handling code

Question 19

Study the database table named weather given below, where record_number is the primary
key:

Which one of the following options will result in $result storing the following result?

Gordons Bay,12
Johannesburg,25
Hammanskral,7
Mamelodi,1
Port Elizabeth,3

Assume that a PDO object named $db is correctly connected to the relevant database.

1.
$query = 'SELECT place, rainfall FROM weather';
$statement = $db->prepare($query);
$statement->execute();
$records = $statement->fetchAll();
$statement->closeCursor();

$result = "";
foreach($records as $record){
$result = $result. $record[1]. "," . $record[3]. "<br>";
}
2.
$query = 'SELECT * FROM weather';
$statement = $db->prepare($query);
$statement->execute();
$records = $statement->fetchAll();
$statement->closeCursor();

$result = "";
foreach($records as $record){
$result = $result. $record[1]. "," . $record[3]. "<br>";
}

3.
$query = 'SELECT * FROM weather';
$statement->execute();
$records = $statement->fetchAll();
$statement->closeCursor();

$result = "";
foreach($records as $record){
$result = $result. $record[1]. "," . $record[3]. "<br>";
}

4.
$query = 'SELECT place, rainfall FROM weather';
$statement = $db->prepare($query);
$records = $statement->fetchAll();
$statement->closeCursor();

$result = "";
foreach($records as $record){
$result = $result. $record['place']. "," .
$record['rainfall']. "<br>";
}

Question 20

Study the database table named weather given below, where record_number is the primary
key:

What is the result of the following code?

$query = 'INSERT INTO weather (record_number, place, date, rainfall)


VALUES (:rec_no, :place, :date, :rainfall)';
$rec_no = 5;
$place = 'Roodepoort';
 

$date = '2019-12-27';
$rainfall = 25;
$statement = $db->prepare($query);
$statement ->bindValue(':rec_no', $rec_no);
$statement ->bindValue(':place', $place);
$statement ->bindValue(':date', $date);
$statement ->bindValue(':rainfall', $rainfall);
$statement->execute();
$statement->closeCursor();

Assume that a PDO object named $db is correctly connected to the relevant database.

1.
record_number place date rainfall
1 Gordons Bay 2019-03-01 12
2 Johannesburg 2019-01-30 25
3 Hammanskral 2019-04-12 7
4 Mamelodi 2019-06-23 1
5 Roodepoort 2019-12-27 25

2.
record_number place date rainfall
1 Gordons Bay 2019-03-01 12
2 Johannesburg 2019-01-30 25
3 Hammanskral 2019-04-12 7
4 Mamelodi 2019-06-23 1
5 Port Elizabeth 2019-10-19 3
5 Roodepoort 2019-12-27 25

3.
record_number place date rainfall
1 Gordons Bay 2019-03-01 12
2 Johannesburg 2019-01-30 25
3 Hammanskral 2019-04-12 7
4 Mamelodi 2019-06-23 1
5 Port Elizabeth 2019-10-19 3

4.
record_number place date rainfall
1 Gordons Bay 2019-03-01 12
2 Johannesburg 2019-01-30 25
3 Hammanskral 2019-04-12 7
4 Mamelodi 2019-06-23 1
5 Port Elizabeth 2019-10-19 3
6 Roodepoort 2019-12-27 25

Question 21

When you use the MVC pattern, the model consists of the PHP files that work with and represent
the ________________ of the application.

1. verifier
2. view
3. central processing unit
4. data

Question 22

When you use the MVC pattern, you _________________.

1. perform all data validation on the client


2. use the pattern for every page in the application
3. put all of the PHP code in the controller
4. make each layer as independent as possible

Question 23

When you code a function in PHP, you start with the ________________ keyword.

1. class
2. method
3. return
4. function

Question 24

When you use the MVC pattern, the ________________ consists of the HTML and PHP files that
make up the user interface of the application.

1. model
2. view
3. controller
4. module

Question 25

Which type of statement should be included if a function must send a value back to where the
function was called?

1. send
2. parameter
3. return
4. argument

Question 26

An error that lets the application run but produces the wrong results is known as a _________.

1. runtime error
2. logic error
3. user error
4. syntax error
 

Question 27

Which of following is not considered a common syntax error in PHP?

1. misspelling keywords
2. using a keyword as a variable name
3. multiplying by the wrong variable
4. forgetting a closing quotation mark

Question 28

Study the code below:

$sentence = "Good Luck"; // line 1


$result = ""; // line 2
if(strlen($Sentence) <= 20) // line 3
$result = "Short string"; // line 4
else // line 5
$result = "Long string"; // line 6

The purpose of the code is to decide whether a string is long or short. A string is considered short
if its length is less than or equal to 20 characters. If the length of a string is greater than 20
characters, then it considered a long sentence.

Which line of the code has an error in satisfying the above-mentioned purpose?

1. line 6
2. line 5
3. line 4
4. line 3

Question 29

Which one of the following can be considered as a runtime error?

1. Excluding a ; at the end of a PHP statement


2. Using = instead of == in an expression
3. The database server the PHP script is trying to connect to is unavailable
4. Coding a while loop that iterates an incorrect number of times

Question 30

Select the odd one in the context of testing and debugging PHP code:

1. breakpoints
2. stack trace
3. adding echo statements in the code to inspect variables during execution
4. chrome
Assignment 2 (chapters 6-12)

Complete your assignment as follows:

• Capture the correct answer for each question


• Visit myUnisa and carry your answers over onto the answer sheet

Question 1

How many radio buttons can be selected at any given time from the following code?
<input type="radio" name="address" value="Home">Home Address
<input type="radio" name="delivery" value="FedEx">Federal Express
<input type="radio" name="delivery" value="UPS">UPS

1. 1
2. 2
3. 3
4. 4

Question 2
A hidden field _____________.

1. appears on the form but its data is hidden


2. has data that is obscured by bullets or asterisks
3. doesn’t appear on the form but its data can be sent to the server
4. appears on the form with its data grayed out

Question 3
All of the input options except one allows user to indicate a choice or choices – select this odd
one.

1. list box
2. drop-down box
3. checkboxes
4. text area

Question 4
Which method would be typically used if a form contains password fields or other sensitive data
that you don’t want to display in the URL?

1. GET
2. ACTION
3. APPEND
4. POST

Question 5
Study the code below:

<form action="processcode.php" method="get">


<label> Module code: </label>
 

<input type="text" name="code">


<input type="submit" value="Submit">
</form>

Which of the following is incorrect about the code?

1. The code is written in HTML


2. The data entered in the form will be processed by a PHP script
3. processcode.php can access the data submitted in the form from the POST array
4. action and method are called attributes of <form> tag

Question 6
What does $message contain after the following code executes?

$age = 19;
$score = 750;

if ($age >= 21 && $score >= 700) {


$message = 'Loan approved';
} else if ($age >= 21 && $score >= 650) {
$message = 'Cosigner needed.';
} else if ($age >= 18 && $score >= 680) {
$message = 'Two cosigners needed.';
} else {
$message = 'Loan denied.';
}

1. Loan approved.
2. Cosigner needed.
3. Two cosigners needed.
4. Loan denied.

Question 7

All the statements are correct except one about the OR (||) operator. Choose the incorrect
statement.

1. It returns a TRUE value when the expressions on both sides of the operator returns FALSE
values
2. It returns a TRUE value when the expression on the left hand side of the operator returns a
TRUE value
3. It returns a TRUE value when the expression on the right hand side of the operator returns a
TRUE value
4. It is a logical operator.

Question 8

Which type of loop will always execute its code at least once?

1. for
2. while
3. do while
4. foreach
Question 9

Which of the following is a relational operator in PHP?

1. ++
2. !
3. &&
4. <=

Question 10

What does $message contain after the following code executes?

$statusCode = "203";
switch($statusCode) {
case "200":
$message = "OK";
break;
case "403":
$message = "Forbidden";
break;
case "404":
$message = "Not Found";
break;
default:
$message = "Unknown Status";
break;
}

1. OK
2. Forbidden
3. Not Found
4. Unknown Status

Question 11

What is stored in $result after the execution of the lines of code below?

$result = "limpopo";
$result = ucfirst($result);
str_replace("o", "*", $result);

1. limpopo
2. Limpopo
3. limp*p*
4. Limp*p*

Question 12

Which one of the following is incorrect about working with times and dates in PHP?
 

1. DateTime and DateInterval are relevant PHP classes


2. time() and mktime() can be used for generating timestamps
3. A DateInterval object represents a point of time
4. The DateTime class offers an add() method that accepts an object of DateInterval

Question 13

Which PHP function returns the number of characters in the string?

1. chars()
2. length()
3. count()
4. strlen()

Question 14

Suppose that $name contains a last name followed by a comma and a space, followed by a first
name. Then, you can store the first and last names in variables with code like this:

1. $name = implode(', ', $name);


$last_name = $name[0];
$first_name = $name[1];
2. $name = implode(', ', $name);
$last_name = $name[1];
$first_name = $name[0];
3. $name = explode(', ', $name);
$last_name = $name[0];
$first_name = $name[1];
4. $name = explode(', ', $name);
$last_name = $name[1];
$first_name = $name[0];

Question 15

What is displayed when the statement is executed?

echo str_repeat("2020", 2);

1. 20 20
2. 2020
3. 20202020
4. 2020 2020

Question 16

What is the time interval specified by the following DateInterval object?

$d1 = new DateInterval('PT1H20M10S');

1. 20 months, 1 hour and 10 seconds


2. 20 hours, 10 seconds, 1 minute
3. 1 hour, 20 minutes and 10 seconds
4. 10 hours, 20 minutes and 1 second
Question 17

If the date is 25 August 2020, what output would be produced by the code below?

echo date('d m y');

1. 25 8 2020
2. 25 august 2020
3. 25 Aug 20
4. 25 08 20

Question 18

Study the lines of code below:

$d1 = new DateTime('2020-03-27'); //line 1


$d1->modify('+35 days'); //line 2

Which of the following statement is correct?

1. After the execution of this code $d1 will store 1 May 2020
2. After the execution of this code $d1 will store 27 May 2020
3. Line 2 has a syntax error relating to the use of modify()
4. The DateTime object is created with an incorrect date in line 1

Question 19

Study the code below:

$d1 = new DateTime('2020-01-01');


$d2 = new DateTime('2020-12-31');
$diff = $d2->diff($d1);
$result = $diff->format('%m');

Which one of the following is correct about this code?

1. There are numerous syntax errors in the code


2. $d1, $d2 and $diff are three DateTime objects
3. The code takes two dates and extracts the difference in months between these two dates
4. $d1 and $d2 are DateTime objects, and $diff and $result are DateInterval objects

Question 20

Which method of a DateTime object can be used to determine an amount of time between two
dates or times?

1. diff()
2. datebetween()
3. datediff()
4. add()
 

Question 21

In the following options, there are three valid ways to declare and initialize arrays. Choose the
invalid way of declaring and initializing an array.

1.
$anArray = array();
$anArray[] = 1;
$anArray[] = 2;
$anArray[] = 3;
2.
$anArray = array( , , );
3.
$anArray = array();
$anArray[1] = 1;
$anArray[3] = 2;
$anArray[4] = 3;
4.
$anArray = array(1,2,3);

Question 22

What is the content of $anArray after the code is executed?

$anArray = array(0,1);
for($n = 0; $n <= 5; $n++){
$anArray[] = $anArray[$n] + $anArray[$n+1];
}

1. 0, 1
2. 0, 1, 2, 3, 4, 5
3. 0, 1, 2, 3, 4, 5, 8
4. 0, 1, 1, 2, 3, 5, 8, 13

Question 23

How many elements are there in the array below?

$anArray = array("A" => "Afrikaans", "S" => "Sepedi", "Z" => "Zulu");

1. 1
2. 2
3. 3
4. 6

Question 24

What output would be produced by the code below?

$bigFive = array('Lion', 'Leopard', 'Rhino', 'Elephant', 'Buffalo');


echo $bigFive[2];

1. Leopard
2. Rhino
3. Elephant
4. Buffalo

Question 25

Which of the following is incorrect about arrays in PHP?

1. The length of an array refers to the number of elements in it


2. An associative array consists of pairs of keys and values
3. The index of the last element is the same as the length of the array
4. It is possible to add gaps in an existing array

Question 26

Which of the following is incorrect about sessions?

1. A cookie is essential for tracking a session


2. The associative array $_SESSION can be used to access data about a session
3. Session data can be stored on both server and client
4. If the name for a session cookie is not explicitly assigned, it has the name PHPSESSID

Question 27

Which of the following is correct about cookies?

1. A cookie is saved on the server side


2. A web server can enable and disable cookies
3. If you do not specify a lifespan for a session cookie, the lifespan will be set to 0 seconds
automatically
4. $_COOKIES is an associative array of PHP that can be used to access cookies

Question 28

Given the statement

setcookie("cookie_1", "1");

which one of the following statements is correct?

1. The statement is syntactically incorrect as the function needs at least four arguments
2. The cookie set by this statement is a persistent cookie
3. If a PHP file containing this statement is executed on the local host, this cookie will be stored in
the same directory in the htdocs directory where the PHP file is stored.
4. When executed, this statement creates a cookie with the information cookie_1 = 1

Question 29

Which of the following is not a parameter of the setcookie() function?

1. $name
2. $value
3. $method
4. $expire
 

Question 30

What is the default name of a session cookie in PHP?

1. session_name
2. SESSIONID
3. SESSIONCOOKIE
4. PHPSESSID

Assignment 3 (chapters 1-12)

TL103 contains assignment 3 questions.

9 EXAMINATIONS
An exam letter will be distributed towards the end of the semester.

10 APPENDIX
INSTALLING WAMPSERVER

You either install WampServer or XAMPP. Please do not install both. If you choose WampServer
instead of XAMPP, given below are the installation instructions.

Step 1

Note:

 Do not install WampServer OVER an existing version.


 Install WampServer in a folder at the root of a disk, for example C:\wamp (do not use
C:\Program Files)

Before proceeding with the installation of WampServer, you must ensure that the run-time
environments here below are installed on your system, otherwise WampServer will absolutely not
run. In addition, the installation will be faulty and you will need to remove WampServer before
installing the elements that were missing. Make therefore sure you are "up to date" in the
redistributable packages VC9, VC10, VC11, VC13 and VC14 as listed here under.

Install the following 5 run-time environments (VC9 to VC14) from the software, or download them
from the link provided (if you have a 64-bit Windows, you must install both the 32 and 64bit
versions).

a) VC9 Packages (Visual C++ 2008 SP1)

http://www.microsoft.com/en-us/download/details.aspx?id=5582 32bit (VC9_32 .exe on the link)

http://www.microsoft.com/en-us/download/details.aspx?id=2092 64bit (VC9_64 .exe on the link)

b) VC10 Packages (Visual C++ 2010 SP1)

http://www.microsoft.com/en-us/download/details.aspx?id=8328 32bit (VC10_32.exe on the link)


http://www.microsoft.com/en-us/download/details.aspx?id=13523 64bit (VC10_64.exe on the link)

c) VC11 Packages (Visual C++ 2012 Update 4) The two files VSU4\vcredist_x86.exe and
VSU4\vcredist_x64.exe to be download are on the same page:

http://www.microsoft.com/en-us/download/details.aspx?id=30679 (VC11_32.exe or VC11_64.exe


on the link)

d) VC13 Packages] (Visual C++ 2013[) The two files VSU4\vcredist_x86.exe and
VSU4\vcredist_x64.exe to be download are on the same page:

https://www.microsoft.com/en-us/download/details.aspx?id=40784 (VC11_32.exe or VC11_64.exe


on the link)

e) VC14 Packages (Visual C++ 2015) The two files vcredist_x86.exe and vcredist_x64.exe to
be download are on the same page:

http://www.microsoft.com/fr-fr/download/details.aspx?id=48145 (VC14_32.exe or VC14_64.exe


on the link)

Step 2

Download from https://sourceforge.net/projects/wampserver/


or
double click on the wampserver file of your choice from the Osprey link:
wampserver3.0.6_x64_xxxxxx.exe
or
wampserver3.0.6_x32_xxxxxx.exe
and just follow the instructions.

USING WAMPSERVER

 The “www” directory will be automatically created (usually c:\wamp\www)


 Create a subdirectory in “www” (e.g. ICT2613) and create your PHP files inside this folder.
 Click on the “localhost” link in the WampSever menu or open your internet browser and go to
the URL: http://localhost. If you want to access a file in the folder created here above (or any
other sub-folders thereunder), you need to add them to the URL e.g.
http://localhost/ICT2613/my_file.php

FUNCTIONALITIES

With a left click on WampServer’s icon, you will be able to:

 manage (start and stop) your Apache and MySQL services (mostly used)
 switch online/offline (give access to everyone or only localhost)
 install and switch Apache, MySQL and PHP releases (not required)
 manage your servers settings (in case of port clashes with Skype)
 access your error logs
 access your settings files

©
Unisa 2021

You might also like