@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35



Comments:

<0> With all the dynamic scripts out there these days, you can barely trust either to even specify a content-length.
<1> DepretioN: You could also look into the PEAR HTTP client
<1> Where you can do a HEAD request
<2> richardlynch: I believe that if the Content-length is provided, it should be accurate. Not doing so violates the HTTP spec so badly that a lot of stuff probably won't work.
<1> MarkR42: Indeed
<3> MarkR42: Yes, but including it for actual content, and omitting it for HEAD is what I'm thinking you'll find.
<1> *IF* Content-Length is present, it had BETTER be right.
<4> Well, I know I can trust the Content-Length on this Url :)
<5> I'm trying to make a login page with sessions, but i have no idea what i'm doing :(
<3> TML,MarkR42: ***ume other guy is bad programmer and omits Content-length: for dynamic data on HEAD because they don't bother to generate data...
<1> DepretioN: Do you know that it will return Content-Length of an object that isn't actually being fetched, is richardlynch's (perfectly valid) question
<4> jbrimble : do some more reading then
<2> You can either use a HEAD request, or a GET request with some condition, or a range request, or various other types of get request, read the http spec.
<6> Anyone know of software to parse algebraic formulae into php objects?
<3> jbrimble: Maybe start with http://php.net/session_start
<5> Thanks



<2> richardlynch: I don't think they are bad for omitting content-length on dynamic data. I think they are bad for having it WRONG. that is really bad.
<7> richardlynch: One more: arpa/nameser.h ?? Google didn't show anything :-\
<8> Can someone rephrase this in english please? I dont get the !empty part...
<4> TML : Yep, The content length is the size of a Jar file. Im using this value to create a Jad file on the fly so that all our customer have a unique install-notify-url so that we can track who is installing our software on their mobile phones
<8> Hello. I was wondering what if (!empty($_POST['name'])) does.. specifically, the ! and the empty part.. I know the POST gets the name from the form..
<3> MarkR42: So if they omit it for HEAD for dynamic data, but include it for GET?
<5> you have to put session_start() at the beginning of every page, right?
<9> I tried to make a connectdatabase function and a showdatabase function and including them in a mainfile, but it doesn't work. However if move the code from connectdatabase to showdatabase function and just have one function i works fine - why can't it be in to functions?
<3> theGZA: http://php.net/empty and ! means "now"
<2> richardlynch: Well, that would be inconvenient, but legal. If they provide the wrong value though, that would be severely annoying.
<8> !empty doesnt mean NOT empty?
<3> MarkR42: Right -- So I'm suggesting that HEAD is bad if you want to get Content-length: in the first place, as it might not be there.
<2> Also, Apache implements HEAD requests by running the normal handler for GET and then only sending headers. So it will always return the same result. Other web servers might be stupid though and not do so.
<4> theGZA : It does
<3> theGZA: !empty *DOES* mean NOT empty, for the definition of "empty" at http://php.net
<3> tjansson: You almost for sure have a scope issue in variable names. Read about 'global' and scope on http://php.net/
<1> DepretioN: I have NFC what a "JAD" file is, but richardlynch is correct when he points out that most HTTP servers do NOT include Content-Length on HEAD requests
<10> hi guys
<4> Yup
<9> richardlynch: ahh - that was it - thx :D
<11> I would like to track a user through the life of their online session -- I do this --> echo $_SESSION['user'] and get nothing...
<7> keherman: Did you set it?
<11> although i have previously set it before
<11> yes
<11> $_SESSION['user']= $_POST['email'];
<12> keherman: be sure that session_start(); is at the top of EVERY script that the user will execute
<11> every script?
<7> keherman: Are you sure $_POST['email'] contains something?
<11> yes
<12> keherman: if the user moves from script1.php to script2.php, you'll need to start the session there as well
<7> keherman: Every script that needs to interact with sessions
<11> so i need session_start() on every PHP page?
<3> keherman: Every script where you want $_SESSION to have any meaning at all, yes.
<13> keherman: session_start (); in every script as ajnewbold said
<11> ok cool
<11> thx!
<12> keherman: that should fix it :)
<5> just a quick question.. if i use include ('includes/main_funcs.php');
<5> ah, damnit
<5> I'll ask in a sec
<12> heh ok
<12> we'll be here
<7> jbrimble: You should fully-qualify your includes. (Ex: Use ./ in front of includes)
<3> jbrimble: You can get rid of the () in include for starters. They don't mean what you think they do, in that line of code...
<5> Ah, i see
<3> RogueJedi: You are SO wrong it's not even funny. You might as well not bother using include_path at all if you're going to do that, and use a full path and REALLY fully-qualify it, or you're just gonna have a mess when your project grows and you need sub-directories.
<3> Or you could actually figure out what include_path does, and run with it -- way better.
<14> include path rocks
<14> pathmunge() rules
<5> the question i had was if i use the include in index.php (for example), and the included file has session_start(), does that mean i don't have to put session start in the index.php (or any other file thats including include.php) ?
<7> richardlynch: It's not _wrong_ other then maybe it's not technically fully-qualifying, it just prevents some potential issues
<5> i hope that makes sense
<7> jbrimble: Only if you don't do anything with sessions in index.php
<15> anyone know of a good tutorial on oop? All the ones are the almost the same and just say to do this and this.....but not where or why
<7> richardlynch: Besides, all I gave was an example of something he could do, I didn't say that was _THE_ way to do it.
<5> thankyou for your answers
<16> I'm using a link like this: <img src="<?php include 't.php'; ?>abc.jpg">
<16> The odd thing is that there is an extra linefeed appearing in the generated HTML.
<16> Is this expected?
<17> r4g31: php.net/oop and php.net/oop5
<17> wad: eep



