Jump to content
Larry Ullman's Book Forums

MrJames

Members
  • Content Count

    22
  • Joined

  • Last visited

Everything posted by MrJames

  1. I am looking to recreate the following function from PDO to MySQLi but having some problems, I've been over the PHP website to read the functions. I'm trying to modularize my code in like the MVC pattern. public function bind($param, $value, $type=''){ if(is_null($type)){ switch(true){ case is_int($value): //Thinking something like, for integer etc $type = mysqli_stmt::bind_param(i); $type = PDO::PARAM_INT; break; case is_bool($value): $type = PDO::PARAM_BOOL; break; default: $type = PDO::PARAM_STR; } } $this->stmt->bindvalue($param,$value,$type); } Is it as simple as just replacing PDO version line to : $type = mysqli_stmt::bind(i); or just putting $type = i; Then in my class I am trying to call the bind function: $database ->bind($stmt,$ype,$variables); $database->execute(); Any help would be much appreciated Regards My Setup Chrome Windows XP Wamp SublimeText
  2. My question was like: 1) Are these graphical elements created in Photoshop which is why they look so perfect ? 2) Are they also pictured through use of a MAC with retina displays rather than a PC ? regards
  3. Hi, I have been looking at profiles on Behance, some of which are what I would call 'pitches' (individuals putting their ideas/designs forward for how they would design/development popular websites), some of these designs are art/artistic, some are UI/UX. But one thing I have noticed is that all the images/pictures showcasing their work all look 'Clean, Crisp and really sharp'. Now when I develop a website on a PC it never looks as sharp as what some of these individuals are showcasing, So are they using MAC's with Retina displays which makes them look so nice, or is this web development done in Photoshop, below is an example of what I mean http://www.behance.net/gallery/E-mail-client/8626803 So what do you think ?
  4. So I am looking at developing a jobsboard, which has three tables: Company - Store details of companies looking to advertise jobs, build profile. Jobs - Store details of Jobs being advertised for a certain period of time. Orders - Store details of the transactions for the jobs being posted. The way it works is the company completes registration form, then has the option of posting jobs which they will be charged a fix fee. Now what foreign key would I store in the Orders table? since I am using Paypal and don't know how much information you can carry over. Would I store the CompanyID or the JobsID or both? PHP5 MySQL 5 Chrome
  5. @Marie I have changed the login script to one a one page login script file. That works fine at the moment. @Larry When you say remove the "includes" from the include line, do you mean this: <?php include ('loginForm.php'); ?> Because I tried that at that moment in time, but then brought up another few errors. Any comments, suggestions would be much appreciated.
  6. My Directory structure is set up exactly the same way as in the book: Index Includes - LoginForm.php (displays the form) - Login.inc.php (processes the form) - config.inc.php (setup for the website directory structure) - Header.php (display all relevant head information(titles, meta,) - Footer.php (holds all the Javascript files, also ends with the html,body) ================================================================== Top of my Index.php file <?php require ('./includes/config.inc.php'); require (MYSQL); if ($_SERVER['REQUEST_METHOD'] == 'POST') { include ('./includes/login.inc.php'); } include ('./includes/header.php'); ?> Now here is header.php file: <?php if (isset($_SESSION['user_id'])) { echo '<ul class="nav pull-right"> <li><a href="http://www.webzoost.com/postJob.php">post job</a></li> <li class="divider-vertical"></li> <li><a href="http://www.webzoost.com/resumeSearch.php">search</a></li> <li class="divider-vertical"></li> <li class="dropdown"> <a class="dropdown-toggle" href="#" data-toggle="dropdown">Your Profile <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;"> <ul class="unstyled"> <li><a href="http://www.webzoost.com/change_password.php">Change Password</a></li> <li class="divider"></li> <li><a href="http://www.webzoost.com/logout.php">Logout</a></li> </ul> </div> </li> </ul> </div> </div> </div> </section>'; } else { echo '<ul class="nav pull-right"> <li><a href="http://www.webzoost.com/register.php">register</a></li> <li class="divider-vertical"></li> <li><a href="http://www.webzoost.com/search.php">search</a></li> <li class="divider-vertical"></li> <li class="dropdown"> <a class="dropdown-toggle" href="#" data-toggle="dropdown">sign in <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; require ('includes/loginForm.php'); echo '</div> </li> </ul> </div> </div> </div> </section>'; } ?> Now here is loginForm.php file: <?php if (!isset($login_errors)) $login_errors = array(); require_once ('./includes/form_functions.inc.php'); ?> <form action="index.php" id="form-search" method="post" accept-charset="utf-8"> <?php if (array_key_exists('login', $login_errors)) { echo '<span class="alert alert-error">' . $login_errors['login'] . '</span><br />'; } ?> Email <?php create_form_input('email', 'text', 'input-large', $login_errors); ?> <br /> Password <?php create_form_input('password', 'password', 'input-large', $login_errors); ?> <input class="btn btn-primary btn-block" type="submit" id="sign-in" value="Sign In"> </form> <hr> <a href="http://www.webzoost.com/forgot_password.php" class="small">Forgotten Password</a> <br /><br /> and here is the process part login.inc.php file: <?php $login_errors = array(); if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $e = mysqli_real_escape_string ($dbc, $_POST['email']); } else { $login_errors['email'] = 'Enter a valid email address<br />'; } if (preg_match ('/^(\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*){1,32}$/',$_POST['password']) ) { $p = mysqli_real_escape_string($dbc,$_POST['password']); } else { $login_errors['password'] = 'You entered the wrong password<br />'; } if (empty($login_errors)) { // OK to proceed! $q = "SELECT id, profile_type, date_joined FROM Profiles WHERE (email='$e' AND password='" . get_password_hash($p) . "')"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // A match was made. $row = mysqli_fetch_array ($r, MYSQLI_NUM); $_SESSION['user_id'] = $row[0]; $_SESSION['username'] = $row[1]; // Store the data in a session: // Only indicate if the user's account is not expired: //if ($row[3] == 1) $_SESSION['user_not_expired'] = true; } else { // No match was made. $login_errors['login'] = 'Email address and password do not match those on file.'; } } // End of $login_errors IF. When a visitor visits the site, they either click on 'register.php' or 'forgot_password.php' but when they do all they get is the 'header.php' file being displayed with the rest of the page white. Any comments, suggestions would be much appreciated.
  7. I have changed the directory structure, to the one that is the same as in the E-Commerce book, the only difference is that my Login form is in the header rather than the footer. Now for some reason whenever a user tries to go to any other page, all they get is a blank page with just the header displaying. I did have require ('./includes/login_form.inc.php'); But that did not originally work so I changed it to include instead. How would the scripts change from example 1 in the E-Commerce book: My navigation is in the Header.html file rather than the Footer.html file, That is the only difference from the example in the book ? And all I am seeing on other pages is white space and the header file. Any comments, suggestions would be much appreciated.
  8. Hi, Having a bit of a problem with regard to someone logging in on my site. It will not display Register page if I include certain files. Here is my header.php file which stores all the navigation links, and the sign-in option or to display their profile options: <body> <section class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand text-info" href="http://www.webzoost.com" name="top">abaloo</a> <div class="nav-collapse collapse"> <ul class="nav pull-right"> <li><a href="http://www.webzoost.com/profiles/register.php">register</a></li> <li class="divider-vertical"></li> <li><a href="#">search</a></li> <li class="divider-vertical"></li> <li class="dropdown"> <?php if (isset($_SESSION['user_id'])) { echo '<a class="dropdown-toggle" href="#" data-toggle="dropdown">Your Profile <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; } else { echo '<a class="dropdown-toggle" href="#" data-toggle="dropdown">sign in <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; require ('includes/login_form.inc.php'); } ?> </div> </li> </ul> </div> </div> </div> </section> Now the problem comes when i add the following files: - login.inc.php since when i put this file in my index.php file I cannot seem to link to any other part of the website such as "register" which then throws up a blank page, but if I take out the file all-together then register displays. So what I am saying is where do I put file (login.inc.php) with-out it interfering with other links on my website, also could it be a directory issue, I know larry has his navigation in the footer, but mine is in the header.php file. here is my directory setup: index profiles - register.php includes - login.inc.php - login_form.inc.php - header.php // This is where all my navigation is, and also the login form as well. - footer.php I am now getting the following error when I only view the source code, this error is not being displayed for some reason on output to the user(I can't find an option to paste a screenshot/image of the code): An error occurred in script '/home/sites/webzoost.com/public_html/includes/header.php' on line 52:<br /> require(includes/login_form.inc.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory<br /> <pre>Array<br /> Any comments, suggestions would be much appreciated. PHP5 MySQL5 Chrome
  9. Hi, Try the following as an example: <input type="hidden" name="amount" value=" ' . $productPrice . ' "> Regards
  10. Hi, What I got is a log in screen, they enter their username and password then they are redirected to a screen that shows their twitter details/friends etc etc. So I have my SQL SELECT QUERY, I get back a number and I also want to select the users twitter name and put it into a Input box like below: * This is just an example* $num = mysqli_num_rows; $TwitterUsername = row[1]; Then I would echo out a range of input boxes as below: for(i=$num;i<$num;i++) { echo '<input type="hidden" value="' . $TwitterUsername . '">'; } Something along that line, then the JQuery would call Values from the Input boxes if that makes sense, is that possible, or would I be better using a while loop ? Appreciate any Feedback... Regards PHP 6 MySQL 5.2 HTML5 CSS3 Chrome / IE 8
  11. Hi, I have a couple of questions regarding PHP and JavaScript. 1) What I would like to know is once I do a SELECT COUNT Query I want to then do a For-Loop to out put the same number of input boxes but with a PHP variable as the value so that JavaScript could pick that value up, Is that possible to be done, I mean can JavaScript/JQuery read PHP variables. They will be Hidden Input boxes as well. PHP 6 MySQL 5.2 HTML5 CSS3 Chrome / IE 8
  12. Hi, I like the examples 'Antonio Conte' as provided since I am also a football fan as well and it's also good to show what projects you have done as well. I tried to create my own custom theme in Wordpress and it took me hours, I have it up and running at http://www.webzoost.com. Can I ask what are the differences between TextPattern and Wordpress Antonio ? (I am not looking at developing plugins but I am someone who likes to change the HTML/CSS to make it fit my requirements and then just install plugins that I need). Regards
  13. Hi. I was just wondering how facebook does it's continious updates on the wall if you know what I mean, I take it after a certain amount of time it calls a scripts which then gets the latest round of updates. So what technologies would be used here ? and also how would you stop it from repeating it's-self(i.e. calling the same data from before) ? Also does anyone know of any examples of this ? Regards
  14. Hi, As always I appreciate your input/views and opinions. I got in touch with my webhosting provider and they tell me its a shared hosting package and their is a certain URL you have to use. Now if I change my IPN script URL in paypal will that always try the old URL instead of the new one my hosting package gave me ? So I'll have to try and carry out another transaction with the new URL ? As always thanks for your help...
  15. Okay Larry, I hear what you are saying, but from past experiences the only time I have really had HTTP 500 internal server errors is when a query has not been done properly or theirs a problem with the php code(NOT the URLS) ? The only only thing I can think of is the HTTP | HTTPS problems.
  16. Hi, My Directories are not password protected though, could it be my SQL queries or the fact that the IPN script is in a sub-folder, and also what about http | https issues since in my config script i have the base url set as http first ? Would a session also work from a user entering job details then going through the paypal gateway and then being made available on the ipn script ? Look forward to your advice and help Kind Regards
  17. Hi, When I type in the URL on its own I get Internal Server Error / HTTP 500, so I am just wondering if it is something to do with the queries in the actual IPN script. The database didn't update nor did it insert the required information. I have my IPN script in a subfolder below the main domain, so would that make any difference ? Kind Regards
  18. Hi, I am trying to create a Recruitment based website that allows the user to post jobs for three different lengths, i.e. 14 days, 1 month etc. Now I have it all working up to the point where paypal tries to send/carry out the IPN script. It does not send the values back to the database nor does it send the user to the Success page. When I look at the IPN history it says error response 404, but have looked at all the file paths and permissions and they all seem fine. Here is my PostJobs.php page where the user enters the job information: <?php require ('../jobAdmin/config.inc.php'); include ('../includes/header.php'); require (MySQL); $reg_errors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { // ===================================== GET PACKAGE ID =========================================== if ((isset($_GET['packageID'])) && (is_numeric($_GET['package_ID']))) { $packageID = (int) $_GET['packageID']; } elseif ((isset($_POST['packageID'])) && (is_numeric($_POST['packageID']))) { $packageID = (int) $_POST['packageID']; } else { echo '<section class="wrapper"> <section class="page_wrap"> <article class="mainContent">'; echo '<div id="jobResults">'; echo '<h1 class="normal padding">No Package Found...</h1>'; echo '<p class="normal black textHeight padding"> Sorry you did not manage to select a package for your Job Advertisement, you cannot progress you Job Advertisement without choosing a package. </p><br />'; echo '<p class="normal black textHeight padding">Please go back and select again.</p></div> </article>'; echo '<aside class="sideBar padding"> <h5 class="normal padding blue capitals bottom">Job Post Features</h5> <ul id="jobPost"> <li> <img src="../images/email.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE EMAIL LISTINGS</h6> <p class="padding textHeight graw">Whatever Job Type you purchased your vacancy will be put into Emails that are sent out on a daily basis as long as your vacancy is still valid.</p> </li> <li> <img src="../images/feed.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE SOCIAL HUB LISTINGS</h6> <p class="padding textHeight graw">With every Job that is posted it is automatically added to our Social Networks which include <a href="http://www.flockjobs.com/feeds/jobFeed.rss" class="keyword">RSS</a>, <a href="http://www.twitter.com/flockJobs" class="keyword">Twitter</a> and <a href="http://www.facebook.com/flockJobs" class="keyword">Facebook</a> as long as your vacancy is still valid.</p> </li> <li> <img src="../images/lockblue.png" align="left" alt="" title="" /> <h6 class="normal blue">SAFE AND SECURE PAYMENT</h6> <p class="padding textHeight graw">All transactions are processed by PayPal who accept most major credit cards.</p> </li> <li> <img src="../images/clock.png" align="left" alt="" title="" /> <h6 class="normal blue">EASY AND EFFICIENT</h6> <p class="padding textHeight graw">All Job posts are posted live and instantly there is no registration and no contracts saving you time.</p> </li> </ul> </aside> </section> </section>'; include ('../includes/footer.php'); exit(); } // ====================================== END PACKAGE ID ========================================== // if (preg_match ('/^[A-Z \'.-]{2,100}$/i', $_POST['companyname'])) { $companyName = mysqli_real_escape_string ($dbc, strip_tags($_POST['companyname'])); } else { $reg_errors['companyname'] = 'Enter Your Company Name'; } $companyWebsite = mysqli_real_escape_string ($dbc, strip_tags($_POST['companywebsite'])); if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['companyemail'])) { $companyEmail = mysqli_real_escape_string ($dbc, strip_tags($_POST['companyemail'])); } else { $reg_errors['companyemail'] = 'Enter A Valid Company Email Address'; } if (filter_var($_POST['CountryCode'], FILTER_SANITIZE_STRING)) { $companyLocation = mysqli_real_escape_string ($dbc, $_POST['CountryCode']); } else { $reg_errors['CountryCode'] = 'Select Your Companies Location'; } if (isset($_FILES['new_image']['name'])) { if (($_FILES['new_image']['type'] == "image/jpg") || ($_FILES['new_image']['type'] == "image/jpeg") && ($_FILES['new_image']['size'] < MAX_FILE_SIZE)) { $imagename = $_FILES['new_image']['name']; $source = $_FILES['new_image']['tmp_name']; $target = "../pictures/".$imagename; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "../pictures/new_pictures/" . $imagepath; $file = "../pictures/" . $imagepath; list($width, $height) = getimagesize($file); $modwidth = 500; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight); $image = imagecreatefromjpeg($file); imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height); imagejpeg($tn, $save, 100); $save = "../pictures/new_pictures/sml_" . $imagepath; $file = "../pictures/" . $imagepath; list($width, $height) = getimagesize($file); $modwidth = 150; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight); $image = imagecreatefromjpeg($file); imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height); imagejpeg($tn, $save, 100); $newLogo = "/pictures/new_pictures/" . $_FILES['new_image']['name']; $smallLogo = "/pictures/new_pictures/sml_" . $_FILES['new_image']['name']; } $newLogo = '/pictures/new_pictures/no_image.jpg'; } if (preg_match ('/^[A-Z \'.-]{2,100}$/i', $_POST['jobtitle'])) { $jobTitle = mysqli_real_escape_string ($dbc, strip_tags($_POST['jobtitle'])); } else { $reg_errors['jobtitle']='Enter A Job Title'; } if (filter_var($_POST['SectorID'], FILTER_VALIDATE_INT, array('min_range' => 1))) { $jobSector = mysqli_real_escape_string ($dbc, strip_tags($_POST['SectorID'])); } else { $reg_errors['SectorID'] = 'Select Your Job Sector'; } if (filter_var($_POST['jobtype'], FILTER_SANITIZE_STRING)) { $jobType = mysqli_real_escape_string ($dbc, strip_tags($_POST['jobtype'])); } else { $reg_errors['jobtype'] = 'Select A Job Type'; } if (preg_match ('/^[A-Z \',.-]{2,100}$/i', $_POST['joblocation'])) { $jobLocation = mysqli_real_escape_string ($dbc, strip_tags($_POST['joblocation'])); } else { $reg_errors['joblocation']='Enter Location Of The Job'; } if (!empty($_POST['JobContent'])) { $allowed = '<div><p><span><br><a><img><h1><h2><h3><h4><ul><ol><li><blockquote><strong><em><del><ins>'; $jobDesc = mysqli_real_escape_string($dbc, strip_tags($_POST['JobContent'], $allowed)); } else { $reg_errors['JobContent'] = 'Please Enter A Job Description'; } if (!empty($_POST['JobApplyContent'])) { $allowed = '<div><p><span><br><a><img><h1><h2><h3><h4><ul><ol><li><blockquote><strong><em><del><ins>'; $jobApply = mysqli_real_escape_string($dbc, strip_tags($_POST['JobApplyContent'], $allowed)); } else { $reg_errors['JobApplyContent'] = 'Enter How To Apply For The Job'; } // ====================================== END OF JOBS INFORMATION ========================================== // if (empty($reg_errors)) { // if everythings okay $q = "SELECT JobServiceID,JobServiceDesc,JobLength,Price FROM JobProducts WHERE JobServiceID = '$packageID'"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) == 1) { $row = mysqli_fetch_array ($r, MYSQLI_NUM); $productID = $row[0]; $productDescription = $row[1]; $productLength = $row[2]; $productPrice = $row[3]; $CompanyIP = $_SERVER['REMOTE_ADDR']; $q = "INSERT INTO Company(CompanyName,CompanyWebsite,CompanyEmail,CountryCode,CompanyIP)VALUES('$companyName','$companyWebsite','$companyEmail','$companyLocation','$CompanyIP')"; $r = mysqli_query($dbc, $q); if(mysqli_affected_rows($dbc) == 1) { $companyID = mysqli_insert_id($dbc); $_SESSION['companyID'] = $companyID; $q = "INSERT INTO pictures(CompanyID,logoPath)VALUES({$_SESSION['companyID']},'$newLogo')"; $r = mysqli_query($dbc, $q); if(mysqli_affected_rows($dbc) == 1) { $a = md5(uniqid(rand(), true)); $q = "INSERT INTO JobAdvert(CompanyID,JobServiceID,JobCode,JobTitle,JobSector,JobType,JobLocation,JobDescription,JobApply,JobExpires)VALUES({$_SESSION['companyID']},'$productID','$a','$jobTitle','$jobSector','$jobType','$jobLocation','$jobDesc','$jobApply', SUBDATE(NOW(), INTERVAL 1 DAY) )"; $r = mysqli_query($dbc, $q); $JobAdvert = mysqli_insert_id($dbc); $_SESSION['JobAdvertID'] = $JobAdvert; if(mysqli_affected_rows($dbc) == 1) { $JobAdvertID = mysqli_insert_id($dbc); //$_SESSION['JobAdvertID'] = $JobAdvert; echo '<section class="wrapper"> <section class="page_wrap"> <article class="mainContent"> <h1 class="normal padding">Proceed With Payment...</h1> <span class="padding textHeight graw normal txt1">1. Complete Job Details </span><span class="padding textHeight bold blue capitals">2. Proceed With Payment </span><br /><br />'; echo '<p class="padding textHeight"> Congratulations on completing step 1, To complete the process please proceed by clicking the button below so that you may pay for your Job Post via PayPal.'; echo '</p><br />'; //echo "{$_SESSION['JobPrice']}"; echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="customersupport@flockjobs.com"/> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="email" value="' . $companyEmail . '"/> <input type="hidden" name="custom" value="' . $JobAdvertID . '"/> <input type="hidden" name="hosted_button_id" value="PF4VPS4ZM2384"> <input type="hidden" name="item_name" value="' . $productDescription . '"/> <input type="hidden" name="amount" value="' . $productPrice . '"/> <input type="hidden" name="tax" value="20.0"> <input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." class="padding"> <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form>'; echo ' </article> <aside class="sideBar padding"> <h5 class="normal padding blue capitals bottom">Job Post Features</h5> <ul id="jobPost"> <li> <img src="../images/email.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE EMAIL LISTINGS</h6> <p class="padding textHeight graw">Whatever Job Type you purchased your vacancy will be put into Emails that are sent out on a daily basis as long as your vacancy is still valid.</p> </li> <li> <img src="../images/feed.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE SOCIAL HUB LISTINGS</h6> <p class="padding textHeight graw">With every Job that is posted it is automatically added to our Social Networks which include <a href="http://www.flockjobs.com/feeds/jobFeed.rss" class="keyword">RSS</a>, <a href="http://www.twitter.com/flockJobs" class="keyword">Twitter</a> and <a href="http://www.facebook.com/flockJobs" class="keyword">Facebook</a> as long as your vacancy is still valid.</p> </li> <li> <img src="../images/lockblue.png" align="left" alt="" title="" /> <h6 class="normal blue">SAFE AND SECURE PAYMENT</h6> <p class="padding textHeight graw">All transactions are processed by PayPal who accept most major credit cards.</p> </li> <li> <img src="../images/clock.png" align="left" alt="" title="" /> <h6 class="normal blue">EASY AND EFFICIENT</h6> <p class="padding textHeight graw">All Job posts are posted live and instantly there is no registration and no contracts saving you time.</p> </li> </ul> </aside> </section> </section>'; // SEND AN EMAIL LETTING THEM KNOW // $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:long="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Flockjobs.com, Step 1, Post A Job</title> <style type="text/css"> body,td,th {font-family: arial,sans-serif;font-size: 12px;} body {background-color: #F0f0f0;margin-left: 0px;margin-top: 0px;} p {color:#444;padding:0 0 0 8px;line-height:1.5em;} h4 {font-size:25;font-weight:400;color:#000000;} a{text-decoration:none;} a:hover{text-decoration:underline;} </style> </head> <body><center><br />'; $message .="<table width=\"600\" border=\"0\" bgcolor=\"#FFFFFF\" cellpadding=\"25\"> <tr> <td align=\"left\" bgcolor=\"#FFFFFF\"> <br /><br /> <p><h4>Flockjobs.com Notification</h4></p><br /> <p> Congratulations on deciding to advertise your Job vacancy with <a href=\"http://www.flockjobs.com\">flockjobs.com</a> whether you are a Recruitment company or an employer we hope you find your ideal Candidate. </p> <br /> <p> This is a notification email to tell you that your Job Advertisement has nearly been completed all that is required for you to do is to continue with your online payment via PayPal. Once this has been completed you will then be able to Edit / Delete your Job Vacancy whenever you feel like it as long as your Job Advertisement is still Valid. </p> <br /> <p> We use free advertising methods in which other recruitment boards would charge for and help get your Job advertisement noticed by tapping into the social networking areas such as <a href=\"http://www.facebook.com/flockjobs\">Facebook</a>, <a href=\"http://www.twitter.com/flockjobs\">Twitter</a> and our own RSS feed <a href=\"http://www.flockjobs.com/jobFeeds/jobFeed.php\">flockjobs.com</a>. </p> <br /><br /> <p> Yours Sincerely<br /><br />flockjobs.com </p> </tr> </table> <br /></center></body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .='From: Flockjobs.com <customersupport@flockjobs.com>' . "\r\n" . 'Reply-To: Admin@webzoost.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($_POST['companyemail'],'Flockjobs, Step 1, Post A Job',$message,$headers); //mail ($_POST['companyemail'], 'Step 1, Complete Job Details', $body, 'From: CustomerSupport@flockjobs.com'); include('../includes/footer.php'); exit(); } else { echo 'Problem with job info with image'; } } else { $a = md5(uniqid(rand(), true)); $q = "INSERT INTO JobAdvert(CompanyID,JobServiceID,JobCode,JobTitle,JobSector,JobType,JobLocation,JobDescription,JobApply,JobExpires)VALUES({$_SESSION['companyID']},'$productID','$a','$jobTitle','$jobSector','$jobType','$jobLocation','$jobDesc','$jobApply', SUBDATE(NOW(), INTERVAL 1 DAY) )"; $r = mysqli_query($dbc, $q); if(mysqli_affected_rows($dbc) == 1) { $JobAdvertID = mysqli_insert_id($dbc); $_SESSION['JobAdvertID'] = $JobAdvert; echo '<section class="wrapper"> <section class="page_wrap"> <article class="mainContent"> <h1 class="normal padding">Proceed With Payment...</h1> <span class="padding textHeight graw normal txt1">1. Complete Job Details </span><span class="padding textHeight bold blue capitals">2. Proceed With Payment </span><br />'; echo '<p class="padding textHeight"> Congratulations on completing step 1, To complete the process please proceed by clicking the button below so that you may pay for your Job Post via PayPal.'; echo '</p> </article> <aside class="sideBar padding"> <h5 class="normal padding blue capitals bottom">Job Post Features</h5> <ul id="jobPost"> <li> <img src="../images/email.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE EMAIL LISTINGS</h6> <p class="padding textHeight graw">Whatever Job Type you purchased your vacancy will be put into Emails that are sent out on a daily basis as long as your vacancy is still valid.</p> </li> <li> <img src="../images/feed.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE SOCIAL HUB LISTINGS</h6> <p class="padding textHeight graw">With every Job that is posted it is automatically added to our Social Networks which include <a href="http://www.flockjobs.com/feeds/jobFeed.rss" class="keyword">RSS</a>, <a href="http://www.twitter.com/flockJobs" class="keyword">Twitter</a> and <a href="http://www.facebook.com/flockJobs" class="keyword">Facebook</a> as long as your vacancy is still valid.</p> </li> <li> <img src="../images/lockblue.png" align="left" alt="" title="" /> <h6 class="normal blue">SAFE AND SECURE PAYMENT</h6> <p class="padding textHeight graw">All transactions are processed by PayPal who accept most major credit cards.</p> </li> <li> <img src="../images/clock.png" align="left" alt="" title="" /> <h6 class="normal blue">EASY AND EFFICIENT</h6> <p class="padding textHeight graw">All Job posts are posted live and instantly there is no registration and no contracts saving you time.</p> </li> </ul> </aside> </section> </section>'; //echo "{$_SESSION['JobPrice']}"; // Process Payments echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="customersupport@flockjobs.com"/> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="email" value="' . $companyEmail . '"/> <input type="hidden" name="custom" value="' . $JobAdvertID . '"/> <input type="hidden" name="hosted_button_id" value="PF4VPS4ZM2384"> <input type="hidden" name="item_name" value="' . $productDescription . '"/> <input type="hidden" name="amount" value="' . $productPrice . '"/> <input type="hidden" name="tax" value="20.0"> <input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." class="padding"> <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form>'; //END Payments // SEND AN EMAIL ====================================================================// $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:long="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Flockjobs.com, Step 1, Post A Job</title> <style type="text/css"> body,td,th {font-family: arial,sans-serif;font-size: 12px;} body {background-color: #F0f0f0;margin-left: 0px;margin-top: 0px;} p {color:#444;padding:0 0 0 8px;line-height:1.5em;} h4 {font-size:25;font-weight:400;color:#000000;} a{text-decoration:none;} a:hover{text-decoration:underline;} </style> </head> <body><center><br />'; $message .="<table width=\"600\" border=\"0\" bgcolor=\"#FFFFFF\" cellpadding=\"25\"> <tr> <td align=\"left\" bgcolor=\"#FFFFFF\"> <br /><br /> <p><h4>Flockjobs.com Notification</h4></p><br /> <p> Congratulations on deciding to advertise your Job vacancy with <a href=\"http://www.flockjobs.com\">flockjobs.com</a> whether you are a Recruitment company or an employer we hope you find your ideal Candidate. </p> <br /> <p> This is a notification email to tell you that your Job Advertisement has nearly been completed all that is required for you to do is to continue with your online payment via PayPal. Once this has been completed you will then be able to Edit / Delete your Job Vacancy whenever you feel like it as long as your Job Advertisement is still Valid. </p> <br /> <p> We use free advertising methods in which other recruitment boards would charge for and help get your Job advertisement noticed by tapping into the social networking areas such as <a href=\"http://www.facebook.com/flockjobs\">Facebook</a>, <a href=\"http://www.twitter.com/flockjobs\">Twitter</a> and our own RSS feed <a href=\"http://www.flockjobs.com/jobFeeds/jobFeed.php\">flockjobs.com</a>. </p> <br /><br /> <p> Yours Sincerely<br /><br />flockjobs.com </p> </tr> </table> <br /></center></body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .='From: Flockjobs.com <customersupport@flockjobs.com>' . "\r\n" . 'Reply-To: Admin@webzoost.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($_POST['companyemail'],'Flockjobs, Step 1, Post A Job',$message,$headers); //mail ($_POST['companyemail'], 'Step 1, Complete Job Details', $body, 'From: CustomerSupport@flockjobs.com'); //End Email Send include('../includes/footer.php'); exit(); } else { trigger_error('Problem with job info without image'); } } } else { trigger_error('problem with company insert'); } } else { trigger_error('error'); } } // End Errors Condition } // End Main Conditional Operator ?> <section class="splash_wrap bottom"> <section class="page_wrap"> <article class="jobSlogan"> <h1 class="normal padding">Post a Job</h1> <p class="padding textHeight"> <span class="keyword">flockJobs.com</span> is an easy to use, automated <span class="keyword">Jobs Board</span> that allows <span class="keyword">Employers</span> and <span class="keyword">Recruitment Companies</span> to promote their Job vacancies with one of the fastest growing <span class="keyword">Job Boards</span> in the UK. We try to make the whole process of Job posting as easy and efficient as possible, NO registration, NO need to login and NO contracts. We give <span class="keyword">Employers</span> and <span class="keyword">Recruitment Companies</span> unrivalled response at a fraction of the cost, while providing extra features listed below at no extra cost. </p> </article> <div class="clear"></div> </section> </section><!-- END JOB SPLASH MESSAGE --> <section class="wrapper"> <section class="page_wrap"> <article class="mainContent"> <h1 class="normal padding">Post a Job...</h1> <span class="padding textHeight blue capitals bold">1. Complete Job Details </span><span class="padding textHeight txt1 graw">2. Proceed With Payment </span> <?php require ('../jobAdmin/functions.php'); ?> <form class="padding" id="jobPost" method="post" enctype="multipart/form-data" action="http://www.flockjobs.com/postJobs/jobPost.php" accept-charset="utf-8"> <fieldset> <legend><span>1. Select Job Package</span></legend> <ol> <li> <?php $q = "SELECT * FROM JobProducts"; $r = mysqli_query($dbc, $q); if($r) { echo '<table width="660px" border="0" cellpadding="2" cellspacing="2">'; while($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { echo '<tr> <td width="90px" align="right"><h4 class="normal blue">£' . $row['Price'] . '</h4><span class="graw normal txt1 capitals">' . $row['JobLength'] . '</span></td> <td width="15px"> </td> <td width="200px" align="left" valign="top"><p class="normal black textHeight padding txt3">' . $row['JobServiceDesc'] . '</p></td> <td width="5px"> </td> <td width="60px"><input id="name" name="packageID" type="radio" value="' . $row['JobServiceID'] . '" /></td> </tr> <tr><td colspan="5"> </td></tr>'; } echo '</table><br />'; //mysqli_free_result($r); } else { echo 'No Job Packages Available At This Moment In Time'; } //mysqli_close($dbc); ?> <tr><td colspan="5"><span class="txt1 padding graw">All prices are exclusive of V.A.T</span></td></tr> </table> </li> </ol> </fieldset> <fieldset> <legend><span>2. Company Details</span></legend> <ol> <li> <label for="name">Company Name:</label> <?php formElements('companyname', 'text', $reg_errors); ?> </li> <li> <label for="email">Company Website:</label> <?php formElements('companywebsite', 'text', $reg_errors); ?> <span class="small">(Website Optional)</span> </li> <li> <label for="email">Company Email:</label> <?php formElements('companyemail', 'text', $reg_errors); ?> </li> <li> <label for="email">Company Country:</label> <select name="CountryCode"<?php if (array_key_exists('CountryCode', $reg_errors)) echo ' class="error"'; ?>> <option>Select Country</option> <?php $q = "SELECT CountryCode, CountryName FROM Countries ORDER BY CountryName ASC"; $r = mysqli_query($dbc, $q); while ($row = mysqli_fetch_array ($r, MYSQLI_NUM)) { echo "<option value=\"$row[0]\""; if (isset($_POST['CountryCode']) && ($_POST['CountryCode'] == $row[0])) echo ' selected="selected"'; echo ">$row[1]</option>\n"; } ?> </select> <?php if (array_key_exists('CountryCode', $reg_errors)) echo ' <span class="errorMSG">' . $reg_errors['CountryCode'] . '</span>'; ?> </li> <li> <label for="email">Company Logo:</label> <input id="new_image" name="new_image" class="text" type="file" /> <input name="MAX_FILE_SIZE" type="hidden" value="2000000" /> <span class="small">(Logo Optional, JPG's Only)</span> </li> </ol> </fieldset> <fieldset> <legend><span>3. Job Advertisement</span></legend> <ol> <li> <label for="name">Job Title:</label> <?php formElements('jobtitle', 'text', $reg_errors); ?> <span class="small">..."Administrator", "Marketing Manager", "Web Developer"</span> </li> <li> <label for="email">Job Sector:</label> <select name="SectorID" <?php if (array_key_exists('SectorID', $reg_errors)) echo ' class="error"'; ?>> <option>Select Sector</option> <?php $q = "SELECT SectorID, SectorName FROM Sectors ORDER BY SectorName ASC"; $r = mysqli_query($dbc, $q); while ($row = mysqli_fetch_array ($r, MYSQLI_NUM)) { echo "<option value=\"$row[0]\""; if (isset($_POST['SectorID']) && ($_POST['SectorID'] == $row[0])) echo ' selected="selected"'; echo ">$row[1]</option>\n"; } ?> </select> <?php if (array_key_exists('SectorID', $reg_errors)) echo ' <span class="errorMSG">' . $reg_errors['SectorID'] . '</span>'; ?> </li> <li> <label for="email">Job Type:</label> <select name="jobtype" class="subject"> <option value="Please Select">Please Select</option><option value="Full Time">Full Time</option><option value="Part Time">Part Time</option><option value="Temporary">Temporary</option><option value="Contract">Contract</option> </select> </li> <li> <label for="email">Job Location:</label> <?php formElements('joblocation', 'text', $reg_errors); ?> <span class="small">..."Paris, France", "London, United Kingdom"</span> </li> <li> <label for="email">Job Description:</label> <?php formElements('JobContent', 'textarea', $reg_errors); ?> <span class="small smalllabel">..."Responsibilities, Duties, Qualifications, Benefits, No Tags"</span> </li> <li> <label for="email">How To Apply:</label> <?php formElements('JobApplyContent', 'textarea', $reg_errors); ?> <span class="small smalllabel">..."Email Address, Telephone, Address"</span> </li> </ol> </fieldset> <fieldset class="submit"> <input class="button" type="submit" value="POST JOB" /> </fieldset> </form> </article> <aside class="sideBar padding"> <h5 class="normal padding blue capitals bottom">Job Post Features</h5> <ul id="jobPost"> <li> <img src="../images/email.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE EMAIL LISTINGS</h6> <p class="padding textHeight graw">Whatever Job Type you purchased your vacancy will be put into Emails that are sent out on a daily basis as long as your vacancy is still valid.</p> </li> <li> <img src="../images/feed.png" align="left" alt="" title="" /> <h6 class="normal blue">FREE SOCIAL HUB LISTINGS</h6> <p class="padding textHeight graw">With every Job that is posted it is automatically added to our Social Networks which include <a href="http://www.flockjobs.com/feeds/jobFeed.rss" class="keyword">RSS</a>, <a href="http://www.twitter.com/flockJobs" class="keyword">Twitter</a> and <a href="http://www.facebook.com/flockJobs" class="keyword">Facebook</a> as long as your vacancy is still valid.</p> </li> <li> <img src="../images/lockblue.png" align="left" alt="" title="" /> <h6 class="normal blue">SAFE AND SECURE PAYMENT</h6> <p class="padding textHeight graw">All transactions are processed by PayPal who accept most major credit cards.</p> </li> <li> <img src="../images/clock.png" align="left" alt="" title="" /> <h6 class="normal blue">EASY AND EFFICIENT</h6> <p class="padding textHeight graw">All Job posts are posted live and instantly there is no registration and no contracts saving you time.</p> </li> </ul> </aside> </section> </section> <?php include ('../includes/footer.php'); ?> Then I have my IPN Script as below: <?php require ('http://www.flockjobs.com/jobAdmin/config.inc.php'); $file = fopen('http://www.flockjobs.com/postJobs/ipn.txt', 'a'); fwrite ($file, "Received:\n"); fwrite ($file, print_r($_POST, true)); fwrite ($file, "\n"); $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } //$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { trigger_error{'Could Not Connect For The IPN'); } else { $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"; fputs ($fp, $header . $req); // Write the paypal request to the text file: fwrite ($file, "Sent:\n"); fwrite ($file, "$header\n"); fwrite ($file, "$req\n"); //Read In The Response: while (!feof($fp)) { $res = fgets ($fp, 1024); // Write the paypal response to the text file: fwrite ($file, "Received:\n"); fwrite ($file, "$res\n"); if (strcmp ($res, "VERIFIED") == 0) { //if(strcmp ($res, "VERIFIED") == 0 || 1 == 1) //Check For The Right Values if (isset($_POST['payment_status']) && ($_POST['payment_status'] == 'Completed') && ($_POST['receiver_email'] == 'customersupport@flockjobs.com') && ($_POST['mc_currency'] == 'GBP') && (!empty($_POST['mc_gross'])) && (!empty($_POST['txn_id'])) ) { require (MySQL); $txn_id = mysqli_real_escape_string($dbc, $_POST['txn_id']); $q = "SELECT OrderID FROM Orders WHERE Transaction_id='$tx_id'"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) == 0) { $companyEmail = mysqli_real_escape_string ($dbc, $_POST['email']); $jobAdvertID = (isset($_POST['custom'])) ? (int) $_POST['custom'] : 0; $status = mysqli_real_escape_string ($dbc, $_POST['payment_status']); $amount = (float) $_POST['mc_gross']; $q = "SELECT JobProducts.JobServiceID,JobAdvert.JobCode,Company.CompanyEmail FROM JobProducts,JobAdvert WHERE JobProducts.JobServiceID=JobAdvert.JobServiceID AND JobAdvert.JobAdvertID = '$JobAdvertID' AND Company.CompanyID=JobAdvert.JobAdvertID"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) == 1) { $row = mysqli_fetch_array ($r, MYSQLI_NUM); $productID = $row[0]; $jCode = $row[1]; $cEmail = $row[2]; if ($productID == 1) { $q = "INSERT INTO Orders(JobAdvertID,TransactionID,Payment_Status,Payment_Amount,Payment_Date_Time)VALUES($JobAdvertID,'$txn_id','$status','$amount',NOW())"; $r = mysqli_query($dbc, $q); if (mysqli_affected_rows($dbc) == 1) { $q = "UPDATE JobAdvert SET JobExpires = IF(JobExpires > NOW(), ADDDATE(JobExpires, INTERVAL 1 MONTH), ADDDATE(NOW(), INTERVAL 1 MONTH)) WHERE JobAdvert.JobAdvertID='$JobAdvertID'"; $r = mysqli_real_escape_string($dbc, $q); //===================================================================== $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:long="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Flockjobs.com, Step 1, Post A Job</title> <style type="text/css"> body,td,th {font-family: arial,sans-serif;font-size: 12px;} body {background-color: #F0f0f0;margin-left: 0px;margin-top: 0px;} p {color:#444;padding:0 0 0 8px;line-height:1.5em;} h4 {font-size:25;font-weight:400;color:#000000;} a{text-decoration:none;} a:hover{text-decoration:underline;} </style> </head> <body><center><br />'; $message .="<table width=\"600\" border=\"0\" bgcolor=\"#FFFFFF\" cellpadding=\"25\"> <tr> <td align=\"left\" bgcolor=\"#FFFFFF\"><br /><br /> <p> <h4>Flockjobs.com Job Advertisement</h4> </p><br /> <p> Your Job Advertisement has been completed, below you will find your links to Edit or Delete your Job post (as long as it is still valid). </p><br /> <p> <h4>Edit Your Job Advertisement</h4> </p><br /> <p> <a href=\"" . BASE_URL .'jobAccount/editJob.php?x=' . urlencode($jCode) . "&y=$cEmail\" />Edit Your Job Advertisement</a><br /><br /> If the above Edit Link does not work please copy and paste the code below into your browser address bar to activate your account:<br /><br />"; $message .= BASE_URL.'jobAccount/editJob.php?x='.urlencode($jCode)."&y=$cEmail </p><br /> <p> <h4>Delete Your Job Advertisement</h4> </p><br /> <p> <a href=\"" . BASE_URL .'jobAccount/deleteJob.php?x=' . urlencode($jCode) . "&y=$cEmail\" />Edit Your Job Advertisement</a><br /><br /> If the above Delete Link does not work please copy and paste the code below into your browser address bar to activate your account:<br /><br />"; $message .= BASE_URL.'jobAccount/deleteJob.php?x='.urlencode($jCode)."&y=$cEmail </p><br /> <p> DO NOT DELET THIS EMAIL OTHERWISE YOU WILL NOT BE ABLE TO GAIN ACCESS TO YOUR JOB ADVERTISEMENT! TO EDIT OR DELETE IT. </p><br /> <p> PLEASE NOTE: Once your Job Advertisement has been deleted it cannot be returned, if you want to re-post then you will have to re-advertise the same vacancy and then purchase another package. </p><br /> <p> Yours Sincerely<br /><br />flockjobs.com </p> </tr> </table><br /></center></body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .='From: Flockjobs.com <customersupport@flockjobs.com>' . "\r\n" . 'Reply-To: Admin@webzoost.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($companyEmail,'Flockjobs, Step 1, Post A Job',$message,$headers); //===================================================================== if (mysqli_affected_rows($dbc, $q) != 1) { trigger_error('The User\'s expiration date could not be updated'); } } else { trigger_error('Problem Inserting Order'); } } elseif ($productID == 2) { $q = "INSERT INTO Orders(JobAdvertID,TransactionID,Payment_Status,Payment_Amount,Payment_Date_Time)VALUES($JobAdvertID,'$txn_id','$status','$amount',NOW())"; $r = mysqli_query($dbc, $q); if (mysqli_affected_rows($dbc) == 1) { $q = "UPDATE JobAdvert SET JobExpires = IF(JobExpires > NOW(), ADDDATE(JobExpires, INTERVAL 14 DAY), ADDDATE(NOW(), INTERVAL 14 DAY)) WHERE JobAdvert.JobAdvertID='$JobAdvertID'"; $r = mysqli_real_escape_string($dbc, $q); //===================================================================== $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:long="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Flockjobs.com, Step 1, Post A Job</title> <style type="text/css"> body,td,th {font-family: arial,sans-serif;font-size: 12px;} body {background-color: #F0f0f0;margin-left: 0px;margin-top: 0px;} p {color:#444;padding:0 0 0 8px;line-height:1.5em;} h4 {font-size:25;font-weight:400;color:#000000;} a{text-decoration:none;} a:hover{text-decoration:underline;} </style> </head> <body><center><br />'; $message .="<table width=\"600\" border=\"0\" bgcolor=\"#FFFFFF\" cellpadding=\"25\"> <tr> <td align=\"left\" bgcolor=\"#FFFFFF\"><br /><br /> <p> <h4>Flockjobs.com Job Advertisement</h4> </p><br /> <p> Your Job Advertisement has been completed, below you will find your links to Edit or Delete your Job post (as long as it is still valid). </p><br /> <p> <h4>Edit Your Job Advertisement</h4> </p><br /> <p> <a href=\"" . BASE_URL .'jobAccount/editJob.php?x=' . urlencode($jCode) . "&y=$cEmail\" />Edit Your Job Advertisement</a><br /><br /> If the above Edit Link does not work please copy and paste the code below into your browser address bar to activate your account:<br /><br />"; $message .= BASE_URL.'jobAccount/editJob.php?x='.urlencode($jCode)."&y=$cEmail </p><br /> <p> <h4>Delete Your Job Advertisement</h4> </p><br /> <p> <a href=\"" . BASE_URL .'jobAccount/deleteJob.php?x=' . urlencode($jCode) . "&y=$cEmail\" />Edit Your Job Advertisement</a><br /><br /> If the above Delete Link does not work please copy and paste the code below into your browser address bar to activate your account:<br /><br />"; $message .= BASE_URL.'jobAccount/deleteJob.php?x='.urlencode($jCode)."&y=$cEmail </p><br /> <p> DO NOT DELET THIS EMAIL OTHERWISE YOU WILL NOT BE ABLE TO GAIN ACCESS TO YOUR JOB ADVERTISEMENT! TO EDIT OR DELETE IT. </p><br /> <p> PLEASE NOTE: Once your Job Advertisement has been deleted it cannot be returned, if you want to re-post then you will have to re-advertise the same vacancy and then purchase another package. </p><br /> <p> Yours Sincerely<br /><br />flockjobs.com </p> </tr> </table><br /></center></body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .='From: Flockjobs.com <customersupport@flockjobs.com>' . "\r\n" . 'Reply-To: Admin@webzoost.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($companyEmail,'Flockjobs, Step 1, Post A Job',$message,$headers); //===================================================================== if (mysqli_affected_rows($dbc, $q) != 1) { trigger_error('The User\'s expiration date could not be updated'); } } else { trigger_error('Problem Inserting Order'); } } else { $q = "INSERT INTO Orders(JobAdvertID,TransactionID,Payment_Status,Payment_Amount,Payment_Date_Time)VALUES($JobAdvertID,'$txn_id','$status','$amount',NOW())"; $r = mysqli_query($dbc, $q); if (mysqli_affected_rows($dbc) == 1) { $q = "UPDATE JobAdvert SET JobExpires = IF(JobExpires > NOW(), ADDDATE(JobExpires, INTERVAL 7 DAY), ADDDATE(NOW(), INTERVAL 7 DAY)) WHERE JobAdvert.JobAdvertID='$JobAdvertID'"; $r = mysqli_real_escape_string($dbc, $q); //===================================================================== $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:long="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Flockjobs.com, Step 1, Post A Job</title> <style type="text/css"> body,td,th {font-family: arial,sans-serif;font-size: 12px;} body {background-color: #F0f0f0;margin-left: 0px;margin-top: 0px;} p {color:#444;padding:0 0 0 8px;line-height:1.5em;} h4 {font-size:25;font-weight:400;color:#000000;} a{text-decoration:none;} a:hover{text-decoration:underline;} </style> </head> <body><center><br />'; $message .="<table width=\"600\" border=\"0\" bgcolor=\"#FFFFFF\" cellpadding=\"25\"> <tr> <td align=\"left\" bgcolor=\"#FFFFFF\"><br /><br /> <p> <h4>Flockjobs.com Job Advertisement</h4> </p><br /> <p> Your Job Advertisement has been completed, below you will find your links to Edit or Delete your Job post (as long as it is still valid). </p><br /> <p> <h4>Edit Your Job Advertisement</h4> </p><br /> <p> <a href=\"" . BASE_URL .'jobAccount/editJob.php?x=' . urlencode($jCode) . "&y=$cEmail\" />Edit Your Job Advertisement</a><br /><br /> If the above Edit Link does not work please copy and paste the code below into your browser address bar to activate your account:<br /><br />"; $message .= BASE_URL.'jobAccount/editJob.php?x='.urlencode($jCode)."&y=$cEmail </p><br /> <p> <h4>Delete Your Job Advertisement</h4> </p><br /> <p> <a href=\"" . BASE_URL .'jobAccount/deleteJob.php?x=' . urlencode($jCode) . "&y=$cEmail\" />Edit Your Job Advertisement</a><br /><br /> If the above Delete Link does not work please copy and paste the code below into your browser address bar to activate your account:<br /><br />"; $message .= BASE_URL.'jobAccount/deleteJob.php?x='.urlencode($jCode)."&y=$cEmail </p><br /> <p> DO NOT DELET THIS EMAIL OTHERWISE YOU WILL NOT BE ABLE TO GAIN ACCESS TO YOUR JOB ADVERTISEMENT! TO EDIT OR DELETE IT. </p><br /> <p> PLEASE NOTE: Once your Job Advertisement has been deleted it cannot be returned, if you want to re-post then you will have to re-advertise the same vacancy and then purchase another package. </p><br /> <p> Yours Sincerely<br /><br />flockjobs.com </p> </tr> </table><br /></center></body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .='From: Flockjobs.com <customersupport@flockjobs.com>' . "\r\n" . 'Reply-To: Admin@webzoost.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($companyEmail,'Flockjobs, Step 1, Post A Job',$message,$headers); //===================================================================== if (mysqli_affected_rows($dbc, $q) != 1) { trigger_error('The User\'s expiration date could not be updated'); } } else { trigger_error('Problem Inserting Order'); } } } } // Order Has Already Been Stored } // Right Values Don't Exist } elseif (strcmp ($res, "INVALID") == 0) { //Log For Manual Investigation } } // End of While Loop //Close The Connection fclose ($fp); } // End fp Connection fwrite ($file, "-------------------------------------------------\n"); fclose ($file); ?> And here is the paypal description of the problem: Message ID0FB64761XU9543332 Date/time created07/07/2011 11:04 BST Original/ResentOriginal Latest delivery attempt date/time07/07/2011 11:25 BST Notification HTTP response code 404 Delivery statusRetrying No. of retries8 Transaction ID1PN79280FG9078117 IPN typeTransaction made Hope it helps, I am just wondering if the SQL queries in the IPN script are working properly, any help would be much appreciated
  19. Hi, I have changed my files to a lower case file standard. Also my script should re-direct to $url = 'http://<hidden>/members/myDashboard.php'; ob_end_clean(); header("Location: $url"); exit; if it is successful but doesn't even if it the username and password were right. Also in my index file I have at the top: include('../functions/config.inc.php'); include('../includes/header.php'); Would I need an ob_start() in the top of the header file ? Just to let you know I re-did the scripts today and they seem to function properly as far as I know, my site is no where near complete yet. Thanks for all your help. Kind Regards
  20. Hi Terry, I am using 5.2, I did change the file name and took out BASE_URL and just used the full url instead. I am still getting problems though. Like I can log in with the right username and password but then if someone enters a wrong username and password the screen just outputs the header information. <?php require ('../functions/config.inc.php'); include ('../includes/header.php'); require(MySQL); $log_errors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (preg_match ('/^[A-Z0-9]{2,30}$/i', $_POST['userName'])) { $u = mysqli_real_escape_string($dbc, $_POST['userName']); } else { $log_errors['userName'] = 'Please enter a Username'; } if (!empty($_POST['userPassword'])) { $p = mysqli_real_escape_string($dbc, $_POST['userPassword']); } else { $log_errors['userPassword'] = 'Please Enter Password'; } if(empty($log_errors)) { $q = "SELECT userID,eMail,userName, DATE_FORMAT(dateAccountCreated, '%e %b %Y - %T %p') AS userJoined FROM tbl_Users WHERE (userName='$u' AND userPassword='" . get_password_hash($p) . "') AND userActivate IS NULL"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) == 1) { // A match was made. // Get the data: $row = mysqli_fetch_array ($r, MYSQLI_NUM); //Store the data in a session: $_SESSION['userID'] = $row[0]; $_SESSION['eMail'] = $row[1]; $_SESSION['userName'] = $row[2]; $_SESSION['userJoined'] = $row[3]; $_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']); $token = md5(uniqid(rand(), true)); $_SESSION['token'] = $token; $url = 'http://<hidden>/members/myDashboard.php'; ob_end_clean(); header("Location: $url"); exit; } else { // No match was made. I did originally have error messages here. But they didn't display anything $url = 'http://<hidden>/index.php'; ob_end_clean(); header("Location: $url"); exit; } } } //END SERVER REQUEST ?>
  21. Hi, I am trying to do a re-direct based on the user's Email and Password, but for some reason I keep getting 404 errors, I have included a copy of the code below, I did try echo-ing out the variables but still got the error 404 problem. The login form is on the index page and then when the user processes the form it goes to a script called login. If the Email and password are found then the user should be re-directed to their page called 'home.php'. <?php require_once ('../functions/config.inc.php'); include ('../includes/header.html'); if($_SERVER['REQUEST_METHOD'] == 'POST') { $login_errors = array(); require(MySQL); if(filter_var($_POST['userEmail'], FILTER_VALIDATE_EMAIL)) { $e = mysqli_real_escape_string ($dbc, $_POST['userEmail']); } else { $login_errors['userEmail'] = 'Please enter a valid Email address'; } if(!empty($_POST['userPassword']) ) { $p = mysqli_real_escape_string ($dbc, $_POST['userPassword']); } else { $login_errors['userPassword'] = 'Please enter a password'; } if(empty($login_errors)) { $q = "SELECT userID,userName FROM tbl_Users WHERE (eMail='$e' AND userPassword='" . get_password_hash($p) . "' AND userActivate IS NULL)"; $r = mysqli_query($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); if(mysqli_num_rows($r) == 1) { $row = mysqli_fetch_array($r, MYSQLI_NUM); $_SESSION['userID'] = $row[0]; $_SESSION['eMail'] = $row[1]; //$_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']); //$token = md5(uniqid(rand(), true)); //$_SESSION['token'] = $token; $url = BASE_URL . 'Members/home.php'; //ob_end_clean(); header("Location: $url"); exit(); } else { $login_errors['login'] = 'The email address and password do not match those on file.'; } } } include ('../includes/footer.html'); ?> Regards PHP 5, MYSQL 5, CSS, HTML5
  22. Hi, I just have a couple of questions regarding the MVC patterns in example 2. I understand the view files and that they are plain HTML what the end user sees basically, but what files are considered the Models and Controllers. Also moving away from the example 2 method if I was to use OOP methods what would make up the Models and controllers, for example would models be the classes and controllers be the methods used to pass the database information from model to view. Then also would it affect performance since files would need to be loaded from different parts ? I am fairly new to the MVC methods within PHP. Kind Regards PHP 5 MySQL 5 Windows XP IE 8/ Firefox
×
×
  • Create New...