Jump to content

jigsawsoul

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by jigsawsoul

  1. f_login.php <?php function authenticateUser ($username, $password) { $result = "SELECT * FROM web_login WHERE username = '$username' AND password = '$password'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); if (mysql_num_rows($result) == 1){ switch ($row['userlevel']) { case "1": // The username and password match, // Set the session as ADMIN. $_SESSION['admin'] = true; $_SESSION['login_id'] = $row['login_id']; $_SESSION['username'] = $username; // After login move logged in page header ('Location: index.php'); break; case "2": // The username and password match, // Set the session as USER. $_SESSION['staff'] = true; $_SESSION['login_id'] = $row['login_id']; $_SESSION['username'] = $username; // After login move loged in page header ('Location: index.php'); break; } } else { // The username and password doesn't match // Set error message $_SESSION["message"] = '<div class="error">Login failed. Please try again or <a href="recover.php">reset your password</a>.</div>'; // After error message move to login.php header ('Location: login.php'); } } function sessionAuthenticate ( ) { // Are you loged in is admin, when trying to asscess this page if (isset($_SESSION["admin"]) == 0 || isset($_SESSION["staff"]) == 0) { // Set error message $_SESSION["message"] = "<div class='error'>You are not authorized to access the URL: <br> {$_SERVER["REQUEST_URI"]}</div>"; // After error message move to login.php header ("Location: login.php"); exit; } } ?> login2.php <?php session_start(); include ('_library/opendb.php'); include ('_functions/f_login.php'); $username = $_POST['username']; $password = $_POST['password']; authenticateUser ($username, $password); ?> index.php <?php session_start(); include ("_library/opendb.php"); include ("_functions/f_login.php"); sessionAuthenticate( ); ?> <!-- Page Header --> <?php include("_template/header.php") ?> <body> <div id="body-wrapper"> <div id="sidebar"><div id="sidebar-wrapper"> <!-- Sidebar Profile links --> <?php include("_template/profile-links.php") ?> <!-- Sidebar Main Navigation --> <?php include("_template/main-nav.php") ?> <!-- Sidebar Inbox Message --> <?php include("_template/messages.php") ?> </div></div> <!-- End #sidebar --> <div id="main-content"> <!-- No Javascript Enabled --> <?php include("_template/no-js.php") ?> <!-- Page Footer --> <?php include("_template/page-head.php") ?> <!-- Page Footer --> <?php include("_template/footer.php") ?> </div> <!-- End #main-content --> </div> </body> </html> <?php include ("_library/closedb.php") ?> Here's the full code, maybe the mistake is no another page? i don't see anything wrong. help help please
  2. if (empty($_SESSION["admin"]) == 0 || empty($_SESSION["staff"]) == 0) doesn't work at all, using this no one can login. as for ShadowIce code example. i don't want to go to a admin page, admin and staff see the same page, just admin has a different menu then staff anyone help why me
  3. using the above code i have the same problem, i can loggin as a staff member but not as an admin. admin just returns me back to the login page displaying the error message. I thought the session my not be set to anything but when running the below code, i can login as an admin fine. function sessionAuthenticate ( ) { // Are you loged in is admin, when trying to asscess this page if (isset($_SESSION["admin"]) == 0) { // Set error message $_SESSION["message"] = "<div class='error'>You are not authorized to access the URL: <br> {$_SERVER["REQUEST_URI"]}</div>"; // After error message move to login.php header ("Location: login.php"); exit; } } but i need staff to be able to login too. so i using this code. adding OR || function sessionAuthenticate ( ) { // Are you loged in is admin, when trying to asscess this page if (isset($_SESSION["admin"]) == 0 || isset($_SESSION["staff"]) == 0) { // Set error message $_SESSION["message"] = "<div class='error'>You are not authorized to access the URL: <br> {$_SERVER["REQUEST_URI"]}</div>"; // After error message move to login.php header ("Location: login.php"); exit; } } but now i can't loggin as an admin, just staff, admin returns to loggin with the error message.
  4. OR ||, is not working if i run them on there own with out the OR they work fine, but when running them together like below admin doesn't work i just don't get logged in, just kicks me out, has no errors though. any help please function sessionAuthenticate ( ) { // Are you loged in is admin, when trying to asscess this page if (!isset($_SESSION["admin"]) || !isset($_SESSION["staff"])) { // Set error message $_SESSION["message"] = "<div class='error'>You are not authorised to access the URL: <br> {$_SERVER["REQUEST_URI"]}</div>"; // After error message move to login.php header ("Location: login.php"); exit; } }
  5. Note, i have no errors when running any of this code. you the above problem ! help
  6. I have two rows within my database and all the information is being put in to the database right, but when i try to display this information with the below code, i only see the latest entry, but it displays right, i just need it to display all the rows within the database not just the one. I can't see the problem, can you guys help ? <?php session_start(); include '../../library/opendb.php'; include '../../library/config.php'; include '../../library/functions/f_login.php'; include '../../library/functions/f_nav.php'; sessionAuthenticate( ); $message .= $_SESSION["message"]; $username = $_SESSION["username"]; $result = "SELECT * FROM wbl_login WHERE username = '$username'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); $username = $row['username']; $username = ucwords($username); // Current page. $page = "commissionresponses"; // Get all member's information $result = "SELECT * FROM wbl_commissionrespond LEFT JOIN wbl_commission ON wbl_commissionrespond.commission_id=wbl_commission.commission_id LEFT JOIN wbl_login ON wbl_commissionrespond.login_id=wbl_login.login_id LEFT JOIN wbl_customers ON wbl_login.customer_id=wbl_customers.customer_id ORDER BY commissionrespond_id DESC"; $result = mysql_query ($result) or die (mysql_error()); while($row = mysql_fetch_assoc($result)) { $person1 = $row['craftsperson1_id']; $query = "SELECT * FROM wbl_craftsperson WHERE craftsperson_id = $person1"; $result = mysql_query ($query) or die (mysql_error()); $row1 = mysql_fetch_assoc ($result); $craftsperson1 = $row1['name']; $person2 = $row['craftsperson2_id']; $query2 = "SELECT * FROM wbl_craftsperson WHERE craftsperson_id = $person2"; $result2 = mysql_query ($query2) or die (mysql_error()); $row2 = mysql_fetch_assoc ($result2); $craftsperson2 = $row2['name']; switch ($row['status']) { case "pending": $links = '<a href = "details.php?id='.$row['commissionrespond_id'].'" >Read More</a> | <a href = "respond.php?id='.$row['commissionrespond_id'].'" >Respond</a> | <a href = "update.php?id='.$row['commissionrespond_id'].'" >Edit</a> | <a href = "delete.php?id='.$row['commissionrespond_id'].'" >Delete</a>'; break; case "complete"; $links = '<a href = "details.php?id='.$row['commissionrespond_id'].'" >Read More</a> | <a href = "delete.php?id='.$row['commissionrespond_id'].'" >Delete</a>'; break; } $tablerows .= ' <tr class="alt"> <td>'.$row['commission_id'].'</td> <td>'.$row['username'].'</td> <td>'.$craftsperson1.'</td> <td>'.$row['quote1'].'</td> <td>'.$craftsperson2.'</td> <td>'.$row['quote2'].'</td> <td>'.$row['status'].'</td> <td>'.$links.'</td> </tr> '; } ?> <?php include ('../../library/template/admin/htmlstart.php'); ?> <div id="wrap" class="clearfix"> <?php include ('../../library/template/admin/adminpanel.php'); ?> <div id="content" class="clearfix"> <?php mainNav($page); ?> <div id="left" class="clearfix"> <div id="left_container"> <?php subNav($page); ?> <?=$message?> <h1 class="section">Current Enquiry Responses</h1> <table id="project_members"> <tr> <th>Commission Ref:</th> <th>Staff Member:</th> <th>Crafts Person:</th> <th>Quote:</th> <th>Crafts Person:</th> <th>Quote:</th> <th>Status:</th> <th>Operations:</th> </tr> <?=$tablerows?> </table> </div> </div> <!-- Right Side Bar Here --> <?php include ('../../library/template/admin/footer.php'); ?> </body> </html> <?php unset ($_SESSION["message"]); include '../../library/closedb.php'; ?>
  7. $result = "SELECT * FROM wbl_craftsperson ORDER BY name ASC"; $result = mysql_query( $result ) or die( mysql_error() ); $craftsperson1 .= '<select name="craftsperson1" id="craftsperson1">'; while( $row = mysql_fetch_assoc( $result ) ) $craftsperson1 .= '<option value="'.$row['$craftsperson_id'].'">'.$row['name'].'</option>'; $craftsperson1 .= '</select>'; Then in the html <div id="form_accountinfo" class="mb"> <h1>Send Response</h1> <p class="grey">You are currently logged in as <em><?=$username?></em>.</p> <form action="respond2.php?id=<?=$commissionid?>" method="post"> <fieldset> <label for="subject"><b>Description</b></label> <?=$current_description?> <br /> <label for="subject"><b>Comments</b></label> <?=$current_comments?> <br /> <label for="craftsperson1"><b>Crafts Person 1</b></label> <?=$craftsperson1?> <label for="quote1"><b>Quote 1</b></label> <input id="quote1" name="quote1" size="30" type="text" value="£" /><br /> <label for="craftsperson2"><b>Crafts Person 2</b></label> <?=$craftsperson2?> <label for="quote2"><b>Quote 2</b></label> <input id="quote2" name="quote2" size="30" type="text" value="£" /><br /> <input type="submit" value="Send Response" class="primary" /> </fieldset> </form> Page 2 $craftsperson1 = $_POST['craftsperson1']; echo $craftsperson1; exit; But i get nothing i have checked all the names on my pages and database but everything to be seems fine.. ?
  8. i get this error message: Error in query: INSERT INTO wbl_enquiryrespond (enquiry_id, login_id, enquiryreplydate, enquiryrespond) VALUES (''5 ', '9', '2009.08.15', 'tyjutyu'). 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 '5 ', '9', '2009.08.15', 'tyjutyu')' at line 1 <?php session_start(); include '../../library/opendb.php'; include '../../library/config.php'; include '../../library/functions/f_login.php'; include '../../library/functions/f_nav.php'; sessionAuthenticate( ); $enquiryid = $_GET['id']; $loginid = $_SESSION['login_id']; $respond = $_POST['respond']; $date = date("Y.m.d"); $query = "INSERT INTO wbl_enquiryrespond (enquiry_id, login_id, enquiryreplydate, enquiryrespond) VALUES (''$enquiryid ', '$loginid', '$date', '$respond')"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); exit; if (mysql_query ($query)) { $_SESSION["message"] = '<div class="message mb">Response To Enquiry Has Been Sent.</div>'; header ('Location: list.php'); } else { $_SESSION["message"] = '<div class="error mb">Response To Enquiry Failed.</div>'; header ('Location: list.php'); } include '../../library/closedb.php'; ?> Please Help ! Thanks...
  9. i keep looking at the code over and over and i dont see anything
  10. nope doesn't work that way to, i don't get any of the table displayed both ways at all any help out there
  11. $tablerows is not echoing out and i can't seem to understand why. $requestid = $_GET['id']; is getting the id. any help <?php session_start(); include '../../library/opendb.php'; include '../../library/config.php'; include '../../library/functions/f_login.php'; include '../../library/functions/f_nav.php'; sessionAuthenticate( ); $message .= $_SESSION["message"]; $username = $_SESSION["username"]; $result = "SELECT * FROM wbl_login WHERE username = '$username'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); $username = $row['username']; $username = ucwords($username); // Current page. $page = "commissionrequest"; $requestid = $_GET['id']; // Get all member's information $result = "SELECT * FROM wbl_commission LEFT JOIN wbl_customers ON wbl_commission.customer_id=wbl_customers.customer_id LEFT JOIN wbl_login ON wbl_customers.customer_id=wbl_login.customer_id WHERE commission_id = $requestid"; $result = mysql_query ($result) or die (mysql_error()); while($row = mysql_fetch_assoc($result)) { $tablerows .= ' <table id="project_members"> <tr class="alt"> <td> <b>Id:</b> '.$row['commission_id'].' <b> Username:</b> '.$row['username'].' <b> Date:</b> '.$row['date'].' <b> Status:</b> '.$row['status'].' <br /><br /> <b>Description:</b> '.$row['description'].' <br /><br /> <b>Comments:</b> '.$row['comments'].' <br /><br /> <a href = "details.php?id='.$row['enquiry_id'].'" >Respond</a> | <a href = "update.php?id='.$row['enquiry_id'].'" >Edit</a> | <a href = "delete.php?id='.$row['enquiry_id'].'" >Delete</a></td> </tr> </table> '; } ?> <?php include ('../../library/template/admin/htmlstart.php'); ?> <div id="wrap" class="clearfix"> <?php include ('../../library/template/admin/adminpanel.php'); ?> <div id="content" class="clearfix"> <?php mainNav($page); ?> <div id="left" class="clearfix"> <div id="left_container"> <?php subNav($page); ?> <?=$message?> <h1 class="section">Current Commission Requests</h1> <?=$tablerows?> </div> </div> <!-- Right Side Bar Here --> <?php include ('../../library/template/admin/footer.php'); ?> </body> </html> <?php unset ($_SESSION["message"]); include '../../library/closedb.php'; ?>
  12. i never thought i would get a reply, its a word doc ill upload it and leave the link here, if you have msn, it might be easier i just happy for any help i may get thank you. http://stuweb.cms.gre.ac.uk/~hr728/wbl.doc
  13. I would just like to say first of thank you all on this forum for helping me with my cousrework over the last few weeks in order to complete my web tech work. However i have learned a lot from you eyes and where my errors have been within my code, the problem i have now is that i have to complete another cousrework that needs to be handed in on this Monday, the problems i'am having is that i don't fully understand what i have to do or can i work out the tables i need within my database, i have a good overall of the coursework after reading it a number of times to myself and trying to work out the base of what i need to do, but the problem is im stuck, i have came up with a simple erd drawing on the computer of what i think is need im just not sure about the rest. I know once i understand what tables i need and how it needs to work, i will be able to complete the coursework pretty quickly in php and mysql. If any you guys think you could spend a little time understand my cousrework please let me know then ill post up my coursework sheet or we can talk across msn, it would be really nice for one person at least to help thanks you.
  14. I would just like to say first of thank you all on this forum for helping me with my cousrework over the last few weeks in order to complete my web tech work. However i have learned a lot from you eyes and where my errors have been within my code, the problem i have now is that i have to complete another cousrework that needs to be handed in on this Monday, the problems i'am having is that i don't fully understand what i have to do or can i work out the tables i need within my database, i have a good overall of the coursework after reading it a number of times to myself and trying to work out the base of what i need to do, but the problem is im stuck, i have came up with a simple erd drawing on the computer of what i think is need im just not sure about the rest. I know once i understand what tables i need and how it needs to work, i will be able to complete the coursework pretty quickly. If any you guys think you could spend a little time understand my cousrework please let me know then ill post up my coursework sheet or we can talk across msn, it would be really nice for one person at least to help thanks you.
  15. you know what its so dumb i have copyed the wrong included them another page. thanks alot
  16. I keep getting this error i don't really understand why i used the code on another page and just seemed to work fine, but now it whats to play up. any help to why its doing this? thanks... <?php session_start(); include '../../library/opendb.php'; include '../../library/config.php'; include '../../library/functions/f_login.php'; include '../../library/functions/f_nav.php'; include '../../library/functions/f_logs.php'; sessionAuthenticate( ); $message .= $_SESSION["message"]; $username = $_SESSION["username"]; $result = "SELECT * FROM gb_login WHERE username = '$username'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); $username = $row['username']; $username = ucwords($username); // Current page. $page = "customers"; $maxPerRow = 3; // Get all member's information $result = "SELECT * FROM gb_login LEFT JOIN customers ON gb_login.customer_id=customers.customer_id ORDER BY login_id DESC LIMIT ".( $_GET['offset'] ? $_GET['offset'] : 0 ).', '.$maxPerRow; $rowCount = "SELECT * FROM gb_login LEFT JOIN customers ON gb_login.customer_id=customers.customer_id"; $rowCount = mysql_num_rows( mysql_query( $rowCount ) ); $result = mysql_query ($result) or die (mysql_error()); while($row = mysql_fetch_assoc($result)) { $tablerows .= ' <tr class="alt"> <td>'.$row['username'].'</td> <td>'.$row['password'].'</td> <td><a href="mailto:'.$row['email'].'">'.$row['email'].'</a></td> <td>'.$row['userstatus'].'</td> <td><a href = "update.php?id='.$row['login_id'].'" >Edit</a> | <a href = "delete.php?id='.$row['login_id'].'" >Delete</a></td> </tr> '; } ?> <?php include ('../../library/template/admin/htmlstart.php'); ?> <div id="wrap" class="clearfix"> <?php include ('../../library/template/admin/adminpanel.php'); ?> <div id="content" class="clearfix"> <?php mainNav($page); ?> <div id="left" class="clearfix"> <div id="left_container"> <?php subNav($page); ?> <?=$message?> <h1 class="section">Current Customers</h1> <table id="project_members"> <tr> <th>Username:</th> <th>Password:</th> <th>Email:</th> <th>Status:</th> <th>Operations:</th> </tr> <?=$tablerows?> </table> <?=paginate( $rowCount, $maxPerRow )?> </div> </div> <!-- Right Side Bar Here --> <?php include ('../../library/template/admin/footer.php'); ?> </body> </html> <?php unset ($_SESSION["message"]); include '../../library/closedb.php'; ?>
  17. i can't write that as you said within here. this my full code. i can't work it out still. im new to php help.. $tablerows .= ' <form action="commissionrequest2.php?id='.$row['commission_id'].'" method="post"> <table> <tr> <td><b>Product(s) description:</b> <textarea input id="description" name="description" size="40" type="text" rows="4" cols="50"/></textarea></td> </tr> <tr> <td><b>Other comments:</b> <textarea input id="comments" name="comments" size="40" type="text" rows="4" cols="50" /></textarea></td> </tr> <td><b>Customer:</b><br /> <input id="customer" name="customer" size="30" type="text" value='.$row['title'] .' '. $row['firstname'] .' '. $row['surname'].' /></td> </tr> </tr> <td><b>Telephone:</b><br /> <input id="telephone" name="telephone" size="30" type="text" value='.$row['telephone'].' /></td> </tr> </tr> <td><b>Email:</b><br /> <input id="email" name="email" size="30" type="text" value='.$row['email'].' /></td> </tr> </table> <br /><br /> <input type="submit" value="Send Request" class="primary" /> </form> ';
  18. how do i add a space beween each $row <input id="customer" name="customer" size="30" type="text" value='.$row['title'] .''. $row['firstname'] .''. $row['surname'].' /> can't seem to get it to work
  19. does any one have a clue to why $tablerows is not echoing out, as the page is not displaying the form at all ? any help thanks <?php session_start(); include '../library/opendb.php'; // Are you loged in an user, when trying to asscess this page. if ($_SESSION['user_logged_in'] == true) { // The user is logged in display $username = $_SESSION["username"]; $result = "SELECT * FROM wbl_login LEFT JOIN gb_customers ON gb_login.customer_id=gb_customers.customer_id WHERE username = '$username'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc($result); $username = $row['username']; $username2 = ucwords($username); $_SESSION["customerid"] = $row['customer_id']; $loginbar = ' <div id="logedin" class="clearfix"> <span class="left clearfix"> <h1 id="project_title">User, Gig Bookers</h1> </span> <span class="right clearfix"> '.$username2.' | <a href="account.php">Account</a> | <a href="../login/logout.php">Logout</a> </span> </div> '; $loginid = $_GET['id']; $tablerows .= ' <form action="commissionrequest2.php?id='.$row['commission_id'].'" method="post"> <table> <tr> <td width="100"><b>Product(s) description:</b></td> <td><textarea input id="description" name="description" size="40" type="text" rows="25" /></textarea><br /></td> </tr> <tr> <td><b>Other comments:</b></td> <td><textarea input id="comments" name="comments" size="40" type="text" rows="25" /></textarea><br /></td> </tr> <td><b>Customer:</b></td> <td><input id="customer" name="customer" size="30" type="text" value='.$row['title'].' '.$row['firstname'].' '.$row['surname'].' /></td> </tr> </tr> <td><b>Telephone:</b></td> <td><input id="telephone" name="telephone" size="30" type="text" value='.$row['telephone'].' /></td> </tr> </tr> <td><b>Email:</b></td> <td><input id="email" name="email" size="30" type="text" value='.$row['email'].' /></td> </tr> </table> <br /> <input type="submit" value="Save Changes" class="primary" /> <a href="account.php">Go Back</a> </form> '; } ?> <?php include ('../library/template/public/htmlstart.php'); ?> <?php echo $loginbar ?> <div id="header"><img src="images/top.jpg" alt="Gig Bookers" /></div> <div id="menu" class="clearfix"> <ul> <li ><a href="index.php">Home</a></li> <li ><a href="events.php">Commission Request</a></li> <li ><a href="tandc.php">Terms And Condition</a></li> <li><a href="contact.php">Contact</a></li> <li class="login"><a href="../login/login.php">Login / Signup</a></li> </ul> </div> <div id="wrap" class="clearfix"> <div id="content" class="clearfix"> <div class="column_full"> <h1>Commission Request</h1> <?=$tablerows?> <p></p> </div> </div> </div> <?php include ('../library/template/public/footer.php'); ?> </div> </body> </html>
  20. hey i still working on my uni. coursework, i just created the code for when a coustomer will buy a ticket from the website and the information is stored within the database below is my code. <?php session_start(); include '../library/opendb.php'; include '../library/functions/f_logs.php'; $eventid = $_GET['id']; $reqtickets = $_POST['reqtickets']; $cardtype = $_POST['cardtype']; $cardname = $_POST['cardname']; $cardnumber = $_POST['cardnumber']; $expirationdate = $_POST['expirationdate']; $billingaddress = $_POST['billingaddress']; $loginid = $_SESSION['login_id']; $query = "INSERT INTO sales (sale_id, login_id, event_id, reqtickets) VALUES (' ', '$loginid', '$eventid', '$reqtickets')"; if (mysql_query($query)) { // Success! } else { // Error! } $query = "INSERT INTO cards (card_id, amountcharged, cardtype, cardname, cardnumber, expirationdate, billingaddress) VALUES (' ', ' ', '$cardtype', '$cardname', '$cardnumber', '$expirationdate', '$billingaddress')"; if (mysql_query($query)) { // Success! $idcard = mysql_insert_id(); } else { // Error! } $query = "UPDATE gb_login SET card_id = '$idcard' WHERE login_id = $loginid"; if (mysql_query($query)) { // Success! } else { // Error! } $result = "SELECT * FROM events e LEFT JOIN artists ON e.artist_id=artists.artist_id LEFT JOIN venues ON e.venue_id=venues.venue_id LEFT JOIN sales ON e.event_id=sales.event_id LEFT JOIN gb_login ON sales.login_id=gb_login.login_id LEFT JOIN gb_customers ON gb_login.customer_id=gb_customers.customer_id WHERE e.event_id = {$_GET['id']}"; $result = mysql_query( $result ) or die ( mysql_error() ); $row = mysql_fetch_assoc ( $result ); $current_venue = $row['venue']; $current_artist = $row['artist']; $current_date = $row['date']; $current_price = $row['price']; $user_email = $row['email']; $user_firstname = $row['firstname']; $user_surname = $row['surname']; $subject = "Event Confirmation"; $web = "Gig Bookers"; $msg = "Gig Bookers - This is a confirmation email to say you have purchased $reqtickets Ticket(s) at price $current_price per ticket for $current_artist playing at $current_venue on $current_date. Thank You"; $body = "Sender: " . $user_firstname . " " . $user_surname . "\n\nEmail: " . $user_email . "\n\nWebsite: " . $web . "\n\nMessage:\n\n" . $msg; if (mail($user_email, $subject, $body)) { echo("confirmation email sent"); } else { echo("confirmation email couldn't send"); } $totalprice = ($current_price * $reqtickets); $query = "UPDATE cards SET amountcharged = '$totalprice' WHERE card_id = '$idcard'"; if (mysql_query($query)) { // Success! } else { // Error! } $query = "SELECT * FROM events WHERE event_id = $eventid"; $query = mysql_query( $query ) or die ( mysql_error() ); $row = mysql_fetch_assoc ( $query ); $alreadysold = $row['soldtickets']; $soldtickets = ($alreadysold + $reqtickets); $query = "UPDATE events SET soldtickets = '$soldtickets' WHERE event_id = '$eventid'"; if (mysql_query($query)) { // Success! } else { // Error } $_SESSION["message"] = '<div class="error mb">Your Tickets Will Be Sent To You By Post Within The Next Three Weeks, An Email H:as Been Sent To You To Confirm Your Booking, Thank You.</div>'; header ('Location: events.php'); ?> you guys think of a better way to do it, plus the header doesn't work at the bottem of the page i get: confirmation email sent Warning: Cannot modify header information - headers already sent by (output started at /home/hr728/public_html/webtwo/public/buy2.php:71) in /home/hr728/public_html/webtwo/public/buy2.php on line 105 but i think i know why now lol.. any ideas ?
  21. i have checked all the $rows by echoing them all out and they are all showing the right data too. and email address
  22. i used this same code before and it seemed to work just fine, but now i don't seem to get sent any email's although it echo's confirmation email sent. any ideas why this happening ? $result = "SELECT * FROM events e LEFT JOIN artists ON e.artist_id=artists.artist_id LEFT JOIN venues ON e.venue_id=venues.venue_id LEFT JOIN sales ON e.event_id=sales.event_id LEFT JOIN gb_login ON sales.login_id=gb_login.login_id LEFT JOIN gb_customers ON gb_login.customer_id=gb_customers.customer_id WHERE e.event_id = {$_GET['id']}"; $result = mysql_query( $result ) or die ( mysql_error() ); $row = mysql_fetch_assoc ( $result ); $current_venue = $row['venue']; $current_artist = $row['artist']; $current_date = $row['date']; $current_price = $row['price']; $user_email = $row['email']; $user_firstname = $row['firstname']; $user_surname = $row['surname']; $subject = "Event Confirmation"; $web = "Gig Bookers"; $msg = "Gig Bookers - This is a confirmation email to say you have purchased $reqtickets Ticket(s) at price $current_price per ticket for $current_artist playing at $current_venue on $current_date. Thank You"; $body = "Sender: " . $user_firstname . " " . $user_surname . "\n\nEmail: " . $email . "\n\nWebsite: " . $web . "\n\nMessage:\n\n" . $msg; if (mail($email, $subject, $body)) { echo("confirmation email sent"); } else { echo("confirmation email couldn't send"); }
×
×
  • 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.