ianhaney50
Members-
Posts
261 -
Joined
-
Last visited
-
Days Won
1
Everything posted by ianhaney50
-
Hi Thank you for the quick reply, appreciate it Oh right, what we want is to auto generate repair numbers rather than ourselves having to put each one in ourselves and to avoid duplication as well as we might forget what the last repair number was
-
Hi I have created a form that stores data in a MySQL database and all works perfect but was wondering if there is a way to pre fill the ID number from the MySQL database so for example the last ID number is 8 so when I go the form next time to add new data, the ID number would already be pre filled for me and would be 9 Is that possible to do? I tried doing a Google search but could not find anything related to what I need Thank you in advance Ian
-
Hi hyster Thank you so much for the reply, appreciate it I put the coding in and got the following error within the table that displays the results from the database Notice: Undefined index: id in /home/sites/it-doneright.co.uk/public_html/admin/view-customers.php on line 79 " onClick="return confirm('."'Are you sure you want to delete this record?');".'">Delete
-
Hi I am in the middle of making a edit customers details php page and came across a id issue, it is adding odd numbers to the id instead of the correct id it should be below is my coding for the view customers php page <?php $con= mysqli_connect("localhost", "username", "password", "username"); if(!$con) { die('not connected'); } $con= mysqli_query($con, "SELECT plans_name, machine1, machine2, machine3, machine4, machine5, customer_name, customer_email, customer_phone, DATE_FORMAT(date_purchased_plan, '%d/%m/%Y') AS date_purchased_plan from plans"); ?> <div> <td>Customers</td> <table> <th>Support Plan</th> <th>Machine 1</th> <th>Machine 2</th> <th>Machine 3</th> <th>Machine 4</th> <th>Machine 5</th> <th>Customer Name</th> <th>Customer Email</th> <th>Customer Phone</th> <th>Plan Purchase Date</th> <th colspan="2">Actions</th> </tr> <?php while($row= mysqli_fetch_array($con)) { ?> <tr> <td><?php echo $row['plans_name']; ?></td> <td><?php echo $row['machine1']; ?></td> <td><?php echo $row['machine2']; ?></td> <td><?php echo $row['machine3'] ;?></td> <td><?php echo $row['machine4'] ;?></td> <td><?php echo $row['machine5'] ;?></td> <td><?php echo $row['customer_name'] ;?></td> <td><?php echo $row['customer_email'] ;?></td> <td><?php echo $row['customer_phone'] ;?></td> <td><?php echo $row['date_purchased_plan'];?></td> <td><a href="edit-customer.php?id=' . $row['id'] . '">Edit</a></td> <td><a href="delete.php?id=' . $row['id'] . '" onClick="return confirm('."'Are you sure you want to delete this record?');".'">Delete</a></td> </tr> <?php } ?> </table> </div> In the url when I click on edit, the url looks like the following http://www.it-doneright.co.uk/admin/edit-customer.php?id=%27%20.%20$row[%27id%27]%20.%20%27 see the issue with the %27%20 etc. is there something I need to add in the view-customers.php file? Thank you in advance Ian
-
Hi iarp Thank you, appreciate it, will take a look
-
Hi I need to create a PayPal donate button on a website which is the easy part but need to display the amount donated so far on the website and seeing how I would do it, would it be done by using API or is there another way to do it as looked all over Google and can't see a way to do it? Thank you in advance Ian
-
Think I sort of sussed it, I am not getting any errors now but the page is blank and is not adding nothing to the database nor is it redirecting to PayPal not sure if it is the register.php or the ipn.php causing the issue the ipn.php code is below <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); mysql_connect("", "", "") or die(mysql_error()); mysql_select_db("") or die(mysql_error()); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $header = "POST /cgi-bin/webscr HTTP/1.1\r\n"; $header .= "Host: www.sanbox.paypal.com\r\n"; $header .= "Accept: */*\r\n"; $header .= "Connection: Close\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "\r\n"; /*$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);*/ $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); $res = stream_get_contents($fp, 2048); if (strcmp ($res, "VERIFIED") == 0) { // PAYMENT VALIDATED & VERIFIED! $username = mysqli_real_escape_string($mysqli, $_POST['username']); $password = md5($_POST['password']); $name = mysqli_real_escape_string($mysqli, $_POST['name']); $email = mysqli_real_escape_string($mysqli, $_POST['email']); $address1 = mysqli_real_escape_string($mysqli, $_POST['address1']); $address2 = mysqli_real_escape_string($mysqli, $_POST['address2']); $town = mysqli_real_escape_string($mysqli, $_POST['town']); $county = mysqli_real_escape_string($mysqli, $_POST['county']); $postcode = mysqli_real_escape_string($mysqli, $_POST['postcode']); $telnumber = mysqli_real_escape_string($mysqli, $_POST['telnumber']); $mobnumber = mysqli_real_escape_string($mysqli, $_POST['mobnumber']); $model = mysqli_real_escape_string($mysqli, $_POST['model']); $numplate = mysqli_real_escape_string($mysqli, $_POST['numplate']); $tax = ($_POST['tax']); $mot = ($_POST['mot']); $insurance = ($_POST['insurance']); $mobnumber = preg_replace('/^07/','447',$mobnumber); $mobnumber = str_replace(' ', '', $mobnumber); # insert data into mysql database $sql = "INSERT INTO `users` (`id`, `username`, `password`, `name`, `email`, `address1`, `address2`, `town`, `county`, `postcode`, `telnumber`, `mobnumber`, `model`, `numplate`) VALUES (NULL, '{$username}', '{$password}', '{$name}', '{$email}', '{$address1}', '{$address2}', '{$town}', '{$county}', '{$postcode}', '{$telnumber}', '{$mobnumber}', '{$model}', '{$numplate}')"; $result = $mysqli->query($sql); $id = $mysqli->insert_id; $insurance = date('Y-m-d', strtotime($_POST['insurance'])); $mot = date('Y-m-d', strtotime($_POST['mot'])); $tax = date('Y-m-d', strtotime($_POST['tax'])); $sql = "INSERT INTO renewal (id, item_id, renewal_date) VALUES ($id, 1, '$insurance'), ($id, 2, '$mot'), ($id, 3, '$tax')"; if ($mysqli->query($sql)) { $to = $_POST['email']; $subject = "Thank you for your purchase - Login Credentials"; $message = "Thank you for purchasing and signing up, your login information is below \r\n Username: {$_POST['username']} \r\n Password: {$_POST['password']} \r\n You can now login at http://www.taxelephants.uk/login';"; $header = "From:noreply@taxelephants.uk \r\n"; $retval = mail ($to,$subject,$message,$header); if( $retval == true ) { echo "Message sent successfully..."; } else { echo "Message could not be sent..."; } } else if (strcmp ($res, "INVALID") == 0) { $to = 'info@taxelephants.co.uk'; $subject = 'Invalid Payment'; $message = ' Dear Administrator, A payment has been made but is flagged as INVALID. Please verify the payment manually and contact the buyer. Buyer Email: '.$email.' '; $headers = 'From:noreply@taxelephants.co.uk' . "\r\n"; mail($to, $subject, $message, $headers); fclose ($fp); } } } ?> The coding from the register.php file is below <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); require_once("functions.php"); require_once("db-const.php"); $title = "Register - The Tax Elephants"; $pgDesc=""; $pgKeywords=""; include ( 'includes/header.php' ); if (isset($_POST['submit']) && isset($error) == '') { // if there is no error, then process further echo "<p class='success'>Form has been submitted successfully.</p>"; // showing success message ## connect mysql server $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); # check connection if ($mysqli->connect_errno) { echo "<p>MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}</p>"; exit(); } # check if username and email exist else insert // u = username, e = emai, ue = both username and email already exists $exists = ""; $result = $mysqli->query("SELECT username from users WHERE username = '{$username}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "u"; } $result = $mysqli->query("SELECT email from users WHERE email = '{$email}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "e"; } if ($exists == "u") echo "<p><b>Error:</b> Username already exists!</p>"; else if ($exists == "e") echo "<p><b>Error:</b> Email already exists!</p>"; else if ($exists == "ue") echo "<p><b>Error:</b> Username and Email already exists!</p>"; /*redirect_to("login.php?msg=Registered successfully");*/ /*redirect_to("http://www.paypal.com");*/ redirect_to("http://www.sandbox.paypal.com"); } /*else { echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>"; }*/ ?> <div id="column-whole"> <!-- The HTML registration form --> <form action="ipn.php" method="post"> <label>Username:</label> <input type="text" name="username" required="required" placeholder="Please Enter your chosen username"/> <br /> <label>Password:</label> <div class='pwdwidgetdiv' id='thepwddiv'></div> <script type="text/javascript" > var pwdwidget = new PasswordWidget('thepwddiv','password'); pwdwidget.MakePWDWidget(); </script> <noscript> <input type="password" name="password" required="required" placeholder="Please Enter your chosen password"/> </noscript> <br /> <div class='para'> <br /> <label>Name:</label> <input type="text" name="name" required="required" placeholder="Please Enter your name"> <br /> <label>Email:</label> <input type="email" name="email" required="required" placeholder="Please Enter your email"/> <br /> <label>Address Line 1:</label> <input type="text" name="address1" required="required" placeholder="Please Enter the first line of your address"/> <br /> <label>Address Line 2:</label> <input type="text" name="address2" placeholder="Please Enter the second line of your address"/> <br /> <label>Town:</label> <input type="text" name="town" required="required" placeholder="Please Enter your town"/> <br /> <label>County:</label> <input type="text" name="county" required="required" placeholder="Please Enter your county"/> <br /> <label>Postcode:</label> <input type="text" name="postcode" required="required" placeholder="Please Enter your postcode"/> <br /> <label>Telephone Number:</label> <input type="text" name="telnumber" required="required" placeholder="Please Enter your landline number"/> <br /> <div data-tip="please enter as 447123456789 format"> <label>Mobile Number:</label> <input type="text" name="mobnumber" required="required" placeholder="Please Enter your mobile number"/> </div> <label>Car/Van Model:</label> <input type="text" name="model" required="required" placeholder="Please Enter your car/van model"/> <br /> <label>Car/Van Number Plate:</label> <input type="text" name="numplate" required="required" placeholder="Please Enter your car/number plate"/> <br /> <label>Car Tax Renewal Date :</label> <input type="text" id="datepicker" name="tax" placeholder="Please Enter your Car Tax Renewal Date"/> <br> <label>MOT Expiry Date :</label> <input type="text" id="datepicker2" name="mot" placeholder="Please Enter your MOT Expiry Date"/> <br /> <label>Insurance Expiry Date :</label> <input type="text" id="datepicker3" name="insurance" placeholder="Please Enter your Insurance Expiry Date"/> <br><br> <div class="box"> <label>I agree to the <a href="terms.php" target="_blank">terms</a></label> </div> <input type="checkbox" class="checkbox" id="the-terms" value="I Agree"> <!-- Specify a Subscribe button. --> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="ItemName" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemNumber" value="ARSTE0001" /> <input type="hidden" name="ItemDesc" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemPrice" value="3.00" /> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="Y"> <!-- Set recurring payments until canceled. --> <input type="hidden" name="src" value="1"> <!--DO NOT PROMPT FOR SHIPPING ADDRESS--> <input type="hidden" name="no_shipping" value="1"> <input class="dw_button" type="submit" name="submit" value="Regster and Pay (£3.00)" disabled="disabled" id="submitBtn" /> </form> <a class="haveaccount" href="login.php">I already have an account...</a> </div> </div> <!--CONTENT--> <script> $(document).ready(function() { var the_terms = $("#the-terms"); the_terms.click(function() { if ($(this).is(":checked")) { $("#submitBtn").removeAttr("disabled"); } else { $("#submitBtn").attr("disabled", "disabled"); } }); }); </script> <?php include( 'includes/footer.php' ); ?> I thought it might be the register.php as the redirect code is in there but maybe it needs moving to the ipn.php or the ipn.php coding might need altering or moving
-
Just done a test and the error I got on the ipn.php page is below Warning: fgets(): SSL: Connection reset by peer in /home/sites/taxelephants.uk/public_html/ipn.php on line 30 The ipn.php code is below <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); mysql_connect("", "", "") or die(mysql_error()); mysql_select_db("") or die(mysql_error()); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; /*$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);*/ $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // PAYMENT VALIDATED & VERIFIED! $username = mysqli_real_escape_string($mysqli, $_POST['username']); $password = md5($_POST['password']); $name = mysqli_real_escape_string($mysqli, $_POST['name']); $email = mysqli_real_escape_string($mysqli, $_POST['email']); $address1 = mysqli_real_escape_string($mysqli, $_POST['address1']); $address2 = mysqli_real_escape_string($mysqli, $_POST['address2']); $town = mysqli_real_escape_string($mysqli, $_POST['town']); $county = mysqli_real_escape_string($mysqli, $_POST['county']); $postcode = mysqli_real_escape_string($mysqli, $_POST['postcode']); $telnumber = mysqli_real_escape_string($mysqli, $_POST['telnumber']); $mobnumber = mysqli_real_escape_string($mysqli, $_POST['mobnumber']); $model = mysqli_real_escape_string($mysqli, $_POST['model']); $numplate = mysqli_real_escape_string($mysqli, $_POST['numplate']); $tax = ($_POST['tax']); $mot = ($_POST['mot']); $insurance = ($_POST['insurance']); $mobnumber = preg_replace('/^07/','447',$mobnumber); $mobnumber = str_replace(' ', '', $mobnumber); # insert data into mysql database $sql = "INSERT INTO `users` (`id`, `username`, `password`, `name`, `email`, `address1`, `address2`, `town`, `county`, `postcode`, `telnumber`, `mobnumber`, `model`, `numplate`) VALUES (NULL, '{$username}', '{$password}', '{$name}', '{$email}', '{$address1}', '{$address2}', '{$town}', '{$county}', '{$postcode}', '{$telnumber}', '{$mobnumber}', '{$model}', '{$numplate}')"; $result = $mysqli->query($sql); $id = $mysqli->insert_id; $insurance = date('Y-m-d', strtotime($_POST['insurance'])); $mot = date('Y-m-d', strtotime($_POST['mot'])); $tax = date('Y-m-d', strtotime($_POST['tax'])); $sql = "INSERT INTO renewal (id, item_id, renewal_date) VALUES ($id, 1, '$insurance'), ($id, 2, '$mot'), ($id, 3, '$tax')"; if ($mysqli->query($sql)) { $to = $_POST['email']; $subject = "Thank you for your purchase - Login Credentials"; $message = "Thank you for purchasing and signing up, your login information is below \r\n Username: {$_POST['username']} \r\n Password: {$_POST['password']} \r\n You can now login at http://www.taxelephants.uk/login';"; $header = "From:noreply@taxelephants.uk \r\n"; $retval = mail ($to,$subject,$message,$header); if( $retval == true ) { echo "Message sent successfully..."; } else { echo "Message could not be sent..."; } } else if (strcmp ($res, "INVALID") == 0) { $to = 'info@taxelephants.co.uk'; $subject = 'Invalid Payment'; $message = ' Dear Administrator, A payment has been made but is flagged as INVALID. Please verify the payment manually and contact the buyer. Buyer Email: '.$email.' '; $headers = 'From:noreply@taxelephants.co.uk' . "\r\n"; mail($to, $subject, $message, $headers); fclose ($fp); } } } } ?> I understand mysql is not good to use and is better to use mysqli but just want to get it working first
-
I have taken on board the comments and is now working, below is the updated code just to confirm, was the reason nothing was displayed was because of the exit(); is that right? <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); require_once("functions.php"); require_once("db-const.php"); $title = "Register - The Tax Elephants"; $pgDesc=""; $pgKeywords=""; include ( 'includes/header.php' ); if (isset($_POST['submit']) && isset($error) == '') { // if there is no error, then process further echo "<p class='success'>Form has been submitted successfully.</p>"; // showing success message ## connect mysql server $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); # check connection if ($mysqli->connect_errno) { echo "<p>MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}</p>"; exit(); } # check if username and email exist else insert // u = username, e = emai, ue = both username and email already exists $exists = ""; $result = $mysqli->query("SELECT username from users WHERE username = '{$username}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "u"; } $result = $mysqli->query("SELECT email from users WHERE email = '{$email}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "e"; } if ($exists == "u") echo "<p><b>Error:</b> Username already exists!</p>"; else if ($exists == "e") echo "<p><b>Error:</b> Email already exists!</p>"; else if ($exists == "ue") echo "<p><b>Error:</b> Username and Email already exists!</p>"; /*redirect_to("login.php?msg=Registered successfully");*/ /*redirect_to("http://www.paypal.com");*/ redirect_to("http://www.sandbox.paypal.com"); } /*else { echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>"; }*/ ?> <div id="column-whole"> <!-- The HTML registration form --> <form action="ipn.php" method="post"> <label>Username:</label> <input type="text" name="username" required="required" placeholder="Please Enter your chosen username"/> <br /> <label>Password:</label> <div class='pwdwidgetdiv' id='thepwddiv'></div> <script type="text/javascript" > var pwdwidget = new PasswordWidget('thepwddiv','password'); pwdwidget.MakePWDWidget(); </script> <noscript> <input type="password" name="password" required="required" placeholder="Please Enter your chosen password"/> </noscript> <br /> <div class='para'> <br /> <label>Name:</label> <input type="text" name="name" required="required" placeholder="Please Enter your name"> <br /> <label>Email:</label> <input type="email" name="email" required="required" placeholder="Please Enter your email"/> <br /> <label>Address Line 1:</label> <input type="text" name="address1" required="required" placeholder="Please Enter the first line of your address"/> <br /> <label>Address Line 2:</label> <input type="text" name="address2" placeholder="Please Enter the second line of your address"/> <br /> <label>Town:</label> <input type="text" name="town" required="required" placeholder="Please Enter your town"/> <br /> <label>County:</label> <input type="text" name="county" required="required" placeholder="Please Enter your county"/> <br /> <label>Postcode:</label> <input type="text" name="postcode" required="required" placeholder="Please Enter your postcode"/> <br /> <label>Telephone Number:</label> <input type="text" name="telnumber" required="required" placeholder="Please Enter your landline number"/> <br /> <div data-tip="please enter as 447123456789 format"> <label>Mobile Number:</label> <input type="text" name="mobnumber" required="required" placeholder="Please Enter your mobile number"/> </div> <label>Car/Van Model:</label> <input type="text" name="model" required="required" placeholder="Please Enter your car/van model"/> <br /> <label>Car/Van Number Plate:</label> <input type="text" name="numplate" required="required" placeholder="Please Enter your car/number plate"/> <br /> <label>Car Tax Renewal Date :</label> <input type="text" id="datepicker" name="tax" placeholder="Please Enter your Car Tax Renewal Date"/> <br> <label>MOT Expiry Date :</label> <input type="text" id="datepicker2" name="mot" placeholder="Please Enter your MOT Expiry Date"/> <br /> <label>Insurance Expiry Date :</label> <input type="text" id="datepicker3" name="insurance" placeholder="Please Enter your Insurance Expiry Date"/> <br><br> <div class="box"> <label>I agree to the <a href="terms.php" target="_blank">terms</a></label> </div> <input type="checkbox" class="checkbox" id="the-terms" value="I Agree"> <!-- Specify a Subscribe button. --> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="ItemName" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemNumber" value="ARSTE0001" /> <input type="hidden" name="ItemDesc" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemPrice" value="3.00" /> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="Y"> <!-- Set recurring payments until canceled. --> <input type="hidden" name="src" value="1"> <!--DO NOT PROMPT FOR SHIPPING ADDRESS--> <input type="hidden" name="no_shipping" value="1"> <input class="dw_button" type="submit" name="submit" value="Regster and Pay (£3.00)" disabled="disabled" id="submitBtn" /> </form> <a class="haveaccount" href="login.php">I already have an account...</a> </div> </div> <!--CONTENT--> <script> $(document).ready(function() { var the_terms = $("#the-terms"); the_terms.click(function() { if ($(this).is(":checked")) { $("#submitBtn").removeAttr("disabled"); } else { $("#submitBtn").attr("disabled", "disabled"); } }); }); </script> <?php include( 'includes/footer.php' ); ?> I will do a test now and hopefully will work with the ipn.php, if not is it ok to post on this thread any errors etc.
-
I have updated the coding slightly as realised I had a closing div tag missing and then took out some other PHP code as I put it in the ipn.php file which will show shortly as just trying to get 1 thing at a time working and get the form showing <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <?php require_once("functions.php"); require_once("db-const.php"); ?> <?php $title = "Register - The Tax Elephants"; $pgDesc=""; $pgKeywords=""; include ( 'includes/header.php' ); ?> <!--CONTENT--> <?php if (isset($_POST['submit']) && isset($error) == '') { // if there is no error, then process further echo "<p class='success'>Form has been submitted successfully.</p>"; // showing success message ## connect mysql server $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); # check connection if ($mysqli->connect_errno) { echo "<p>MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}</p>"; exit(); } # check if username and email exist else insert // u = username, e = emai, ue = both username and email already exists $exists = ""; $result = $mysqli->query("SELECT username from users WHERE username = '{$username}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "u"; } $result = $mysqli->query("SELECT email from users WHERE email = '{$email}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "e"; } if ($exists == "u") echo "<p><b>Error:</b> Username already exists!</p>"; else if ($exists == "e") echo "<p><b>Error:</b> Email already exists!</p>"; else if ($exists == "ue") echo "<p><b>Error:</b> Username and Email already exists!</p>"; /*redirect_to("login.php?msg=Registered successfully");*/ /*redirect_to("http://www.paypal.com");*/ redirect_to("http://www.sandbox.paypal.com"); } /*else { /*echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>"; }*/ exit(); ?> <div id="column-whole"> <!-- The HTML registration form --> <form action="ipn.php" method="post"> <label>Username:</label> <input type="text" name="username" required="required" placeholder="Please Enter your chosen username"/> <br /> <label>Password:</label> <div class='pwdwidgetdiv' id='thepwddiv'></div> <script type="text/javascript" > var pwdwidget = new PasswordWidget('thepwddiv','password'); pwdwidget.MakePWDWidget(); </script> <noscript> <input type="password" name="password" required="required" placeholder="Please Enter your chosen password"/> </noscript> <br /> <div class='para'> <br /> <label>Name:</label> <input type="text" name="name" required="required" placeholder="Please Enter your name"> <br /> <label>Email:</label> <input type="email" name="email" required="required" placeholder="Please Enter your email"/> <br /> <label>Address Line 1:</label> <input type="text" name="address1" required="required" placeholder="Please Enter the first line of your address"/> <br /> <label>Address Line 2:</label> <input type="text" name="address2" placeholder="Please Enter the second line of your address"/> <br /> <label>Town:</label> <input type="text" name="town" required="required" placeholder="Please Enter your town"/> <br /> <label>County:</label> <input type="text" name="county" required="required" placeholder="Please Enter your county"/> <br /> <label>Postcode:</label> <input type="text" name="postcode" required="required" placeholder="Please Enter your postcode"/> <br /> <label>Telephone Number:</label> <input type="text" name="telnumber" required="required" placeholder="Please Enter your landline number"/> <br /> <div data-tip="please enter as 447123456789 format"> <label>Mobile Number:</label> <input type="text" name="mobnumber" required="required" placeholder="Please Enter your mobile number"/> </div> <label>Car/Van Model:</label> <input type="text" name="model" required="required" placeholder="Please Enter your car/van model"/> <br /> <label>Car/Van Number Plate:</label> <input type="text" name="numplate" required="required" placeholder="Please Enter your car/number plate"/> <br /> <label>Car Tax Renewal Date :</label> <input type="text" id="datepicker" name="tax" placeholder="Please Enter your Car Tax Renewal Date"/> <br> <label>MOT Expiry Date :</label> <input type="text" id="datepicker2" name="mot" placeholder="Please Enter your MOT Expiry Date"/> <br /> <label>Insurance Expiry Date :</label> <input type="text" id="datepicker3" name="insurance" placeholder="Please Enter your Insurance Expiry Date"/> <br><br> <div class="box"> <label>I agree to the <a href="terms.php" target="_blank">terms</a></label> </div> <input type="checkbox" class="checkbox" id="the-terms" value="I Agree"> <!-- Specify a Subscribe button. --> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="ItemName" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemNumber" value="ARSTE0001" /> <input type="hidden" name="ItemDesc" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemPrice" value="3.00" /> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="Y"> <!-- Set recurring payments until canceled. --> <input type="hidden" name="src" value="1"> <!--DO NOT PROMPT FOR SHIPPING ADDRESS--> <input type="hidden" name="no_shipping" value="1"> <input class="dw_button" type="submit" name="submit" value="Regster and Pay (£3.00)" disabled="disabled" id="submitBtn" /> </form> <a class="haveaccount" href="login.php">I already have an account...</a> </div> </div> <!--CONTENT--> <script> $(document).ready(function() { var the_terms = $("#the-terms"); the_terms.click(function() { if ($(this).is(":checked")) { $("#submitBtn").removeAttr("disabled"); } else { $("#submitBtn").attr("disabled", "disabled"); } }); }); </script> <?php include( 'includes/footer.php' ); ?>
-
Ahh yeah didn't see that I have taken the one out now that is below the <a class="haveaccount" href="login.php">I already have an account...</a> line But the form does not show still?
-
I have a link in another forum http://www.codingforums.com/php/343325-need-help-php-coding-flow.html#post1452910
-
Hi I am trying to alter the flow of my php website, the flow currently is the user pays via PayPal and then redirects back from PayPal to the site to fill out their info but now the client wants users to sign up first and then redirected to PayPal but the data is only stored in the database if payment is successful so am using PayPal IPN, I have turned it on via the PayPal account and set the url of the ipn php code I am getting the page showing but no sign up form, below is my signup form, is it ok if someone can check to see if is ok, I have error reporting in but is showing no errors <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <?php require_once("functions.php"); require_once("db-const.php"); ?> <?php $title = "Register - The Tax Elephants"; $pgDesc=""; $pgKeywords=""; include ( 'includes/header.php' ); ?> <!--CONTENT--> <?php if (isset($_POST['submit']) && isset($error) == '') { // if there is no error, then process further echo "<p class='success'>Form has been submitted successfully.</p>"; // showing success message ## connect mysql server $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); # check connection if ($mysqli->connect_errno) { echo "<p>MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}</p>"; exit(); } ## query database # prepare data for insertion $username = mysqli_real_escape_string($mysqli, $_POST['username']); $password = md5($_POST['password']); /*$password = $_POST['password'];*/ $name = mysqli_real_escape_string($mysqli, $_POST['name']); $email = mysqli_real_escape_string($mysqli, $_POST['email']); $address1 = mysqli_real_escape_string($mysqli, $_POST['address1']); $address2 = mysqli_real_escape_string($mysqli, $_POST['address2']); $town = mysqli_real_escape_string($mysqli, $_POST['town']); $county = mysqli_real_escape_string($mysqli, $_POST['county']); $postcode = mysqli_real_escape_string($mysqli, $_POST['postcode']); $telnumber = mysqli_real_escape_string($mysqli, $_POST['telnumber']); $mobnumber = mysqli_real_escape_string($mysqli, $_POST['mobnumber']); $model = mysqli_real_escape_string($mysqli, $_POST['model']); $numplate = mysqli_real_escape_string($mysqli, $_POST['numplate']); $tax = ($_POST['tax']); $mot = ($_POST['mot']); $insurance = ($_POST['insurance']); $mobnumber = preg_replace('/^07/','447',$mobnumber); $mobnumber = str_replace(' ', '', $mobnumber); # check if username and email exist else insert // u = username, e = emai, ue = both username and email already exists $exists = ""; $result = $mysqli->query("SELECT username from users WHERE username = '{$username}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "u"; } $result = $mysqli->query("SELECT email from users WHERE email = '{$email}' LIMIT 1"); if ($result->num_rows == 1) { $exists .= "e"; } if ($exists == "u") echo "<p><b>Error:</b> Username already exists!</p>"; else if ($exists == "e") echo "<p><b>Error:</b> Email already exists!</p>"; else if ($exists == "ue") echo "<p><b>Error:</b> Username and Email already exists!</p>"; /*redirect_to("login.php?msg=Registered successfully");*/ /*redirect_to("http://www.paypal.com");*/ redirect_to ("http://www.sandbox.paypal.com"); } else { /*echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>";*/ exit(); } ?> <div id="column-whole"> <!-- The HTML registration form --> <form action="ipn.php" method="post"> <label>Username:</label> <input type="text" name="username" required="required" placeholder="Please Enter your chosen username"/> <br /> <label>Password:</label> <div class='pwdwidgetdiv' id='thepwddiv'></div> <script type="text/javascript" > var pwdwidget = new PasswordWidget('thepwddiv','password'); pwdwidget.MakePWDWidget(); </script> <noscript> <input type="password" name="password" required="required" placeholder="Please Enter your chosen password"/> </noscript> <br /> <div class='para'> <br /> <label>Name:</label> <input type="text" name="name" required="required" placeholder="Please Enter your name"> <br /> <label>Email:</label> <input type="email" name="email" required="required" placeholder="Please Enter your email"/> <br /> <label>Address Line 1:</label> <input type="text" name="address1" required="required" placeholder="Please Enter the first line of your address"/> <br /> <label>Address Line 2:</label> <input type="text" name="address2" placeholder="Please Enter the second line of your address"/> <br /> <label>Town:</label> <input type="text" name="town" required="required" placeholder="Please Enter your town"/> <br /> <label>County:</label> <input type="text" name="county" required="required" placeholder="Please Enter your county"/> <br /> <label>Postcode:</label> <input type="text" name="postcode" required="required" placeholder="Please Enter your postcode"/> <br /> <label>Telephone Number:</label> <input type="text" name="telnumber" required="required" placeholder="Please Enter your landline number"/> <br /> <div data-tip="please enter as 447123456789 format"> <label>Mobile Number:</label> <input type="text" name="mobnumber" required="required" placeholder="Please Enter your mobile number"/> </div> <label>Car/Van Model:</label> <input type="text" name="model" required="required" placeholder="Please Enter your car/van model"/> <br /> <label>Car/Van Number Plate:</label> <input type="text" name="numplate" required="required" placeholder="Please Enter your car/number plate"/> <br /> <label>Car Tax Renewal Date :</label> <input type="text" id="datepicker" name="tax" placeholder="Please Enter your Car Tax Renewal Date"/> <br> <label>MOT Expiry Date :</label> <input type="text" id="datepicker2" name="mot" placeholder="Please Enter your MOT Expiry Date"/> <br /> <label>Insurance Expiry Date :</label> <input type="text" id="datepicker3" name="insurance" placeholder="Please Enter your Insurance Expiry Date"/> <br><br> <div class="box"> <label>I agree to the <a href="terms.php" target="_blank">terms</a></label> </div> <input type="checkbox" class="checkbox" id="the-terms" value="I Agree"> <!-- Specify a Subscribe button. --> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="ItemName" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemNumber" value="ARSTE0001" /> <input type="hidden" name="ItemDesc" value="Automatic Reminder Service - Tax Elephants" /> <input type="hidden" name="ItemPrice" value="3.00" /> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="Y"> <!-- Set recurring payments until canceled. --> <input type="hidden" name="src" value="1"> <!--DO NOT PROMPT FOR SHIPPING ADDRESS--> <input type="hidden" name="no_shipping" value="1"> <input class="dw_button" type="submit" name="submit" value="Regster and Pay (£3.00)" disabled="disabled" id="submitBtn" /> </form> <a class="haveaccount" href="login.php">I already have an account...</a> </form> </div> <!--CONTENT--> <script> $(document).ready(function() { var the_terms = $("#the-terms"); the_terms.click(function() { if ($(this).is(":checked")) { $("#submitBtn").removeAttr("disabled"); } else { $("#submitBtn").attr("disabled", "disabled"); } }); }); </script> <?php include( 'includes/footer.php' ); ?> I am confused as to why?
-
help integrating a auto email php file into opencart
ianhaney50 replied to ianhaney50's topic in PHP Coding Help
I def think is a sql issue as just done a new order with a date of 31st July 2015 so it should show when I do the sql directly in phpmyadmin or should show on the page instead of just blank the query is below SELECT order_option_id , name , DATE_FORMAT(value, '%e %M %Y') FROM oc_order_option INNER JOIN oc_order u USING (order_id) INNER JOIN oc_order v USING (customer_id) WHERE value BETWEEN CURDATE() AND CURDATE()+INTERVAL 14 DAY AND IFNULL(value, '1901-01-01') < CURDATE()-INTERVAL 14 DAY UNION SELECT order_option_id , name , DATE_FORMAT(value, '%e %M %Y') FROM oc_order_option INNER JOIN oc_order u USING (order_id) INNER JOIN oc_order v USING (customer_id) WHERE value BETWEEN CURDATE() AND CURDATE()+INTERVAL 7 DAY AND IFNULL(value, '1901-01-01') < CURDATE()-INTERVAL 7 DAY ORDER BY order_option_id I can't attach the SQL file to this post, does anyone know how I can attach it or know a link to use to attach it? -
help integrating a auto email php file into opencart
ianhaney50 replied to ianhaney50's topic in PHP Coding Help
I have done a var_dump($sqlCommand); and outputted the query which is good as guess is working, I just thought I am going to input it directly in phpmyadmin and see if it returns anything, does the query output look ok? string(778) "SELECT order_option_id , name , DATE_FORMAT(value, '%e %M %Y') FROM oc_order_option INNER JOIN oc_order u USING (order_id) INNER JOIN oc_order v USING (customer_id) WHERE value BETWEEN CURDATE() AND CURDATE()+INTERVAL 14 DAY AND IFNULL(value, '1901-01-01') < CURDATE()-INTERVAL 14 DAY UNION SELECT order_option_id , name , DATE_FORMAT(value, '%e %M %Y') FROM oc_order_option INNER JOIN oc_order u USING (order_id) INNER JOIN oc_order v USING (customer_id) WHERE value BETWEEN CURDATE() AND CURDATE()+INTERVAL 7 DAY AND IFNULL(value, '1901-01-01') < CURDATE()-INTERVAL 7 DAY ORDER BY order_option_id" Just entered the query directly in phpmyadmin and returned no results but the date in the database is 24-7-2015 so thought it would output the info unless the data is not being returned from the database, I know it is connecting to the DB as not getting a failed to connect message Shall I export the DB and attach the sql on here? -
help integrating a auto email php file into opencart
ianhaney50 replied to ianhaney50's topic in PHP Coding Help
Sorry got a update, I have sorted the error, it was in my ORDER clause as I actually read the error and took value out from the order clause, so am now error free and the page is blank white now but thought it would output info on the page as got echo and the php variables in, I am just going to try a var_dump of the sql to see if the query is working and will post a update in a min -
Hi I am using opencart to make a website that allows users to order a service for car tax, mot and insurance reminders, it all works perfect but need to integrate the email reminder and SMS reminder php coding into opencart I have made the car tax expiry date, car mot expiry date and car insurance expiry date as a product option and then has a date field so they can enter the expiry date, all works perfect and gets stored in the database when I did a test order so I just need bit of help on how to get the expiry date and option title from the database and displayed within the email php coding I found the oc_order_option table in the database with the date and name but how do I get that from the database and displayed within a email, below is my coding for the email reminder php file I uploaded the file to the web server and got the following error on the page Unknown column 'value' in 'order clause' The value though is the column name in the oc_order_option within the database The updated code is below <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <html> <title>Automatic Email</title> <body> <?php $db = mysqli_connect("" , "", "") or die("Check connection parameters!"); // Optionally skip select_db and use: mysqli_connect(host,user,pass,dbname) mysqli_select_db($db,"") or die(mysqli_error($db)); if (mysqli_connect_error()) { die ('Failed to connect to MySQL'); } else { /*SUCCESS MSG*/ echo ''; } $sqlCommand = "SELECT order_option_id , name , DATE_FORMAT(value, '%e %M %Y') FROM oc_order_option INNER JOIN oc_order u USING (order_id) INNER JOIN oc_order v USING (customer_id) WHERE value BETWEEN CURDATE() AND CURDATE()+INTERVAL 14 DAY AND IFNULL(value, '1901-01-01') < CURDATE()-INTERVAL 14 DAY UNION SELECT order_option_id , name , DATE_FORMAT(value, '%e %M %Y') FROM oc_order_option INNER JOIN oc_order u USING (order_id) INNER JOIN oc_order v USING (customer_id) WHERE value BETWEEN CURDATE() AND CURDATE()+INTERVAL 7 DAY AND IFNULL(value, '1901-01-01') < CURDATE()-INTERVAL 7 DAY ORDER BY order_option_id, value"; $query = mysqli_query($db, $sqlCommand) or die (mysqli_error($db)); //fetch tha data from the database /*while ($row = mysqli_fetch_array($query)) { echo "<br><br>"; echo $row['id']; echo "<br><br>"; echo $row ['name']; echo "<br><br>"; echo date("d F Y",strtotime($row['datedue'])); echo "<br />"; }*/ $current_visitor=0; $email = ''; $headers = "From: noreply@taxelephants.uk\r\n"; $subject = "Expiry Date(s)"; $message = ''; $renewals = array(); $notifications = array(); //fetch the data from the database while ($row = mysqli_fetch_array($query)) { // has visitor_id changed if ($row['id'] != $current_visitor) { // send email to current visitor if ($current_visitor != 0) { $to = $email; $sendmail = mail($to, $subject, $message, $headers); if ($sendmail) { echo nl2br($message); echo "<b>Email Successfully Sent</b><br><br>"; // success, so add renewal ids to notifications $notifications = array_merge($notifications,$renewals); } else { echo "<b>Error in Sending of Email to $to</b><br><br>"; } } $current_visitor = $row['id']; $email = $row['email']; $message = "Name: {$row['name']} \n\n"; $renewals = array(); } $message .= "{$row['value']} expiry date: {$row['value']}\n"; } // send email to final visitor if ($current_visitor != 0) { $to = $email; $sendmail = mail($to, $subject, $message, $headers); if ($sendmail) { echo nl2br($message); echo "<b>Email Successfully Sent</b><br><br>"; // success, so add to notifications $notifications = array_merge($notifications,$renewals); } else { echo "<b>Error in Sending of Email to $to</b><br><br>"; } } // Free the results mysqli_free_result($query); //close the connection mysqli_close($db); ?> </body> </html> I have asked the question in the opencart forum ages ago but have not got any reply
-
I am bit unsure though on how to make it not store the data if payment is not made?
-
I am not having problems yet as not started yet but was just seeing if it is possible to do
-
Hi I just been asked by a client if is possible to have a form that the user fills out first then redirected to PayPal to pay the amount but if they don't pay, the form data gets wiped and their info not added to the database but if they do pay, the data gets added to the database Is that possible?
-
For now I just done it another way I created a new class specifically for the price that is different on Wednesdays to that of the other days I thought would be easier to do than try and go through all the coding to work out where to do all the changes to the coding etc. as they got it from someone else who is not prepared to help really
-
Hi Barand The prices are stored within the database but the current booking system does not multiple prices for a class, it's a flat rate so if the class is £10, it is £10 for all days but need it to be £10 for just the classes on wednesday and all other days the class is £7.50
-
Hi I have just had a request from a current customer who has a booking system in their website, it is for classes and people book online and pay via PayPal, what they want is if a class is on Wednesday and Thursday, they want the wednesday class to be £10.00 but the Thursday class to be £7.50 at the moment the class cost is set in the admin side of the booking system and does not allow multiple costs for classes on different days I am wondering if that can be done in PHP at all Been trying to have a go myself with the following <?php if ($serviceID == 5) || $date == THURSDAY { $fee = getServiceSettings($serviceID,'£7.50') } else { $fee = getServiceSettings($serviceID,'£10.00')} { ?> I know the first bit works by if it is serviceID of 5, it displays notes for the user to see when booking so thought could do something similar below is the link to the booking.php file http://pastebin.com/64tM5mBt below is the link to the booking.process.php file http://pastebin.com/2X87rezy
-
Sorry altered that line and works perfect now, can I just say thank you so much to everyone who commented and so sorry for being stupid at times, ok all the time haha I got the line now - $cv = mysqli_real_escape_string($mysqli, $_FILES['cvfile']['name']);
-
Ahh, is this right? $cv = mysqli_real_escape_string($_FILES['cvfile']['name']);