Jump to content

White_Lily

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by White_Lily

  1. I have a CMS and it has a Commerce section, what I need it to do is calculate what the product price is, including VAT. I have written the function that does this, however the problem Im having is its outputting the wrong (in terms of decimal places). here is the function: //Price + VAT function getPriceVAT($price) { $vatValue = 20; $vat = $price / 100 * $vatValue; //Therefore price including VAT = $priceIncVAT = $price + $vat; return $priceIncVAT; } here is how im outputting it: echo '<td>£'.getPriceVAT($getFig["product_price"]).'</td>'; It calculates it correctly but to only 1dp. which outputs: £2.4 instead of: £2.40 how can i correct this?
  2. hmm... ive never killed the script after a header, always worked fine without it
  3. What i wanna know is why hes killing the script after the header line? why kill it if they aren't even on that page anymore...? lol
  4. So how come all the other login forms ive written check if the form is empty, yet this one skips it completely?
  5. Hi, i wrote a login form with some validation - problem is it is skipping the first part of the validation where it checks if the form had any data entered in the first place... $sub = $_POST["submit"]; $username = $_POST["username"]; $password = sha1($_POST["password"]); if($sub){ if(!$username && !$password){ $err .= "You tried to login without providing the informtion required."; }else{ if(!$username){ $err .= "Please enter a username."; }else{ if(!$password){ $err .= "Please enter a password."; }else{ $getLogin = select("*", "users", "username = '$username'"); $get = mysql_fetch_assoc($getLogin); if($get["username"] != $username){ $err .= "The username didn't match the database."; }else{ if($get["password"] != $password){ $err .= "The password didn't match the database."; }else{ session_start(); $_SESSION["username"] = $username; $_SESSION["password"] = $password; $_SESSION["user_level"] = $get["user_level"]; header("Location: main.php"); } } } } } echo '<div class="error">ERROR: '.$err.'</div>'; } can anyone see why? (it goes straight to checking the username field rather then checking the entire form)
  6. Someone said that instead of sending the PM's to an email address (which is what i thought i would have to do) they said you had to do it by username, which i think i have figured out, so now all i need is to get the the forum itself, and the pm system to determine whether or not a user has read/ not read a topic and/or pm.
  7. Its not just the pm system >_> its the actual forum part aswell - like the topics are they read/unread?
  8. Okay - so how do I get it to update the database when the person clicks the topic link to mark it as read?
  9. Have you read what I said? The forum doesn't have a read/unread system yet... Telling me its the same sequence for a read/unread topic doesn't help - because there is absolutely NO read/unread system in the forum at all. That's why I'm asking how I go about it.
  10. The Avatar upload process I'm guessing would usually happen when all the details are being processed and inserted into a database (or this is how I have always done it).
  11. The point of me asking is that the forum doesnt have a read/unread system yet - otherwise, as you said, i would already have what i need.
  12. Okay so following this - how do I go about doing an unread, read system?
  13. So what your saying is, is that Hotmail Inboxs are not emails... they are private messaging systems?
  14. Okay - I'm looking for something like this forums email system... where you have an INBOX (or so this forum has called it). If that doesn't explain it then I'm not entirely sure what does...
  15. 1) You asked what forum software doesn't come with a PM system. 2) Yes, I created my forum, it is in PHP and I have no idea how to create an EMAIL system. A simple inbox is all that's needed >_<
  16. A forum that isn't pre-built? O.o
  17. @trq: That's the thing... I don't even know where to start haha. @darkfreaks: I mean like an email inbox system. Not a private Messaging system - my fault for not specifying sorry.
  18. Hi, I have decided i want to be able to create a mail box to attach to my forum so that members can send "emails" to eachother, ive tried searching the internet to no success and was wondering if some people on here could point me in the right direction.
  19. Just to add to the problem of only letting the first user log in, he only has to add to the query: $query = mysql_query("SELECT * FROM members WHERE username = $username");
  20. Plus i dont know what his database passwords are stored as, its like assuming they are sha1 when they could be md5...
  21. If its so bad jessica, post a better one.
  22. Here is some simple form and validation: <html> <head> </head> <body> <?php //Variables holding the post values $submit = $_POST["submit"]; $username = mysql_real_escape_string($_POST["username"]); $password = mysql_real_escape_string($_POST["password"]); //Runs this if the form was submitted if($submit){ //checks if the form was empty or not if(!$username && !$password){ $msg = "The form was submitted empty."; }else{ //checks to make sure a username was entered if(!$username){ $msg .= "Please enter a username."; }else{ //checks to make sure a password was entered if(!$password){ $msg .= "Please enter a password."; }else{ $query = mysql_query("SELECT * FROM members");//Queries the database $num = mysql_num_rows($query);//Collects the rows (if any) $row = mysql_fetch_assoc($query);//a variable to grab rows with //checks if there are any registered members if($num == 0){ $msg .= "There are no members in the database, register first."; }else{ //if there are members this checks the entered username against those in the database if($row["username"] != $username){ $msg .= "The username does not match any registered members."; }else{ //if there are members this checks the entered password against those in the database if($row["password"] != $password){ $msg .= "The password does not match any registered members."; }else{ //if everything succeeds then the sessions will start session_start(); $_SESSION["username"] = $username; $_SESSION["password"] = $password; //re-directs the user to the home page. header("Location: index.php"); } } } } } } echo $msg; } ?> <form action="" method="POST"> <label>Username:</label> <input type="text" name="username" /> <label>Password:</label> <input type="password" name="password" /> <input type="submit" name="submit" value="Login" /> </form> </body> </html> Remember: if the user has logged in you need to carry over the sessions to every single page on the website, this is done at the very top of the source code (before the doctype): <?php session_start(); $username = $_SESSION["username"]; $password = $_SESSION["password"]; ?>
  23. Its actually quite simple with just a few if and else statements with the odd comparison to entries in a database.
  24. Ive already seen the biggest problem... Your posting values without a form lol
×
×
  • 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.