Jump to content

coalduststar

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by coalduststar

  1. bump * database isn't recording anything and it appears the variable aren't being passed in :/
  2. Hi guys I figured out the error- it was because I hadn't used quotes so it wasn't pulling in the email- i rectified that. Got this now- and it's going to yeo.php but not updating the database at all- i've also attached the form under the code- stumped <?php require_once('../Connections/IMAK.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "kill")) { //explode killer $target = $_POST['players']; $weapon = $_POST['weapon']; $killer = $_POST['killer']; $piece = explode(" ", $killer); $piece[0] = $email; $piece[1] = $year; //score = year+weapon+tweet*evidence $youtube = "youtube"; if (stristr($_POST['evidence'], $youtube) == TRUE){ $kill_score = ($year + $weapon + $tweet)*2; }else{ $kill_score = ($year + $weapon + $tweet); } mysql_select_db($database_IMAK, $IMAK); $query_players2 = "SELECT current_target FROM IMAK_player WHERE email = '$target'"; $players2 = mysql_query($query_players2, $IMAK) or die(mysql_error()); $row_players2 = mysql_fetch_assoc($players2); $totalRows_players2 = mysql_num_rows($players2); $row_players2['current_target'] = $current_target; $updateSQL = sprintf("UPDATE IMAK_player SET killer=%s, evidence=%s, weapon=%s, tweet=%s, current_target=%s, kill_score=%s WHERE email=%s", GetSQLValueString($email, "text"), GetSQLValueString($_POST['evidence'], "text"), GetSQLValueString($weapon, "text"), GetSQLValueString(isset($_POST['tweet']) ? "true" : "", "defined","1","0"), GetSQLValueString($current_target, "text"), GetSQLValueString($kill_score, "text"), GetSQLValueString($target, "text")); mysql_select_db($database_IMAK, $IMAK); $Result1 = mysql_query($updateSQL, $IMAK) or die(mysql_error()); $updateGoTo = "yeo.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } //populate player list mysql_select_db($database_IMAK, $IMAK); $query_players = "SELECT * FROM IMAK_player WHERE active = 1"; $players = mysql_query($query_players, $IMAK) or die(mysql_error()); $row_players = mysql_fetch_assoc($players); $totalRows_players = mysql_num_rows($players); ?> here's the form <form action="<?php echo $editFormAction; ?>" method="POST" name="kill"> <li> <select name="players" title="select player"> <?php do { ?> <option value="<?php echo $row_players['email']?> <?php echo $row_players['year']; ?>"><?php echo $row_players['name']?> <?php echo $row_players['surname']?> (<?php echo $row_players['year']; ?>)</option> <?php } while ($row_players = mysql_fetch_assoc($players)); $rows = mysql_num_rows($players); if($rows > 0) { mysql_data_seek($players, 0); $row_players = mysql_fetch_assoc($players); } ?> </select> <img src="../images/murdah.png" alt="has assassinated" width="100" height="49" border="0" align="middle" /> <select name="killer" title="select killer"> <?php do { ?> <option value="<?php echo $row_players['email']?>"><?php echo $row_players['name']?> <?php echo $row_players['surname']?> (<?php echo $row_players['year']; ?>)</option> <?php } while ($row_players = mysql_fetch_assoc($players)); $rows = mysql_num_rows($players); if($rows > 0) { mysql_data_seek($players, 0); $row_players = mysql_fetch_assoc($players); } ?> </select></li> <li> <input name="evidence" type="text" size="30" /></li> <li> <img src="../images/weapons/gun.png" alt="gun" width="70" height="47" align="middle" /> <input name="weapon" type="radio" value="1" checked/> <img src="../images/weapons/dagger.png" alt="dagger" width="50" height="47" align="middle" /> <input name="weapon" type="radio" value="2" /> <img src="../images/weapons/poison.png" alt="poison" width="50" height="47" align="middle" /> <input name="weapon" type="radio" value="3" /> <img src="../images/weapons/garotte.png" alt="garotte" width="50" height="47" align="middle" /> <input name="weapon" type="radio" value="4" /> </li> <li> <img src="../images/twitter.png" alt="twitter" width="50" height="50" align="middle" /> <input name="tweet" type="checkbox" value="1" /> </li> <li><input name="submit" type="submit" value="KILL" /> </li> <input type="hidden" name="MM_update" value="kill" /> <input type="hidden" name="<?php echo $row_players['year']; ?>" value="kill" /> </form>
  3. could that SQL error be a symptom of the database not accepting an email as a primary key? @kworld
  4. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@email.ulster.ac.uk 3' at line 1 i wasn't getting anything- it was just dying and now i have this one above which isn't really pointing at anything
  5. //score = year+weapon+tweet*evidence $youtube = "youtube"; if (stristr($_POST['evidence'], $youtube) === TRUE){ $kill_score = ($year + $weapon + $tweet)*2; }else{ $kill_score = ($year + $weapon + $tweet); } is this more correct or should i still use ==?
  6. yeah the email variable has to be made from another variable as all the info is in a drop down list of players email and what year they're in. the problem is that because it's a drop down list all the calculations have to happen after the submit button is clicked? at least i think so. as for the database- how might that be set up incorrectly? I have email as the primary key etc. i have a strpos but i'm gonna have to use a stristr so thanks for flagging that
  7. in the middle of troubleshooting it now- just wanted to make sure there weren't any glaring disasters. there's no error so my guess is it's dying when it's trying to get the current_target out
  8. I started using dreamweaver to do part of this and now i've made and epic hash up it's for a game of killer- to log a kill you select a player and his killer from the database which is one table with the unique email as a primary key when someone is killed the score has to be calculated and then the dead person's target (also email) has to be reassigned to the killer (hence the select query in the middle of the update) it's not making it through and i was wondering if someone could help me http://www.arts.ulster.ac.uk/IMAK/admin <?php require_once('../Connections/IMAK.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "kill") && ($email != $target)) { //explode killer $target = $_POST['players']; $weapon = $_POST['weapon']; $killer = $_POST['killer']; $piece = explode(" ", $killer); $piece[0] = $email; $piece[1] = $year; //score = year+weapon+tweet*evidence $youtube = "youtube"; $proof = strpos($_POST['evidence'], $youtube); if($proof === true){ $kill_score = ($year + $weapon + $tweet)*2; }else{ $kill_score = ($year + $weapon + $tweet); } mysql_select_db($database_IMAK, $IMAK); $query_players2 = "SELECT current_target FROM IMAK_player WHERE email = $target"; $players2 = mysql_query($query_players2, $IMAK) or die(mysql_error()); $row_players2 = mysql_fetch_assoc($players2); $totalRows_players2 = mysql_num_rows($players2); $updateSQL = sprintf("UPDATE IMAK_player SET killer=%s, evidence=%s, weapon=%s, tweet=%s, current_target=%s, kill_score=%s WHERE email=%s", GetSQLValueString($email, "text"), GetSQLValueString($_POST['evidence'], "text"), GetSQLValueString($weapon, "text"), GetSQLValueString(isset($_POST['tweet']) ? "true" : "", "defined","1","0"), GetSQLValueString($row_players2['current_target'], "text"), GetSQLValueString($kill_score, "text"), GetSQLValueString($target, "text")); mysql_select_db($database_IMAK, $IMAK); $Result1 = mysql_query($updateSQL, $IMAK) or die(mysql_error()); $updateGoTo = "yeo.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } //populate player list mysql_select_db($database_IMAK, $IMAK); $query_players = "SELECT * FROM IMAK_player WHERE active = 1"; $players = mysql_query($query_players, $IMAK) or die(mysql_error()); $row_players = mysql_fetch_assoc($players); $totalRows_players = mysql_num_rows($players); ?>
  9. Hi - the address was passing in but the textarea was padded in and it wasn't appearing in my query browser window :/ You've all been pretty much fantastic help- thanks!!
  10. that didn't solve it- the spelling is consistent so it can't be that- i'll have another wee look at the database... <?php require_once('recaptcha/recaptchalib.php'); $privatekey = "6LdU2b4SAAAAAN_Z9rLyvle0vb4n4EbyAVyXDa6V"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { // Your code here to handle a successful verification require_once("../includes/db_connect.php"); if(isset($_POST['Send'])){ $name=$_POST['name']; $address=$_POST['address']; $UCAS=$_POST['UCAS']; $mob=$_POST['mob']; $email=$_POST['email']; $tel=$_POST['tel']; $subject=$_POST['subject']; $interviewdate=$_POST['interviewdate']; $interviewtime=$_POST['interviewtime']; $parents=$_POST['parents']; $addEntry="INSERT INTO UCASinterviews(name,address,UCAS,tel,email,mob,subject,interviewdate,interviewtime,parents)VALUES('$name','$address','$UCAS','$tel','$email','$mob','$subject','$interviewdate','$interviewtime','$parents');"; $addResult=mysql_query($addEntry,$db); } } ?>
  11. You, my friend are a hero- it's passing everything through now but it's leaving out the "address" field :/ For want of sounding thick- at this point i don't care- Why did that make it work? (and thanks)
  12. Query string is getting passed to the thanks3.php and being lost before the INSERT somehow. It won't echo the variables but if I use $_GET, they appear as they should in the query string in the top of the browser. @robert_gsfame - well spotted but that doesn't seem to have changed anything @ litebearer- tried this too- doesn't seem to have any bearing :/
  13. Hi - thanks for the replies but unfortunately that didn't work. It's meant just to add another record everytime, not update an existing one. This is what I attempted: <?php require_once('recaptcha/recaptchalib.php'); $privatekey = "6LdU2b4SAAAAAN_Z9rLyvle0vb4n4EbyAVyXDa6V"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { // Your code here to handle a successful verification require_once("../includes/db_connect.php"); if($_POST['submit']=="true"){ $name=$_POST['name']; $address=$_POST['address']; $UCAS=$_POST['UCAS']; $mobile=$_POST['mob']; $email=$_POST['email']; $tel=$_POST['tel']; $subject=$_POST['subject']; $interviewdate=$_POST['interviewdate']; $interviewtime=$_POST['interviewtime']; $parents=$_POST['parents']; $addEntry="INSERT INTO UCASinterviews(name,address,UCAS,tel,email,mob,subject,interviewdate,interviewtime,parents)VALUES('$name','$address','$UCAS','$tel','$email','$mob','$subject','$interviewdate','$interviewtime','$parents');"; $addResult=mysql_query($addEntry,$db); } } ?>
  14. Hi I'm trying to update a form to a mysql database- it's simply all text fields except for one integer which is the primar key (auto increment etc) http://www.arts.ulster.ac.uk/interviews/test.php http://www.arts.ulster.ac.uk/interviews/thanks3.php test.php holds the form and the recaptcha which all seems to be fine and it posts to thanks3.php which (when i switched to $_GET) is passing the variables to that page but those values are not being stored. I then input my query into the mySQL query browser: INSERT INTO UCASinterviews VALUES ('','$name','$address','$UCAS','$tel','$email','$mob','$subject','$interviewdate','$interviewtime','$parents'); which updated the values i put in but gave this error: Incorrect integer value: '' for column 'ID' at row 1 thanks3.php just won't transfer that info to the table no matter what I try. I used $_GET, I used PHP_SELF, I stripped the rest of the page away to make sure nothing was conflicting and now I'm totally stumped- please could someone look at this with fresh eyes? test.php: <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <form action="thanks3.php" method="post" id="form2" style="margin-left:15px; display:;"> <dl id="contform"> <dd><label>Name:</label><br /> <input class="padform" type="text" name="name" size="43" maxlength="20" tabindex="2"/></dd> <label>UCAS ID:</label><br /> <input class="padform" name="UCAS" type="text" id="UCAS" tabindex="3" size="43" maxlength="30"/></dd> <dd> <label>Email:</label><br /> <input class="padform" name="email" type="text" id="email" tabindex="3" size="43" maxlength="30"/></dd> <dd> <label>Mobile:</label><br /> <input class="padform" name="mob" type="text" id="mob" tabindex="3" size="43" maxlength="30"/></dd> <dd> <label>Landline:</label><br /> <input class="padform" name="tel" type="text" id="tel" tabindex="3" size="43" maxlength="30"/></dd> <dd> <label>Subject:</label><br /> <select name="subject" tabindex="1" class="padform"> <option value="English">English</option> <option value="European Studies">European Studies</option> <option selected value="Film Studies">Film Studies</option> <option value="French">French</option> <option value="German">German</option> <option value="History">History</option> <option value="Irish">Irish</option> <option value="Spanish">Spanish</option> <option value="Journalism">Journalism</option> <option value="Photo Imaging">Photo Imaging</option> <option value="Media Studies and Production">Media Studies & Production</option> <option value="Interactive Media Arts">Interactive Media Arts</option> </select></dd> <dd><label>Address:</label><br /> <textarea class="padform"name="address" cols="40" rows="15" id="address" tabindex="5"/> </textarea></dd> <dd> <label>Preferred Interview Date:</label> <select name="interviewdate" class="padform"> <option value="26/02/11">26 February 2011</option> <option selected value="12/03/11">12 March 2011</option> </select> </dd> <dd> <label>Preferred Interview Time:</label> <select name="interviewtime" class="padform"> <option value="AM">Morning (AM)</option> <option selected value="PM">Afternoon (PM)</option> </select> </dd> <dd> <label>Parents/Guardians:</label> <select name="parents" class="padform"> <option value="1">1</option> <option selected value="2">2</option> </select> </dd> <dd> <p> <?php require_once('recaptcha/recaptchalib.php'); $publickey = "6LdU2b4SAAAAAGsh6Z78HjunUL6Mt-ZqCXtIimOs"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> </p> </dd> <dd style="background:none;"><input class="btn" type="submit" name="submit" value="Send" tabindex="6" id="submit" /></dd> </dl> </form> </div> </body> </html> thanks3.php <?php require_once('recaptcha/recaptchalib.php'); $privatekey = "6LdU2b4SAAAAAN_Z9rLyvle0vb4n4EbyAVyXDa6V"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { // Your code here to handle a successful verification require_once("../includes/db_connect.php"); if($_POST['submit']=="true"){ $name=$_POST['name']; $address=$_POST['address']; $UCAS=$_POST['UCAS']; $mobile=$_POST['mob']; $email=$_POST['email']; $tel=$_POST['tel']; $subject=$_POST['subject']; $interviewdate=$_POST['interviewdate']; $interviewtime=$_POST['interviewtime']; $parents=$_POST['parents']; $addEntry="INSERT INTO UCASinterviews VALUES ('','$name','$address','$UCAS','$tel','$email','$mob','$subject','$interviewdate','$interviewtime','$parents');"; $addResult=mysql_query($addEntry,$db); } } ?> I have other forms working with this near enough the same structure/layout/code - i'm ready to have a coronary! Is it the database setup? It's same as it ever was myISAM, UTF unicode... [attachment deleted by admin]
  15. Hi I'm really close to doing this but i suck. I need to check this column in a database which is either a load of zeroes or ones (or both). If there are no ones at all I want it to echo "<dd class='warn'>Presently there are no post graduate options available for this subject at this location.</dd>"; But if there's an instance of even one one then I want it to display the records. I keep thinking it's right but then the fields either empty or something- i think i need to do something with the array function but it's basically black magic to me- below is my code: <dl class="list0r"> <dt><span class="bold">Undergraduate:</span></dt> <?php if (empty($rsArtsCoursesWithOptionsB)){ echo "<dd class='warn'>Presently there are no post graduate options available for this subject at this location.</dd>"; echo $rsArtsCoursesWithOptionsB; }else{ do { ?> <dd><span class="options"><a href="<?php echo $row_rsArtsCoursesWithOptionsB['url_link']; ?>" target="_blank"><?php echo $row_rsArtsCoursesWithOptionsB['fac_title']; ?></a> <?php echo $row_rsArtsCoursesWithOptionsB['ucas_code']; ?></span></dd> <?php } while ($row_rsArtsCoursesWithOptionsB = mysql_fetch_assoc($rsArtsCoursesWithOptionsB)); }?> </dl> <br /> <dl class="list0r"> <dt><span class="bold">Postgraduate:</span></dt> <?php if (empty($row_rsArtsCoursesWithOptionsPostB['post'])){ echo "<dd class='warn'>Presently there are no post graduate options available for this subject at this location.</dd>"; }else{ do { ?> <dd><span class="options"><?php echo $row_rsArtsCoursesWithOptionsPostB['ucas_code']; ?><a href="<?php echo $row_rsArtsCoursesWithOptionsPostB['url_link']; ?>" target="_blank"><?php echo $row_rsArtsCoursesWithOptionsPostB['fac_title']; ?></a></span></dd> <?php } while ($row_rsArtsCoursesWithOptionsPostB = mysql_fetch_assoc($rsArtsCoursesWithOptionsPostB)); }?> </dl>
  16. LOL- right you are- sorry about that! realised that CURDATE in the sql eliminates the date check thing so i just have to check if the emailyn field is populated but it still won't fire out a mail. <?php ### current date ### $cur_date = date('Y-m-d'); ### Gets page name and stores it to variable ### $currentFile = $_SERVER["PHP_SELF"]; $parts = Explode('/', $currentFile); $page_name1 = $parts[count($parts) - 1]; ### Recordset filtered to page name ### mysql_select_db($database_ownership, $ownership); $query_owner = "SELECT * FROM arts_ownership_history WHERE page_expdate < CURDATE() AND page_name = '$page_name1'"; $owner = mysql_query($query_owner, $ownership) or die(mysql_error()); $row_owner = mysql_fetch_assoc($owner); $totalRows_owner = mysql_num_rows($owner); ### Mail function (if page is out of date?) ### $subject = "Page content expired?"; $text = "Please check the content of the following page- http://www.arts.ulster.ac.uk/".$row_owner['page_name']." as the information/content may be expired. The date set for review of this page was ".$row_owner['page_expdate'].". Please contact the designer responsible for this page (".$row_owner['page_author']."<".$row_owner['page_author_email'].">) to ensure that this page is not removed from the server- Thank You."; if($row_owner['$page_emailyn'] < 0){ mail($row_owner['page_owner_email'], $subject, $text, "From: {$row_owner['page_author']} <{$row_owner['page_author_email']}>"); $row_owner['$emailyn'] = 1; $insertSQL = sprintf("INSERT INTO arts_ownership_history(page_emailyn) VALUES 1"); mysql_select_db($database_ownership, $ownership); $Result1 = mysql_query($insertSQL, $ownership) or die(mysql_error()); } ?> just as an aside- you know the way phpself gets the filename and extension- is there a way to get the entire address "http://...philotest.php"? Cos that would eliminate the fact that more than one record can have the same file name?
  17. Hi again- ok it's drawing out the records grand but the mailer part isn't working- do i have the date in the wrong format?
  18. yeah i think i was punching above my weight there! thanks man!
  19. Thanks! Gonna give that a shot- have to head on here for a bit but I'll likely come crying back at some pont! You've been a great help!
  20. Ok that works 100% but i'm probably not explaining this correctly- i'm kind of trying to only pull the record that corresponds to this page. It's going to a database with the page names and expiry dates of the content. Then this code i'm busy butchering into nothing at the minute is going to be in the top of every php page so that whenever a user accesses the page the expiry date in the database that is checked against the current date and if the page has exceeded the date AND an email hasn't been sent previously (there's a boolean value in the database to record if an email has been sent) then the mail will send and the database will be told to change the boolean value to recrod that the email has been sent and to ensure that it isn't resent. But if this is part of fixing process then "hit me" cos it's driving me a bit mad!
  21. nope... :-\ still no errors but no action either and i've just realised what i've done is totally wrong- how would i get the date into the right format if it's in the wrong format to begin with? Changed to this: if(date($row_owner['page_expdate'], 'Y-m-d') >= $cur_date && $row_owner['$page_emailyn'] > 0){ and the error i get is: Warning: date() expects parameter 2 to be long, string given in /web/vhosts/arts/test/philotest.php on line 23
  22. erm? the data type is "date" in mySQL. Do i need to use strtotime or something? ah crap- is it that the $cur_date is a string? Like this : if(date($row_owner['page_expdate']) >= $cur_date && $row_owner['$page_emailyn'] > 0){
  23. Does the code look alright? It's not updating the database or sending out the email. I've set a record in the database with an expiry date before today's date. What's supposed to happen, if today's date is greater than the expiry date is that the mail() function should send and email out and also change a value in the page_emailyn column from 0 to 1 so that in the future, when this page is accessed, the email won't send everytime. Does that make any sense- it's to notify people to check the content of the pages to make sure it's up-to-date.
  24. Can no-one point me in the right direction? I think it might be the part where I'm updating the database? <?php require_once('../Connections/ownership.php'); ?> <?php ### current date ### $cur_date = date('Y-m-d'); ### Gets page name and stores it to variable ### $currentFile = $_SERVER["PHP_SELF"]; $parts = Explode('/', $currentFile); $page_name1 = $parts[count($parts) - 1]; ### Recordset filtered to page name ### mysql_select_db($database_ownership, $ownership); $query_owner = "SELECT * FROM arts_ownership_history Where page_name = '$page_name1'"; $owner = mysql_query($query_owner, $ownership) or die(mysql_error()); $row_owner = mysql_fetch_assoc($owner); $totalRows_owner = mysql_num_rows($owner); ### Mail function (if page is out of date?) ### $subject = "Page content expired?"; $text = "Please check the content of the following page- http://www.arts.ulster.ac.uk/".$row_owner['page_name']." as the information/content may be expired. The date set for review of this page was ".$row_owner['page_expdate'].". Please contact the designer responsible for this page (".$row_owner['page_author']."<".$row_owner['page_author_email'].">) to ensure that this page is not removed from the server- Thank You."; if($row_owner['page_expdate'] >= $cur_date && $row_owner['$page_emailyn'] > 0){ mail($row_owner['page_owner_email'], $subject, $text, "From: {$row_owner['page_author']} <{$row_owner['page_author_email']}>"); $row_owner['$emailyn'] = 1; $insertSQL = sprintf("INSERT INTO arts_ownership_history(page_emailyn) VALUES 1"); mysql_select_db($database_ownership, $ownership); $Result1 = mysql_query($insertSQL, $ownership) or die(mysql_error()); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.