<2> wad: Probably whitespace in t.php. However, you should not do that, instead, write a function to do whatever t.php does, put it in a file you require() only once at the beginning, and call it in the places you're currently including t.php
<16> heh
<16> t.php just contains a URL. :)
<2> In which case, put it in a constant, define it somewhere like constants.php and then use it
<16> Ah, that seems very clean.
<13> is
<16> Out of curiosity, why is what I'm doing now bad?
<16> Probably performance?
<2> No, cleanliness
<16> ok
<18> hey is there a way to read in the named anchor in php
<2> Maybe performance as well, but that doesn't matter so much
<16> Basically, what I wrote is just plain OOOGLY.
<18> like :http://ajax.form-studios.com/test.php#asdf
<18> the #asdf part
<19> explode on # ?
<2> bertrandom: It's not normally sent to the server, so no.
<20> ho
<20> hi
<18> Mark: crap, thanks.
<20> where from should I know what should i use: $_REQUEST['x'], $_REQUEST[x] or $_REQUEST[$x]... php.net tells that $x but it doesnt work... works only $_REQUEST[x]
<20> or maybe it is old and shouldn't be used? it is confusing...
<2> etam: Using barewords as string literals is a no-no, and will generate a notice (you do have notices enabled, right?), so $_REQUEST[x] is a definite no-no
<20> MarkR42: but only this works :|
<2> And $_REQUEST[$x] does something completely different from the other two
<21> Hi there
<2> $_REQUEST[x] is exactly like $_REQUEST['x'] except generates a notice (unless you have a constant called x, which you should not)
<20> MarkR42: where from should i know what should i use? so in php.net is that 'x' works... :|
<22> MarkR42: it's not the same at all.
<2> caffeinated, why is it different (***uming no constant called x)
<22> what actually occurs there is php looks for a constant called 'x' and uses that instead of the string literal 'x'
<22> so, if it's defined, you won't get the value you expect
<20> MarkL: so why 'x' produces: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\xampp\htdocs\xampp\Login\login.php on line 12
<20> ?
<22> etam: because you need to enclose it in {} inside your string
<20> caffinated: how and why?
<22> echo "foo {$bar['baz']} blah";
<2> Oh, you are using this inside a double-quoted string? erk.
<22> etam: because it's a complex variable type. php requires delimiters for such things so it knows where it starts and ends.
<22> etam: you'd need the same thing for accessing object properties in string interpolation
<16> So instead of this: <img src="<?php include 't.php'; ?>abc.jpg">
<16> Once I convert it to use a function, I'll have this:
<20> ok thanks
<7> wad: Don't even need to convert it to a function, you can just a constant.
<16> ah
<7> just use*
<16> So, it would look like:
<20> what version of php should i use?
<20> 5?
<22> etam: the latest stable version in the 5.x tree.
<2> etam: If the choice is entirely yours, use the latest 5.x
<3> bertrandom: There is a function like, errr, http://php.net/parse_url which will give you the #part -- and of course it's sent to the server.
<23> careful, latest php breaks php4 if you're not careful
<20> caffinated: don't you think that it is confusing that some parts of language is old and does not works?
<16> <img src="<?php echo $const; ?>abc.jpg">
<22> etam: hm?
<7> wad: That's a variable, not a constant. http://php.net/define
<22> etam: that question makes no sense.
<16> ah
<7> wad: Either would work though
<20> caffinated: sorry for my english
<20> caffinated: i mean that some parts of php are depricated, right?
<24> richardlynch, and if setting the value in .htaccess doesn't change a thing, do I need to contact the server owners?
<22> etam: correct.
<3> spacenutes: Yup. They maybe turned OFF .htaccess, and you are screwed.
<20> caffinated: where from should i know if i am using correct version?
<3> etam: phpinfo()
<2> richardlynch: If the anchor is sent to the server (which it may be, but I always thought it was not), where can I see it in the output from phpinfo()? I see nothing containing it.
<22> etam: it's only confusing if you use the tutorials scattered throughout the web. most of them are outdated, and use outdated conventions. it's not confusing at all for me, but I've been with it a long time now.
<20> caffinated: can i find outdated mechanisms in php.net?
<22> etam: anything that is deprecated in php will be noted as such in the manual.
<3> MarkR42: Oooh. I could be way wrong... I just know that I've used parse_url in the past on URLs and got the #part -- Maybe I was web-scraping something else and not looking at $PHP_SELF and friends... Sorry!
<22> richardlynch: the #part is not sent to the server
<22> richardlynch: that is specificly there only for the browser.


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

sudo, suto
#physics
load data infile fails 1045 access denied phpmyadmin
stuck on usbutils gentoo
xubuntu 8511 usb
#perl
defoon 1
#gentoo
#centos
#debian



Home  |  disclaimer  |  contact  |  submit quotes