« first day (713 days earlier)      last day (4225 days later) » 

12:29 AM
Scratch that. Got a question about .htaccess files.
Would this be a bad place for it?
 
You can ask. Might not get an answer though.
 
if the question ends up being irrelevant , we will point you to a better place for asking it
 
Alright, I have here the Drupal 7 .htaccess file for reference: codepaste.net/eswexi
My previous attempt at getting my site's (not a Drupal site) .htaccess to do what I wanted didn't work, but that was a while ago.
Now, when I use Drupal's .htaccess for my site, it does what I need except that it's still allowing non index.php scripts to run
I basically want anything that's a script file that isn't index.php to not be allowed to run.
Otherwise, everything else works brilliantly.
 
emm ... i think you are doing it wrong
 
(I tried cooking my own .htaccess a while ago, I meant to say. Then I gave up and borrowed Drupal's.)
 
12:42 AM
all your php code should be outside the DOCUMENT_ROOT .. everything except index.php file (which only includes a bootstrap file, located outside document root)
within the DOCUMENT_ROOT you should have only the files that are meant for user to access
 
Hmm, is that what I'm missing? Alright then.
I can do that easily.
 
in such situation you redirect all the request to the index.php , except ones that are looking for existing files
you end up with something like :
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php/$0 [PT]
all the further routing of request gets handles by PHP
 
Yep, that's what I got now.
I suppose I'll play around with removing superfluous bits of that .htaccess file later.
Thanks.
 
will $_POST variables always get passed to php in the order they appear in the DOM?
 
Uh, the DOM is client side...?
 
12:52 AM
@Hamster yeah and the client side posts information to the server
 
My understanding is a form submit maps all the named form elements to their values when it is submitted... not sure how order applies to that
 
I heard the saying on SO that chat.stackoverflow.com > School + any other programming course....LOL Now I agree with it :D
 
@qwertymk no
 
Schools aren't there to teach you. They're there to tell the world how well you teach yourself.
4
 
@Hamster the dom is almost entirely client side. the server just spits out text; it's the browser that parses it and makes an object graph. (you can use server-side stuff that generates a similar object graph, but you still have to distill it to basically a text file to transfer it)
 
@cHao I know. :P The question led me to think he understood POST variables as elements of the DOM or something.
 
the variables aren't, but the elements that generate them are
 
@tereško Do you have a source?
 
@cHao So will it always be in order, I have a bunch of "name=list[]" that I'm using jqueryui sortable on, can I rely on the order I get it back?
 
.. if you meant the source for the video
 
no, I meant a source about POST order
 
i've always gotten them back in the same order they appeared in the page...i don't know whether php or the html specs guarantee that will happen
 
post order is based on how browser composes the request and on how php interprets the HTTP header
 
1:09 AM
are the main ones connsistent?
 
no
@qwertymk , how about you try to describe the problem that you have , instead of asking for workarounds to make the fix of your solution to function properly ?
 
Look above: I have a bunch of "name=list[]" that I'm using jqueryui sortable on, can I rely on the order I get it back?
 
html 5 specifies "tree order"; that is, the order in which they appear in the dom
 
@qwertymk , no , you cannot , because even the order of dom elements does not change
 
1:12 AM
wtf did that get an upvote jesus
 
the "ordering" is superficial and done by changing the positioning of the elements
 
no it's not
 
it acually reorders them on the dom
 
but the order in the dom, of course, is not necessarily the order in the visible page
 
1:15 AM
jqueryui sortable changing the order on both the dom and the visible page
 
i'm not seeing where html 4 specifies the order of posted variables...so if the browser's old, i don't know if there are any guarantees...but like i said, i haven't seen a problem yet
 
that's good enough for me, it's for backend pages anyway
 
0
A: Why a "Creating default object from empty value" warning even when class is defined?

newfurnitureyYour declaration of $clsLayoutDefinition is not creating an instance of the class: $clsLayoutDefinition = new LayoutDefinition; You need to include the () to create an object: $clsLayoutDefinition = new LayoutDefinition();

and someone even upvoted it ... WHY ?!
 
@tereško @alex Whoah now; in what version of PHP does it not allow ()?! I can't get a single test script to run without them. — newfurniturey 56 secs ago
lol
 
1:34 AM
what the... lol
what kind of half assed version of php is he running.
 
@cHao asp.net
 
lol
even vb.net lets you say x = New Something :)
 
