[guadec-web] Improved CSS
- From: Saumya Dwivedi <saumyad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [guadec-web] Improved CSS
- Date: Tue, 8 Jul 2014 06:40:23 +0000 (UTC)
commit 97d7c3b34841098bec3ec27461e3bfd6ad521ca2
Author: Saumya Dwivedi <saumya zero gmail com>
Date: Tue Jul 8 12:10:09 2014 +0530
Improved CSS
guadec/access-register.php | 28 ++++++++-------
guadec/confirm-payment.php | 83 +++++++++++++++++++++++++-------------------
guadec/ipn.php | 26 +++++++-------
3 files changed, 75 insertions(+), 62 deletions(-)
---
diff --git a/guadec/access-register.php b/guadec/access-register.php
index d0feabb..4872bdb 100644
--- a/guadec/access-register.php
+++ b/guadec/access-register.php
@@ -10,7 +10,7 @@ function display_result($result){
echo "<table class='regtable'><tr><th>ID</th><th>Name</th>
<th>Email</th><th>Gender</th>
<th>Arrival</th><th>Departure</th>
- <th>Sponsored</th><th>Lunch-Days</th>
+ <th>Sponsored</th>
<th>EntryFee</th>
<th>LunchFee</th><th>AccomFee</th>
<th>TotalFee</th>
@@ -24,7 +24,7 @@ function display_result($result){
echo "<td>"; echo $results['arrive']; echo "</td>";
echo "<td>"; echo $results['depart']; echo "</td>";
echo "<td>"; echo $results['sponsored']; echo "</td>";
- echo "<td>"; echo $results['lunchdays']; echo "</td>";
+// echo "<td>"; echo $results['lunchdays']; echo "</td>";
echo "<td>"; echo $results['entryfee']; echo "</td>";
echo "<td>"; echo $results['lunchfee']; echo "</td>";
echo "<td>"; echo $results['accomfee']; echo "</td>";
@@ -39,25 +39,18 @@ require_once("header.php");
echo "You are not authorised to view this page.";
}
else{
- echo "<form method='post' action=''>
- <div><select id='viewtype' name='viewtype'>
- <option value='showall' selected='selected'>Show All Entries</option>
- <option value='showcomplete'>Only Completed Registration</option>
- </select></div>
- <input type='submit' value='Go' />
- </form>";
-
+
if(isset($_POST['viewtype']) && !empty($_POST['viewtype'])) {
$action = $_POST['viewtype'];
- $table_name = $wpdb->prefix .'guadec2014_registrations';
+ // $table_name = $wpdb->prefix .'guadec2014_registration';
switch($action) {
case 'showall' :
- $result = $wpdb->get_results('SELECT * FROM wp_guadec2014_registrations', ARRAY_A);
+ $result = $wpdb->get_results('SELECT * FROM wp_guadec2014_registration', ARRAY_A);
echo display_result($result);
break;
case 'showcomplete' :
- $result = $wpdb->get_results("SELECT * FROM wp_guadec2014_registrations WHERE payment
= 'Completed' OR payment ='NoPayment'", ARRAY_A);
+ $result = $wpdb->get_results("SELECT * FROM wp_guadec2014_registration WHERE payment
= 'Completed' OR payment ='NoPayment'", ARRAY_A);
echo display_result($result);
break;
@@ -68,8 +61,17 @@ else{
}
}
else{
+
echo 'Select an option';
}
+ echo "<form method='post' action=''>
+ <div><select id='viewtype' name='viewtype'>
+ <option value='showall' selected='selected'>Show All Entries</option>
+ <option value='showcomplete'>Only Completed Registration</option>
+ </select></div>
+ <input type='submit' value='Go' />
+ </form>";
+
}
require_once("footer.php");
?>
\ No newline at end of file
diff --git a/guadec/confirm-payment.php b/guadec/confirm-payment.php
index 989d6ea..232075f 100644
--- a/guadec/confirm-payment.php
+++ b/guadec/confirm-payment.php
@@ -6,7 +6,7 @@ Template Name: Confirm Payment
<?php
$application_submitted = false;
$mailContent = '';
- $table_name = $wpdb->prefix .'guadec2014_registrations';
+ $table_name = $wpdb->prefix .'guadec2014_registration';
global $wpdb;
$sql = "CREATE TABLE $table_name (
@@ -47,23 +47,29 @@ if (!empty($_POST)) {
$country = (isset($_POST['contact_country']))?(trim(stripslashes($_POST['contact_country']))) : 'NA';
$diet = (isset($_POST['diet']))?(trim(stripslashes($_POST['diet']))) : 'NA';
- $entry = (isset($_POST['entry-fee']))?($_POST['entry-fee']):'0';
- $lamount = (isset($_POST['lfee']))?($_POST['lfee']):'0';
- $aamount = (isset($_POST['lfee']))?($_POST['afee']):'0';
- $tamount = (isset($_POST['lfee']))?($_POST['tfee']):'0';
+ $entry = (isset($_POST['entry-fee']))?(trim(stripslashes($_POST['entry-fee']))):'0';
+ $lamount = (isset($_POST['lfee']))?(trim(stripslashes($_POST['lfee']))):'0';
+ $aamount = (isset($_POST['lfee']))?(trim(stripslashes($_POST['afee']))):'0';
+ $tamount = (isset($_POST['lfee']))?(trim(stripslashes($_POST['tfee']))):'0';
$bday = (isset($_POST['bday']))?($_POST['bday']):'NA';
$student = ($_POST['student'] == true)?"YES":"NA";
- $sponsor_check = ($_POST['sponsored'] == true)?"YES":"NO";
- $payment = ($tamount > 0)?"Pending":"NoPayment";
- $accom = ($_POST['accommodation'] == true)?"YES":"NO";
-
$obfuscated_email = str_replace("@", " AT ", $email);
+ //check if the email already registered
+ //TODO: Add the payment condition, once ipn works
+ $repeat = $wpdb->get_var($wpdb->prepare(
+ "select id from wp_guadec2014_registration
+ where email=%s",
+ $email)
+ );
+
if (empty($name) || empty($email)) {
$errors = true;
}
-
+ if(!empty($repeat)){
+ $errors = true;
+ }
if(!isset($_POST['accommodation'])){
$arrive = "NA";
$depart = "NA";
@@ -80,6 +86,11 @@ if (!empty($_POST)) {
$x = $x + 1;
}
}
+ $sponsor_check = ($_POST['sponsored'] == true)?"YES":"NO";
+ $payment = ($tamount > 0)?"Pending":"NoPayment";
+ $accom = ($_POST['accommodation'] == true)?"YES":"NO";
+ $headers = "From: GUADEC 2014 Registration Script <membership-committee gnome org>\n";
+
if ($errors == false) {
/* This variable not be changed: goes to a restricted field to Paypal API */
$registerInfo =
@@ -92,11 +103,10 @@ if (!empty($_POST)) {
"lunchfee=".$lamount."&".
"accomfee=".$aamount."&".
"totalfee=".$tamount
- ;
+ ;
$mailContent .= $registerInfo;
- $subject = "GUADEC 2014 Registration";
- $headers = "From: GUADEC 2014 Registration Script <some-address gnome org>";
-
+ $subject = "From GUADEC 2014 Registration";
+ // $table_name = "registered";
$wpdb->insert($table_name, array('timeofregistration' => date("Y-m-d H:i:s"),
'name' => $name,
'email' => $email,
@@ -124,10 +134,10 @@ if (!empty($_POST)) {
<div>
<?php if(!($application_submitted == true)): ?>
- <div class="section group"> "Invalid Submission. Please go through registration page first."</div>
+ <div> "Invalid Submission. Please go through registration page first."</div>
<?php else: ?>
<?php if ($errors == true): ?>
- <div class="section group"> "Invalid name or email. Please check."<a
href="https://www.guadec.org/registration-form/"> Go back to Registration page</a></div>
+ <div> "Invalid/Already used email. Please make sure you are not already registered."<a
href="http://localhost/wordpress/?page_id=4787"> Go back to Registration </a>
<?php else: ?>
<?php //echo $registerInfo; ?>
<div class="section group">
@@ -183,34 +193,35 @@ if (!empty($_POST)) {
<div class="col span_1_of_2">€<?php echo $tamount;?></div>
</div>
+
<?php if ($tamount > 0): ?>
- <div class="section_group>">Your details have been stored. Proceed to pay €<?php echo
$tamount;?>.</div>
- <div class="col span_1_of_2">
- <form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr"
method="post">
- <input type="hidden" name="cmd" value="_xclick">
- <input type="hidden" name="business" value="saumya zero-facilitator gmail com">
- <input type="hidden" name="currency_code" value="EUR">
- <input type="hidden" name="item_name" value="Digital Download">
- <input type="hidden" name="amount" value="<?php echo $tamount; ?>">
- <!-- Redirect to thank you after successful payment -->
- <input type="hidden" name="return" value=" https://www.guadec.org/thank-you">
- <input type="hidden" name="custom" value="<?php echo $registerInfo; ?>">
+ <div>Your details have been stored. Proceed to pay €<?php echo $tamount;?>.</div>
+
+ <form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr"
method="post">
+ <input type="hidden" name="cmd" value="_xclick">
+ <input type="hidden" name="business" value="saumya zero-facilitator gmail com">
+ <input type="hidden" name="currency_code" value="EUR">
+ <input type="hidden" name="item_name" value="Digital Download">
+ <input type="hidden" name="amount" value="<?php echo $tamount; ?>">
+ <!-- Redirect to thank you after successful payment -->
+ <input type="hidden" name="return" value="http://localhost/wordpress/?page_id=4823">
+ <input type="hidden" name="custom" value="<?php echo $registerInfo; ?>">
- <!-- <Address of notification url. Can not be localhost -->
- <input type="hidden" name="notify_url"
value="http://www.guadec.org/wp-content/themes/guadec/ipn.php">
+ <!-- <Address of notification url. Can not be localhost -->
+ <input type="hidden" name="notify_url"
value="http://web.iiit.ac.in/~saumya.dwivedi/test/ipn.php">
- <!-- Redirect to thank you after cancelled payment -->
- <input type="hidden" name="cancel_return"
value="https://www.guadec.org/cancel-registration/">
-
- <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
- </form>
- </div>
+ <!-- Redirect to thank you after cancelled payment -->
+ <input type="hidden" name="cancel_return"
value="http://localhost/wordpress/?page_id=4823">
+
+ <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0"
name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
+ </form>
<?php else: ?>
<div>Your details have been stored. An email confirming your registration will be
sent to you shortly. Thank you.</div>
<!-- Send a confirm registration mail to the registered -->
+
<?php $mail = mail($email, $subject, $mailContent, $headers); ?>
<?php if($mail): ?>
- <div>"Mail sent."</div>
+ <div>"Mail sent"</div>
<?php else: ?>
<div>"Mail sending failed."</div>
<?php endif; ?>
diff --git a/guadec/ipn.php b/guadec/ipn.php
index 00252cd..1c86989 100755
--- a/guadec/ipn.php
+++ b/guadec/ipn.php
@@ -84,15 +84,15 @@ if ($verified) {
if (!empty($errmsg)) {
// manually investigate errors from the fraud checking
- $body .= "Registration Payment Successful-with fraud warning ";
- $body = "IPN failed fraud checks: \n$errmsg\n\n";
+ $body = "Registration Payment Successful-with fraud warning ";
+ $body .= "IPN failed fraud checks: \n$errmsg\n\n";
//append with the real payment details
$body .= $cvar['name'];
$body .= " with email ";
$body .= $cvar['email'];
$body .= $listener->getTextReport();
- error_log($body);
+ error_log($body); // Transcript copy in the error log
mail($_POST['receiver_email'], 'IPN Fraud Warning', $body, $headers);
mail($_POST['payer_email'], 'GUADEC-2014 Registration Payment:Waiting for Confirmation', $body,
$headers);
@@ -101,7 +101,7 @@ if ($verified) {
$reg_email = $cvar['email'];
var_dump($wpdb);
$table_name = $wpdb->prefix .'guadec2014_registration';
-
+ error_log($table_name); // check if the wpdb is accessible
// $wpdb->update(
// $table_name,
// array(
@@ -111,7 +111,7 @@ if ($verified) {
// 'email' => $reg_email
// )
// );
- $body .= "Registration Payment Successful for ";
+ $body = "Registration Payment Successful for ";
$body .= $cvar['name'];
$body .= " with email ";
$body .= $cvar['email'];
@@ -121,14 +121,14 @@ if ($verified) {
mail($_POST['payer_email'], 'GUADEC-2014 Registration Successful', $body, $headers);
$email_content =
"Name: " . $cvar['name'] . "\r\n".
- "Email: " . $email . "\r\n" .
- "Time: " . date("Y-m-d H:i:s"). "\r\n".
- "Arrival: ". $arrive . "\r\n".
- "Departure: ". $depart . "\r\n".
- "Entry-Fee Paid: ". $entry ."\r\n".
- "Lunch-Fee Paid: ".$lamount."\r\n".
- "Accomodation-Fee Paid: ".$aamount."\r\n".
- "Total Amount Paid: ".$tamount
+ "Email: " . $cvar['email'] . "\r\n" .
+ "Time: " . $cvar['time']. "\r\n".
+ "Arrival: ". $cvar['arrive'] . "\r\n".
+ "Departure: ". $cvar['depart'] . "\r\n".
+ "Entry-Fee Paid: ". $cvar['entryfee'] ."\r\n".
+ "Lunch-Fee Paid: ".$cvar['lunchfee']."\r\n".
+ "Accomodation-Fee Paid: ".$cvar['accomfee']."\r\n".
+ "Total Amount Paid: ".$cvar['totalfee']
;
$body .= $email_content;
mail($cvar['email'], 'GUADEC-2014 Registration Successful', $body, $headers);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]