CMPS-3350 Lab-3
The components of this lab are:
This is an individual assignment.
You should do the programming of your C++ program for this lab on your local Desktop.
When this lab is complete, copy your program files
lab3sget.cpp Makefile to your 3350/3/ directory on Odin.
Create a C++ program using the code sample at: /home/fac/gordon/p/3350/code/lab3/lab3sget.c Important: Save this program immediately to your Odin /3350/3/ folder please.
Create a Makefile that includes the following compile line...g++ lab3sget.cpp -Wall -olab3sget -lssl -lcryptoNote: You are refactoring a C program into the C++ language. Complete the rest of the Makefile. Build your program with make.
Please fix all compile warnings and errors. Enter a comment above the code related to each error or warning that you fix. Include the original code that was fixed, in the comment. For example://--------------------------------------------------------------------- //Fixed warning: deprecated conversion from string constant to 'char*' //Previous code was: // void getHost(char *hostname) //--------------------------------------------------------------------- void getHost(const char *hostname) { ... ... ...Step 4a: . Style this program using the Linux style guide. Main features... . Apply perfect K&R brace, space, and indenting. . No lines will wrap on an 80-character window. . Choose hard-tabs or spaces for indenting, but do not mix them. . One command per LOC (line of code) . Fix all compile warnings and errors.
Run lab3sget with the following parameters...
Run lab3sget with the following parameters...
Create a PHP program in your Odin public_html directory... It will have this URL: https://cs.csub.edu/~username/3350/lab3/lab3.php where username is your own Odin account name. If you have any questions about the path to your lab3.php, please ask about it during lab. Here is a sample PHP program example...<?php
echo "This is my php file.";
?>
Run your lab3sget program and contact your PHP file. like this... except insert your own username ./lab3sget odin.cs.csub.edu /~username/3350/lab3/lab3.php
Use a web browser to look at your php file like this... https://www.cs.csub.edu/~username/3350/lab3/lab3.php
Make some minor changes to your lab3.php program... Allow the program to accept input: $param = $_GET['param']; Process the $param variable in the PHP file. Your new PHP program will look like this...
<?php
$param = $_GET['param'];
echo "param is: " . $param . "<br>";
if ($param == "hello") {
echo "hey there!<br>";
} else {
$num = $param*2+3;
echo "number:" . $num . "<br>";
}
echo "<br>";
echo "<img src=\"lab3_diagram.gif\"/>";
?>
Required: 1. Create a file named lab3_diagram.gif for your diagram below. For image file conversion... You may use GIMP for file conversion. You may also use convert from the command-prompt. example: $ convert image.jpg lab3_diagram.gif Inside your <img> tag, apply a style element that will size your diagram to an appropriate size. example: style="width:800px;height:auto;"
Run your lab3sget program and contact your PHP file like this... ./lab3sget odin.cs.csub.edu /~myname/3350/lab3/lab3.php?param=hello Then try this... ./lab3sget odin.cs.csub.edu /~myname/3350/lab3/lab3.php?param=123 You should see the appropriate data returned.
Draw a Diagram!
Draw a Diagram to show the components of the system
that you just created during this assignment. Think about the flow
of data through the system. How would a user interact with it?
Your diagram might include
. your C++ program
. your local computer
. the Odin server
. the SSL certificate
. your PHP program
. the Apache web server
. your image file
. any other components you can think of
. etc.
Your instructor will contact your PHP file, with various parameters. Copy your DFD image file to your web directory, so it will be displayed when your web page (lab3.php) is viewed. Make sure your files lab3sget.c lab3sget.cpp Makefile are on Odin in your: 3350/3/ folder. Also required later... The components of this lab will be integrated into your project to provide communication with a server such as Odin. PHP will also work well with simple text files on the server. Track high scores or even simple 2-player action.