Can you have echo in a header? Like header('Location: /echo @name;'); ??
 
:D
 
@user1079641 ...why would you need an echo in a header? header("Location: $url");
echo definitely wouldn't do what you'd want it to
 
1:37 AM
:P
 
@user1079641 please stop this
go and pick up a book .. preferably, about PHP
 
s/preferably, //
won't do much good reading about RoR to learn PHP :)
seriously, though, @user1079641, you need a php book. this is basic stuff...you need to learn it before you do any more damage
i mean a real book...dead trees
or, maybe, just possibly, a pdf
but you will not learn the basics from most web sites
especially when the web's filled with misinformation from the likes of w3schools
 
1:55 AM
w3school is wrong?
 
their information is old, at best...and in worse cases, outright encourages horrible practices
 
i no longer recommend w3schools for newbies in php, html, javascript, or sql. the site's only useful once you have enough grasp of the language to pick the good stuff from the bad
@tereško you have that one? it's not one of the half-assed ones still pushing mysql_query, right? :P
 
@cHao , naah , it's semi-ok
no mysql_* stuff , but also no info about emulated prepares in PDO
 
HI
 
2:03 AM
GREETINGS
 
I wonder if there is any tutorial
out there
 
for?
 
on how to use MVC for php
 
no, actually there aint =/
 
Well I am really confused with three layes
 
2:04 AM
mvc isn't a library or a hard-set framework...it's a concept
pretty much everyone is going to have their own take on "how it's done"
 
MVC is a design pattern
 
It is true. But I don not get the point of the Model and the controller, I believe I merged them into one
So I believe I work only with VC
 
MVC an MVC-inspired design patterns are composed of two layers : presentation layer an model layer
 
Will you say that the Model are the object that store the data??
 
model is not any single thing , but an amalgamation of several groups of elements
 
2:08 AM
does it use mysqli?
 
maybe this helps a bit
 
basically, the controller decides what needs doing, the model does it (and provides access to the results), and the view presents results etc to the user
 
it's 5am and i am getting too lazy to repeat the same song'n'dance again
 
For example, the View are the object that interact with the user: like buttons, fields, etc
Let me see the link, and thanks for your time
 
@qwertymk what did you mean by that ?
 
2:11 AM
the book that u mentioned, does it use mysql or mysqli?
 
to me MVC and co. just feels like a family of OOPifications of what-should-already-be-standard separation of presentation logic from routing logic from business logic
 
@cHao well .. most of the long-time php developers usually come up with similar concept even before they learn about existence of MVC pattern
 
Well teresko that post it is really very interesting, I will read it
 
@qwertymk it teaches how to use MySQLi and PDO ... there is no mysql_* code in the book
 
so is mysql_ officially depreciated?
 
2:16 AM
semi.
btw, "deprecated". no "i".
sorry, pet peeve.
 
not according to chrome spellcheck
ooh differnt word
nvmd
 
it's not officially deprecated by the php team yet, but the docs currently have a red box suggesting superior alternatives
 
so is mysql_ unsafe or anything? does mysql_real_escape not work or somehing?
 
not sure if it'll ever be officially deprecated, though; too much ancient and/or crap code out there still uses it
 
what better about mysqli_ except for oo?
 
2:19 AM
@qwertymk it works, but it's error prone -- and it's definitely the hard way these days, considering every decent database extension now does parameterized queries
prepared statements are the big big plus
 
oh I wrote my own wrapper for escaping mysql already so it doesn't matter to me
 
if used correctly, they escape all your data for you automagically...so you don't have to worry about it
actually
they don't even have to escape the data
the big thing is, the data and the sql are separated
so the data can never cause sql injection if you're using parameters as the gods intended
 
yeah my thing worked like $clas->sql('select ? from ? where ? = ?', array('*', 'blah'...))
 
