JudgementDay
-
Posts
60 -
Joined
-
Last visited
Never
Posts posted by JudgementDay
-
-
Stop acting like [mod edit]. Its pathetic and makes computer programmers look bad.
-
I'm so [mod edit] mad you got no idea!
I just finished something that took me 20 hours, then at the end, realized I coulda did it in [mod edit] 20 minutes!
I was doing this for 100 files:
<?php session_start(); if (isset($_SESSION['lay-by']['content'])) {include '../rawcode/lay-by/pendinglay-by';} else {include '../rawcode/lay-by/toindex';} ?>
Creating whole new directory clones with files... just splitting it off to a toindex file which forwards to /.
When, all I had to [mod edit] do was chuck this at the top of the [mod edit] page!:
if (empty($_SESSION['order']['content']) {header('Location: /');}
What a joke and a half. 2 days wasted on something that would of only took me 10 minutes.
I'm new as but i still feel like a [mod edit] idiot. How dumb can you be, seriously.
-
... so do you know any ways apart from the one I suggested?
-
What are some ways to prevent Apache from serving a folder in the root directory?
I have raw data in there containing PHP with passwords for my SQL database, and I don't want it being served up.
I'm thinking just .htaccess with a password.
Is it possible to do within my servers configuration file?
I want to hear what other people would do.
-
P.S (INT) may not be neccessary
-
Hey bro,
I find temporary variables cause spaghetti and crufts up my code.
Hey, I found a solution to my problem. Its beyond my capacity to understand how it works, but all I know it does.
I don't have time to learn how it works. I am badly behind schedule.
$formula = ((int)((1 + 2 * 1.01 + 3) * 100)) / 100; $grandtotal = sprintf("%01.2f", $formula);
Anyway, gotta run. Just came back to share the solution and mark as solved.
-
$grandtotal = ((int)((450 * 1.01) * 100)) / 100;
gives me '454.5'.
Is it possible to get '454.50' instead?
-
I don't know what that means.
Anyway, the problem is now solved:
$grandtotal = ((int)(($_SESSION['order']['contentvalue'] + $_SESSION['order']['deliverycost'] * 1.01 + $_SESSION['order']['paymentsurcharge']) * 100)) / 100;
-
I'm having a little trouble when using the solution with my own code. I am getting the error 'unexpected ;':
$grandtotal = ((int)(($_SESSION['order']['contentvalue'] + $_SESSION['order']['deliverycost'] * 1.01 + $_SESSION['order']['paymentsurcharge'])) / 100;
I can understand why ';' is unexpected?
-
((int)((150 + 20.95 * 1.01 + .5) * 100)) / 100;
Solved.
-
I want to compute 150 + 20.95 * 1.01 + .5 so I get '171.65'.
echo (150 + 20.95 * 1.01 + .5); gives me '171.6595'.
I tried echo number_format(150 + 20.95 * 1.01 + .5, 2);, but I got '171.66'.
How can I go about getting '171.65'?
-
Just came back to say thanks guys.
I sorted out my math mess.
-
Don't bother replying. Stupid own fault again. I am switching off this computer and going for a walk. I need to reboot. Big mistake jumping on the computer so early.
-
Gezus! Now I have another problem. I swear when ever maths is involved everything goes wrong for me.
PHP: 150 + 20.95 * 1.01 + .5 = 171.66
Calculator: 150 + 20.95 * 1.01 + .5 = 171.65
Whats up with that?
-
Well, I just ate breakfast and things are allot clearer.
I failed at translating my PHP code to general maths for you guys.
I should have actually said:
echo number_format((150 + 20.95) * 1.01 + .5, 2);
I removed the inner brackets and now things work fine. I cannot understand why that made a different?
BTW, I saw you have a PHP CLI thing. So cool! I will get this today!
-
works for me, too. Are you using variables in your code? Maybe they are not what you think they are.
You were spot on! I was using variables and one was not what I thought. Thanks for reminding me.
I had only been out of bed for 10 minutes, so the brain wasn't functioning properly. lol
Well, now I actually do have a problem:
echo number_format(150 + 20.95 * 1.01 + .5, 2);
... gives me 173.16
My calculator gives me: 171.65
Have I done something wrong with PHP?
-
When I use this:
echo number_format(150 + 20.95 + .5, 2);
... I get 170.95.
Yet on my calculator, 150 + 20.95 + .5 gives me 171.45.
Why is that?
-
I have a PHP if() instruction. Within this if() instruction is a curl string which talks to a payment gateway.
This gateway went down today, and caused my payment processing pages to hang. I am wondering if there is a way to make PHP abort a processing a instruction after a certain amount of time it runs?
-
Hah so true! One thing I have learn't with programming (and one reason I don't stress) is that sleep solves your problems.
-
Yes, you are correct about the quotes needing to be $_POST['id']. Its funny how the mind works. I didn't even see it! I saw $_POST[id] as a whole.
Thanks.
-
Thanks for the information.
-
Wow! I don't have a clue what you are talking about.
Do you mean that I should just do:
$id = 1; $query = "SELECT * FROM products WHERE id = ".mysql_real_escape_string($_POST[id])."";
-
I am getting Use of undefined constant id - assumed 'id' with this:
$query = "SELECT * FROM products WHERE id = ".mysql_real_escape_string($_POST[id])."";
That seems pretty bull shit to me. Is this a bug in PHP?
-
Thanks man. Thats for mail forwarding.
lol
in PHPFreaks.com Website Feedback
Posted
I apologize for being such a douche, especially because I did it while pointing out how stupid I've been recently. My self-esteem problems have just gotten worse since I realized all the people I used to bully in high school are the ones who became actually successful in life.
[He didn't actually said this, but since I banned him I figured I'd give him a more reasonable sign-off. -Dan]