pdo and mysqli do something like that as well...only they don't let you use field and table names
 
or $las->q('select :what from :where', array('what' => '*', 'where' => 'test'))
 
2:23 AM
cause those aren't data
and that gets escaped how?
 
yeah, I woun't either in real life
 
you parse the sql?
 
well before repalceing the placeholders it goes through mysqlx_real_escape
 
with table/field names?
 
depending if it had the i or not
 
2:25 AM
Please, don't use mysql_* functions to write new code. They are no longer maintained and the community has begun deprecation process. See the red box? Instead you should learn about prepared statements and use either PDO or MySQLi. If you can't decide which, this article will help you. If you pick PDO, here is good tutorial.
 
with whatever was in the replace array
 
read all the links
 
you can't just escape-and-quote identifiers...so unless you're just whipping up a broken example, you're creating broken sql
 
huh? I don't understand
why not?
 
because (1) identifiers don't use the same quotes as data, and (2) the backtick char is special in them -- it's the identifier quote char, but data doesn't care about it so mysql_real_escape_string won't mess with it
 
2:29 AM
so worst case it'll throw an exception if it's a reserved name
not a big deal
 
no, worst case is someone ends up injecting extra field names and/or conditions into your query.
 
hows that?
select ? from ? left join ? on ? where ? = ? order by ?
what can you do to that?
 
say you use it for authentication. if i have influence over that 5th param, i have admin access.
cause i can insert an "always true" condition at will.
 
im sorry let me rewitre that
`
select ? from ? left join ? on ? where ? = '?' order by ?`
 
still.
 
2:32 AM
how do u plan on taking that over?
1 or 1 wont work
 
the 5th param is the field name.
1 or username will most certainly work.
 
im sorry let me rewite that
select ? from ? left join ? on ? where ? = '?' order by ?`
 
try using hte fixed font button
 
there's backtics there
font?
 
select ? from ? left join ? on ? where `?` = '?' order by ?`
like that?
 
2:35 AM
yeah
thats bulltetproof
can u inject in that?
 
and if i manage to make the first param sqrt(1), *?
or something similar?
 
hows that?
 
those are parameters. you're supplying them from somewhere.
more than likely, from user input.
 
yeah but that will get escaped
 
escaping only makes data safe.
 
2:38 AM
how did u get the backtics to work?
I can't write any examples w/o knowing that
 
put the sql on a line by itself, and add 4 spaces at the beginning
 
oh, ok then try breaking this...
('select `?` from `?` left join `?` using `?` where `?` = "?" order by `?`', array($_GET[in][0],$_GET[in][1],$_GET[in][2],$_GET[in][3],$_GET[in][4],$_GET[in][5],$_GET[in][6])
everything gets passed through mysqli_real_escape_string
what url would mess this up?
 
....&in[4]=password`!=username%20or%201%20or%20`username&....
 
hold on lemme test that out
 
mysql_real_escape_string doesn't escape backticks.
 
2:46 AM
really?!
 
really.
it's meant for data.
 
hmm
 
and backticks have no special meaning in data.
 
well in that case then it shouldn't be using for column names
 
no, it shouldn't. :)
 
2:48 AM
but it's not a real parser so it's not like I'm gonna check for it
I also replaced \s+ with ' ' so the mysql cache can take over
it was more geared for speed then security
 
back in the day, pear's DB class used to have two placeholders: ? was for data, and ! for identifiers. thing was, identifiers didn't get escaped
 
that doesn't help
what so hard about replaceing that
how do u replace ` in column anyway?
 
the fact that ! could have more than just identifiers. it could have whole query clauses
backslash it...just like you do regular quotes. you may be able to double it too
 
cool
u seem to know what ur doing... lemme ask u a q
I'm creating a cms and was wondering... What's the normal amount of sql calls to make in a backend page?
editing a simple table, not actual content
 
depends entirely on what you're doing, whether you're doing custom queries or orm, how normalized or spread out your data is, etc etc etc
 
2:54 AM
well I know drupal does like 30 just on setting up, but that's really slow. I'm trying to build a backend/frontend which should be blazing fast
 
i'd expect at least one for authentication/authorization, and one to select the content or save it....but some systems use way more
 
I'm thinking of creating a master backend table with all the table colums, their types and how they get edited
 
aslong as the queries are small and simple, and the fields it's searching on are indexed, 30 shouldn't be that big a deal
 
does that make sense?
for example...
If i have a table widgets....
it has a name and content column
instead of creating a backend page for that table, just have the column info stored on the master table
and i can edit it from the master page
kinda like a cms version of phpmyadmin
 
the metadata about the fields and types is already there, i think. doesn't mysql have an information_schema pseudo-database yet?
 
2:58 AM
would something like that work?
 
I wouldn't base any software architecture on phpmyadmin ;)
 
lol
 
@cHao yes it does
 
i know it does...
 
or it did the last time i used mysql...which was a long long time ago in a galaxy far away
minus the galaxy far away.
 
2:58 AM
so all you need is the field name, type, and widget configurations
 
but I can also store what type of input filed it is
 
and have a default widget for each type
wait...not type
 
well widget is only 1 table
 
table
 
ill also have a table for....
idk other stuff
lol
like messages
and user_links
 
3:01 AM
unless you have a table for each widget type, you're going to have either a bunch of null fields or a bunch of 1NF violations
 
nonono, widgets is one table....
so it'll have an about us entry, a youtube entry...
and so on
 
then yeah. you'd either have to have a field for every possible widget setting, or one field that contains a bunch of stuff encoded in, i dunno, json
 
thats the purpose of that table
 
@cHao hStore...........
owait mysql.
 
it'll be stored as text in the db and ill have a wysiwyg editor for it
the messages table will have user_id and message_text
that will be a dropdown/autocomplete and textarea
 
having info like that in a master table... is that a good artitector?
(Chrome has no idea what I wanted to say there)
 
@qwertymk as long as you don't mind having bog-standard widgets with no configuration, it's a semi ok architecture
 
bog?
 
saying. just read "bog-standard" as "stock" or "vanilla"
 
I have no problem with that, the company that I work for has vanillier stuff and it serves them fine
 
3:05 AM
once you start caring about settings for each widget, it gets ugly fast
 
that's not how I would use widgets
I can have a reserved type of widget tat would reference another talbe
so a meet the team entry would have a flag set to reserved and would pull from the meet_the_team table
and the meat the team table would have name, desc, title, about columns
that's what I do now
 
Could someone help? I launched a script that doesn't stop (I can see logs being appended all the time). How can I kill it? No direct access to server, but I can make a php file with exec() calls. The system is freebsd.
I'm trying to list all running processes with ps, but I'm very unfamiliar with linux commands...
 
but currently I need to have a flat file for each backend page, and when I add a column I need to change the backend page, this way I won't need to do that
Do you think something like that can work?
 
i'm thinking you'll still need to edit code to change what gets shown, in many cases
brb
 
i g2g anyway
nice talking to u
@cHao thanks for the help
 
3:15 AM
np
later
 
@MārtiņšBriedis try runnning : ps aux
that should give you list of running processes
then you can stop that process by executing: kill -9 <process id>
 
thx, I'll try
Hmm, what is that aux? It doesn't show up in the man pages... It it something bad? :))
 
a, u and x are flags
they will be described individually in the man-pages
honestly , i do not even remember what they were for ... something useful
 
i'm thinking a means "all", x means...umm...yeah, i dunno. and u lists the user name?
 
u is for "user firendly"
 
3:26 AM
huh, maza pasaule
mazs internets
 
nuuu ... php.lv ir miris , visi migrē uz StackOverflow
but yeah ... have no idea what "x" was for .. i just know that it did something necessary
 
man page says, a means "all users" (as opposed to just you), and x means "all processes" (as opposed to the default of only processes attached to a tty)
 
anyone feel like taking a peek at my site? trying to get a super basic jquery script to run, lost an hour so far.... professant.com
 
`var text = ['foo', 'bar', 'baz'];
i = 0,
$div = $('#clientTypes');`

i and $div are being decalred global
notice the semicolon after baz]
but that's a minor thing
 
also , there is no point in using document.ready
you can get the same behavior by placing the script before closing </body> tag
 
3:34 AM
yeah, aware of both, was just grasping at straws
like i said, lost an hour lol
 
what doesn't seem to worK?
 
it should be fading out text from the static array declared there
the text would be in the span at the end of my h1
 
i'm gonna recommend you quit putting opening braces on the next line :P it causes ugly issues in js sometimes
 
i'll go try that
 
@erquhart , and you suck at typography
 
3:36 AM
no dice
hahaha its ugly cuz its heavily under construction amigo
it'll look much better promise
thanks for your candor tho
 
and make the things in "What we do?" list clickable
people will expect it
 
agreed
so - is it just me or does that script look like it should be working?
 
which script ?
the one that is changing the lats word in your tag line
 
aside from the brace thing, it looks pretty normal
 
in an exceedingly annoying way
 
3:39 AM
lol stop it
again, under construction, just trying to get the code to work before i make it nice
 
but it is complaining about an illegal token on line 53
 
no errors in opera
 
yeah, well, opera sucks.
 
@cHao you using chrome
 
:)
yeah
 
3:41 AM
lol it does, sorry teresko
but 2008 was definitely a good year
@tereško you said it was annoying - is the script working in your browser?
 
check line 53...i'm seeing a weird character at the end of the line
 
@erquhart yes
 
it could just be my debugger though
 
and it makes the second line twitch
 
I suggest using an IDE, which makes stupid mistakes catching a lot easier....
phpstorm is a beautiful piece of software
not beautiful maybe, but super useful
 
3:46 AM
hmm maybe i'll try it
 
yeah...phpstorm is nice
 
i kinda hate it
 
kind of a minimalist in my workflow, haven't a positive experience with an ide yet
 
it's not free, but you can delete one folder and the 30 day trial restarts :p
 
really? lol
 
3:47 AM
like driving a tank to the office in the morning
 
i hate it for two reasons : i like to control when my files are saved , and the advertising is oppressive
 
overkill
 
i like the auto save
 
overkill? coding in notepad after an IDE is like using a pocket knife to take down a tree...
 
i don't make changes to a file if i don't want to save them...so
 
3:48 AM
refactoring!!!!!!
renaming variables, etc
typos
 
effortlessly.
 
function usage
integrated GIT
 
it finds all the references to stuff you rename, and changes it there too
 
I can't imagine doint it with a notepad, yuck
 
i've done it in vim...not terribly difficult, but still a bit annoying
 
3:49 AM
auto formatter is pretty good too
 
my unregistered copy of sublimetext 2 is quite offended
 
strange .. i have never ever used integrated GIT in any IDE or editor
console FTW
 
phpstorm does it nicely...and when you create a new file, you can have it automatically add the file to git for you
 
that does not sound as "nicely"
 
I mostly use diff tool of phpstorm, but commiting etc is done via tortoisegit
I'm a GUI guy :)
 
3:52 AM
@tereško well, you can add it later if you want. you get the option
and i've forgotten to add files enough times that i like that it will auto-add the file :)
 
why not add them when you commit?
(I've never seen the point of that option)
 
@cHao git commit --amend
anyway , each commit should be a contained feature
 
āh, you forget to add unversioned files because commiting checks only versioned by default?
 
because once it's added, i don't have to worry about it again. why not have that moment be sooner than later? :)
pretty much
 
aaaaaaaaaaaaahh, rage!! I've been tracking a bug for atleast an hour, when turns out, there is no bug!
 
3:55 AM
heh
 
and it's 7am....
 
what's that char at the end of line 53?
 
yes ... i should get to that "sleeping thing" .. tried it already , but somehow it didn't work out
 
bah. you can sleep when you're dead
 
and die soon of bad health due to sleepless nights :)
 
3:58 AM
on a related subject: russians have some strange superstition about how it is bad to go to sleep at dawn
 
@cHao working on that...
 
@erquhart on being dead ?
 

« first day (713 days earlier)      last day (4225 days later) »