a perl
hash is basically an associative array yes
there you go then
so if it's a 2d array, how can I learn how to store that in a
database?
in perl 4 the did call hashes "associative arrays"
but a hash is what you typically bless :-)
foreach row --- foreach element in a row validate - after
that insert the row --- the validation part may be skipped in a
prepared statement
yes, hashes are the most common (although you could use a
subref and a closure if you wanted
well, you'd generally just loop over the array, generate sql, run
sql
actually, f00li5h looking at how php webhosting
allocates memory for objects, is verrrry close to an associative
array
$insert_handle = $db-prepare('insert into feeds(foo,bar,baz)
values( ?,?,?); foreach($big_old_array as $item)
{$db-execute($insert_handle, $item)}
implementation doesn't concern me
are there any examples of this looping that one does to store
an array?
perl has closures now?
weird, why doesnt this waveform make any sound?
str_repeat(chr(1).chr(128),100000)
so what's ruby still used for then?
sure, hasn't it always?
f00li5h, I'm not sure it has
actually, you're probably right
kim_register, it pretty much always had that
since 5.0 atleast
it would have had them as long as it has had namespaces, i'd
imagine (i don't know much perl lore, i'm afraid)
the frequency was too low
and it was supposed to be a smaller gap, not higher
f00li5h, it's had namespaces forever
indeed. although i'm not sure if closures are on lexical scopes
or namespaces
I think lexical scope
but don't quote me on that
lexical scopes
== does perl for a
living sometimes too
i just do it for fun
I do sometimes too
pretty much any scripting language, plus a few non scripted
ones
except python
/hamlet
cythrawll, you can simulate lexical scope for python too...
errr closures even
though for some reason, I haven't actually used closures much
which probably means I am dumb
they're only useful at particular times, but when they are,
they're close to the only way to di it
well, if you have objects you can get the same effect I
suppose
awesome, i just programmed an earthquake sound
they're good for currying
for ($i=0;$i100000;$i++)
$wave-samples .= chr($r=rand(0,127)).chr($r+128);
sounds like those damn jets that fly over my house +_+
well, any sound would do that at ~1700 bps XD i need to learn
how to make cool sounds
TehSausage, you're making lots of white noise basically?
TehSausage, did you make a sine wave yet?
i've tried to make scaling noise functions, but i can't
figure it out
(probably a silly question)
mathematica is fun for playing with sounds
/shameless plug
made a fading out noise
$wave-samples .= chr(rand($i/200000*127,127));
TehSausage, did you do the standard sine wave yet?
i dont know how :P
oh, if anyone wants the wav class, i'll put it up, it's write only
though
i might open OOo calc
err, not calc
i think i just made one D:
Need some opinions here. I am starting to realize that i am
spending way to much time developing little things here and there
for my site to function in an automated fashion. Simple things like
SEO friendly urls, dynamically created menus, sitemaps, meta
information, pagetitles, etc. Should i just scrap it all and use
something like wordpress?
never give in
But im spending to much time on this stuff when i could
simply just copy and paste the content into wordpress, apply my
"theme" and i would be set
Even a google sitemap would be created for me automatically
MACscr, you could use a framework, and use alot of the
predefined components to build an application without being
restricted by a CMS application.
you learn more doing it yourself
I guess it depends on what kind of applications you want to do,
using a cms application to me seems severely restrictive, not all
web apps are cms' just most of them :p
MACscr, so do that
well, sure, if you're just doing things that a third party
app solves for you, why waste your time
but if you're doing extra stuff, then it'll take longer to add to a
third-party app
Well, my site integrates with my billing system which uses
smarty. So i have written a bunch of custom plugins that i use on
my site and the billing system. Unfortunately WP doesnt use smarty,
so i would have to duplicate the plugins to work with regular
php
MACscr, also, you could always build your own framework or
use an already available one, and use that to create your own
CMS
that you can then use to pump out web apps
Yeah, i need to learn symfony anyways, but i think that might be
overkill for this
Unfortunatly? more liek fortunatly... amirite?
symfony is also a CMS right?
No clue, havent played with it much yet. One of my business associates
that im partnering up on a project is using it
As you can tell, my needs are not that advanced
well, i dont find it fortunate as i would still need to use the
smarty plugins as i have to use that billing system for now, so i
would have to duplicate my work
http://sausage.no-ip.org:88/test.wav.gz
is that a sine wave? or did i fail once again
Wav.gz?
uhh, yeah
Never heard of that extension
well i wasnt gonna put 100kb up if that was only 6
you've never heard of .wav? or .gz?
you can have a test.wav.gz.bz2.rar.zip.tgz.gz if you wanted
I have heard of both, but you have them combined. Guess i was
only familiar with tar.gz
Whats the point of doing wav.gz? Can you listen to it without
decompressing it?
If not, then why not just do filename.tar.gz?
can you listen to test.wav.zip?
no, get over it
No, but you should never use a period in the filename of a
file
if my browser is downloading my script instead of parsing it,
what's more than likely wrong with my config file ?
ever
what?
you're making no sense now
i shouldnt compress my files, because you dont want to decompress
them
No, thats not what im saying. Im saying you should never name
a file with a period unless its specifically for the actual file
type
This.file.name.zip is wrong, plain wrong
no it isnt
.tar.gz is fine though?
Yes it is and virus filters will stop it
thats just a gzipped .tar file
I have a solution to my paranoid php on shared host server!
apache + suexec + fastcgi + php-cgi (running as specific uid/gid
per vhost) + mac_bsdextend + ugidfw = Uber fine grained control on
what php processes can do and where! Yay
get a new virus filter
Thats how ClamAV works, which is one of the most widely used
server side
antivirus solutions
By default it works that way at least
then it's stupid
what does this error mean? Wrong parameter count for
mysql_query()
You've either given it too many parameters or not
enough.
means you forgot a parameter, probably
that sounds horrible =P
mysql_query() only /requires/ one parameter, could could you
forget it?
$query = "UPDATE `members` SET FIELD `home_phone` = '$phone'
WHERE `username` = '$user'"; mysql_query($query) or die
(mysql_query());
or die (mysql_query());
or die(mysql_error())
you mean mysql_error() ?
oh crap
lol
thank you
it aint Its fucking good. Whoops the shit out of almost any
other setup
anyone able to help me with http://pastebin.com/m12c56778 i
am sorting an array and it seems that the keys are sorting but the
values on the keys are staying in the same place
you can use uid:gid ranges, so you can essentially have one
rule, and thats it
Just seems like it would be slow with with a lot of users on
a server in comparison to mod_php
were you talking to me ?
try asort()
As in 10-20% slower
where does that come from
why would a query come up with a blank variable if 2 other
calls on the same variable succeeded?
is there a way to trap signals like ctrl+c in php?
Just from what i have read about those solutions
kim_register nevermind lol
whats wrong with it?
yes, cgi host
is a bit slower
Are there some plan to make a bytecode and a VM for PHP?
Becouse performance aims.
I need a php script to shutdown gracefully
the mysql_error() gave me an error where my $user variable
was blank... but it worked correctly with the previous 2 queries
that used the same $user variable....
isn't a vm going to slow your code down more than compiling
will speed it up?
I would rather slower than horribly insecure, which is what most
shared php
hosting environments are
TehSausage, asort didnt even sort it at all
if you use APC or one of the other p-code caches, like
memcache, that'll get you your compiled-language like performance,
have you tried these?
meow
D:
php compiler, if that isnt faster than interperated then no clue
XD
if it works on the first 2 i know its "recycled" the $user
variable at least once (and correctly) and then all of a sudden
drop the data in my $user variable on the 3rd query?
i dont reset the variable so i am unsure of why/how it is wiping
out the data contained in $user....?
ahh dw i needed to use ksort
APC runs more faster than a bytecode on optimized bytecode
VM?
hi, I'm begining in PHP, I was just wondering, what's the
differance of using static host .php
pages and using page with query strings like
index.php?id=MyPage
well, it runs cached bytecode, without having to run a VM at
all
saves you from duplicating things
and a vm is always going to be overhead
I already compare some performance test in C/C++ comparing with
Java and "pasmem" bytecode java was more
faster.
?key=value strings are passed to the php script in an array
called $_GET
b?key=value strings are passed to the php hosting script in
an array called $_GET/b
yes, I know, but I used to have my ass. array
associate to differant .php pages
I think if exists something like for PHP, PHP is more
faster!
but at the end, I have the same ammount of pages...
if i use $user once, can i use it again on the same page without
it reloading the page to get the variable from $_post[''];?
you lost me
wait
ill PB something
no, variables only live for the life of the request
if you want them to hang arround, stick them in $_SESSION, and
load the class declaration before you do
session_start()
yeah teh, i thought you could also use the $_POST method to
get that data?
http://dark-code.bulix.org/koofky-48600
this is my index
foolish, oh that sucks
looks pretty useless
yah...
but easier to manage
just a bit
only the content is on the subpages
not the include()
Thanks for your comments f00li5h!
sure thing
theres no difference between that.php?id=inscription and
inscription.php except you can't use headers because the template
was already printed, and maybe afew ms speed drop
theres no difference between that.php?id=inscription and
inscription.php except you can't use headers because the template
was already printed, and maybe afew ms speed drop
it's an array
and that wouldnt work if it was the way i said it, since it'd
request passwd.php
did you suggest basename, or an array?
man it's creepy when your access referer logs indicate someone
googling for you by name
from across the country
i didn't suggest anything
:/
http://dark-code.bulix.org/koofky-48600
read first, then complain XD
you gonna get raped
NOES
in wich case using query strings is really needed
since in my case its a bit useless
when you need input from the user =\
The mac_bsdextended(4) module enforces the file system firewall.
-- how rad is that.
The mac_bsdextended(4) module enforces the file system firewall.
-- how rad is that.
why does PHP tell me it needs SAM/php_sam.php ?
who is Sam?
you tried to include a file that doesnt exist
um, it says that when i run the exe, the file is php print
'hello world; ?
why then there's site that use php?id= for every pages
even if they dont need input from user
$query = "UPDATE `members` SET FIELD `username` = '$user'
WHERE `username` = '$_SESSION['change_user']'"; This line looks
right (i mean i knows it obviously not, but i though thats how
getting it from a session was done....
because theres more you can do with querys than include files
based on the input
allaire, to get content from a DB
ahh
nevermind, i see it now
ok
pecl uninstall SAM
thats all i can think of
but they still use my basecode http://dark-code.bulix.org/koofky-48600
er... i'm on windows
point?
pecl uninstall SAM
When_I_Fall, hell of a drug isn't it?
or do i give you nub instructions "open command prompt,
navigate to your php directory if it's not in your
PATH..."
that thar windows?
if by drug you mean 'something to make you want to shoot
yourself', yes
bif by drug you mean 'something to make you want to shoot
yourself', yes/b
ubif by drug you mean 'something to make you want to shoot
yourself', yes/b/u
i'd install it, but i need to find a place for 2.24GB+ of music
first...
When_I_Fall, on a dual layer writable dvd?
actually it could just be single layer :p
...if i had a blank dvd do you think i wuoldn't have used it?
=p
well you could always whore yourself out in the alley for
one
...i'd rather keep windows
i wouldn't be so sure
well i can get a blank dvd by the end of the week
"/
i am missing either "\"'s to escape the double quotes, or i
need to take out the quotes I think. am I warm?
or am i completely wrong
It's technically fine as is, but the quotes are not
needed.
its not being echoed into the textbox as the present value
though
so something about that statement is wrong
j2daosh, are you sure $username is not an empty string?
nope... i should probably check that. huh
im trying to store this text "In a frying pan, sauté
the onions and garlic in oil until slightly browned." in a mysql db
with utf8 tables, but "In a frying pan, saut" is what ends up
getting stored the é seems to be causing problems.
ideas?
does php handle the utf8 right?
f00li5h, I would say not, because if i manually insert the
string into the db, and retrieve it it comes out all wierd
hi again, where can i find information on how to extend the
SimpleXMLElement class ?
i can't find info on the second constructor parameter
When spelling out sitemap. Should it be Site Map, Site-Map, or
Sitemap?
Everyone does it different
Er, differently
site map
and if it's a title, you'd title case it as "Site Map"
Thats what i figured, was just curious
how do I define a constant in php 5?
mrmowgli, define('FOO', '3); echo FOO;
Thank you abstrakt
mrmowgli, erm, missing a ' there, but you get the
picture
yep
what's one of the more popular php frameworks?
is the SimpleXMLElement class extendable ??
Fatal error: Cannot override final method
SimpleXMLElement::__construct()
Nope .. because it's ... final
"PHP 5 introduces the final keyword, which prevents child classes
from overriding a method by prefixing the definition with final. If
the class itself is being defined final then it cannot be
extended."
so i can't just overwrite the constructor
but i can add methods or ?
Nope, it's declared as final.
It depends if the class itself is declared as final or not.
how would i go about taking a text string with random text
and email address in it and echoing out only the email
addresses
woah unusually dead in here
whats that code to set the base directory in php
*function
like so if you hvae includes itll have the base directory as
whatever u set it to
i dont know if base directory if the right term, i hope someone
understands what i mean though.
ah nvm foudn it
bye
if i use extend the exception class for my error output, do i
need the set_error_handler function anymore ?
no actually i didn't haha
could anyone help me out
dirname(__FILE__) ?
VPS linux server
hmm
I want to rent a VPS linux server
you're looking for a provider?
is the set_error_handler function necessary if i use exceptions
in php5 ?
and can that be changed rocketmagnet?
yes, if you want to catch E_NOTICE, E_WARNING etc...
yes , who can tell me which provider is better
ah ok
you could try the wiki over at http://linux-vserver.org/ - last I
checked they had a list of providers
so the the error handler AND the exceptions are going to get
logged
thanks very much
that's just the path of you script
hmm
you must copy it to change it
you can add an include path
for include()
hi
?
ok actually i think i need to do something else. like when i go
to http://www.cristelmedia.com/mscript/index
and thats different from when I go to http://www.cristelmedia.com/mscript/index/
its because the second one is thinking its a directory im guessing
and not picking up the css file from the above directory.
do you know any IDC/ISP provide linux VPS ?
I guess I could just use absolute urls
I'm from little old new zealand
there's about one host over here providing vps as far as I
remember
i like new zealand ..
heh
but i thought i did it before, where there was a way to
change the directory it is looking for files in.
but i can not move to there
working directory, i think that might be what its called
immigrate; migrate
nz is nice, I like it here
ah chdir, thats it!
is there a constant which holds the value of php extensions
for an apache / php set up?
i know
share memory ?
huh?
do you want to hold value of php ?
i read in my php book a constant variable which holds the
value of php extensions
er
by php extension, i mean the file extension
not a php extension as in module lol or .so file
such as, include $secure_section . PHP_EXTENSION;
type of thing
apache_setenv () ?
i read there was one already set, never mind, i'll find
it
Warning: session_start() [function.session-start]: Cannot send
session cookie - headers already sent
it means that session_start has been called after output to
the browser has begun
why would that happern?
any ideas with my regex, i'm trying to itterate over all matches
for emails in this string, its working, however the end of the
email gets cut off for some reasons, such as .com .net and
.whatever are missing, here is the paste bin for the code: http://pastebin.com/m7f2edc72
and here is the paste bin for the out puthttp://pastebin.com/m7c754b8a
waawaamilko is it possile that that will occur if you have a
load of mark-up bofre it?
the markup before it would have triggered the headers to be
sent, yes
how far can we go in trusting HTTP_REFERER? and are there any
better way to track referrals ?
uhow far can we go in trusting HTTP_REFERER? and are there any
better way to track referrals ?/u
uuhow far can we go in trusting HTTP_REFERER? and are there any
better way to track referrals ?/u/u
don't trust it for any kind of authentication
it's really purely informational
waawaamilk, not for authentication for sure but I need to track
referrals and actually count valid referrals only.
well
you get the site that is linking to you to have their links not as
http://yoursite.com/
but as out.php?site=1
which calls in.php?referring_site=theirsite on your server
then that script updates the db etc, and redirects them to your
homepage or whatever
you can't stop people hitting your in.php?referring_site=theirsite
directly of course
it's probably next to impossible to make a foolproof referrer
checking mechanism, but you can get "reasonably close"
depends on how much you trust the referring site etc...
this is making me go crazy why would this regex not take the
last part of the email its the RFC on
i've got an app that uses session stuff. i've added a form
that does a post, and whenever i submit the form, the session info
seems to go wacky. do i need to do something special with forms if
i'm using sessions?
are you calling the session up when you load the script to
handle your form
you mean doing a session_start()?
sup
not much
lol, woot
can anyone help me on this, i have a string with mixed text
and email address, i need to put all those emails into an
array
preg_match_all is your friend
agreed!
quick, learn regex!
but i'm doing that
what regex are you using
my problem is it isn't grabbing the last part of the email like
the .com and crap
i'm using the only one that works, the RFC
you're looking for a non alfa char
i mean, what's your expression
alpha*
http://pastebin.com/m7f2edc72
http://pastebin.com/m7c754b8a
DO NOT use pastebin.com
holy crap, what is that regex
its the rfc
the "politcally correct"
one
what?
jesus
btw, its the ONLY regex i can get to work for this
why not use pastebin.com
No idea, but some days ago they said not to use it.
Wasn't paying attention.
so, that huge expression?
i won't even start to try to comprehend that regex
yeah seriously
that has to be a joke
well no OTHER regex works
give me one i'll try it
i think
that you are wrong
that btw again is the RFC REGEX
complies with the RFC
so i'm thinking that maybe there's an easier way of doing it
though
than a 5mb expression to look for emails
what exactly are you looking for?
faisal_d look at the var called data i need to generate an
array that contains only the email address out of that
string
an email isn't that hard to regexpr
it's different to validate one then it is to read one
it's basically . - and words w/o spaces before and after a
@
well since my text in my string is very simple the regex
therefore can be simple to i guess
but i can't get even basic ones to match!
it's something like..
^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+(
[a-zA-Z0-9\._-] +)+$
well
i'll try this one
i just put it in replace right?
well yeah?
dunnow if it works though
haven't tested it
so i'm going to use it like this
preg_match_all('/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+$/',
$data, $matches, PREG_PATTERN_ORDER);
right?
don't ask for everything, just try it and go flat on your face
when it goes wrong
most of the time regex make you think harder then actually
needed
i've always thought it was measure twice cut once
hi guys
did anyone had luck with using APC on windows ?
well it works and it doesn't work
...
;-)
it gets a single email address if the string is just like
data = "bob@bob.com"; but one with other stuff in it doesnt'
work
i think the regex matches "bob@bob.com" but not "bob@bob.com "
notice the space afterwards
i think its the thingamajiggers in the beginning and end
yup
its your damn thingamajiggers
the ^ and the $
thanks though!
i managed to get networking on linux, and i'm still back on
windows
the space shouldn't be in your email adress; so thats quite
correct
is there a way to declare a class const after the constructor
?
or inside ??
what would be the easist way to loop through an array as in
for each entry an in array run this function on that
varible
i thought foreach was but i'm getting a error with it
&$value){ $value = strtolower($value); } ?
hmm
$array = array_map('strtolower', $array); to run a function on
each value
if the keys are numeric, array_map( 'strtolower', $foo -- never
mind
XD
use something like for($i=0; $count($ar); %i++) { do stuff
here}
what if it's a hash?
for(; type loops are more work than they're worth
:P
so i implemented a __toString() function on my class. Thus,
if I reference $this in a string context, it should automatically
execute that function. but it doesnt. anyone know why?
$this passes magic functions i think
magic?
__get __set __tostring etc.
well alternatively, if i have $var = new Class(); then echo
$var; should call __toString
or maybe i got confused when i was dealing with privates in
__get
that above would work
except that it doesnt.
are you on php5?
it outputs "Object id #12"
yes
is __toString public?
yes.
can someone help me with my xmlrpc script?
then i see no reason why it wouldnt work
pastebin the code?
TehSausage, me?
nay
k
its just public function __toString() { return $this-getID();
}
YES!! idea, time to program
'llo
any suggestions are welcome.
well that line is perfecly valid, so i can't suggest
anything
array( 'param2', 'complement2') ) ); // how can i access to
'param', 'param2', 'complement', 'complement2' with $field
?
is it possible to unset defined constants ?
no
change the value
rofl
nvm, brb getting more coffee
thats why it's a "constant" not a "variable"
I'm building an app that frequently connects to other
servers, and I've got fsockopen() calls all over the place. Should
I bother keeping a centralised realtime log of the number of open
connections to each server? I could make up to a hundred
connections a second to a single server and I don't want to
accidentally DoS someone.
try to avoid using constants
foreach($field as $f) { echo $f['first']; }
whats wrong with constants?
theyre good if you use them right
I love constants
[Draicone], that's why you test it at home first!
your $field = isnt right... you have $field = array(),
array();
perfect to identify and for read-only stuff
constants have this strange tendency to morph into variables
over time ;-)
test it at home? he's asking if he should keep a log so he
doesnt accidenty DoS someone
[Draicone]: what is your application doing that requires such
connections?
hum
TehSausage, keeping a log won't change that fact
unless it's sending alot of data, it probably won't affect
them
array( 'param2', 'complement2') ) ); =
TehSausage, you don't know, that's why you test it on your
own server first
yes it can, you can pause for a second or 2 if theres 10 or
so connections in the last 5 seconds
and find people who are trying to abuse it
TehSausage, that's not done with a log.
you need $field = array( array(1), array(2) )
your parens are wrong.
it's still a log
[Draicone]: I'm wondering what would make hundreds of
connections to a single server
TehSausage, the latter might be helped with a log
okay a list of connections made in order with a
timestamp
[Draicone]: I can't think of any system that would require
that
definately not a log though _
TehSausage, that's a log
stop contradicting yourself
TehSausage, I'm not
yes you are
girls, don't bitchfight please, it's still early
TehSausage, he should not accidentally dos people, so he
should test his software on his own server
there's no way to use indexing in a multi-dimentionnal array so
?
if you make one, there is
he's not saying it's an error if it does 100 connections per
second
he means the script could if it was used enough
i dont care about your question, your $field = will NOT run, it
will fail with an error.
so fix your code first, then ask your question.
nope
there's no errors
error_reporting( E_ALL | E_STRICT ); -- wanna bet ?
... you shouldnt be able to assign 2 comma-separated values
to a variable that aren't in array notation.
dun think that it's a copy paste, just a typo in his
example
$foo = "hello,there"; ???
Djoobstil, your parens are kinda odd though :-)
perhaps Dynom
yes but you cant do $foo = "hello","there";
[Draicone], well, if you do want to do logging, centralising
the log code won't hurt anyway
oh that's what you mean
[Draicone], but do also test on some of your own servers
first
his example has $foo = array(), array(); :-p
/msg helpserv
oops
anyway
sleep for me
laters
LJHarb http://rafb.net/p/ACCl7n30.html
thats exactly what he said btw
that code is fine Djoobstil. in your example,
$field['mshost'][1] == '127.0.0.1'
if you alter your pastebinned code, you could use
$field['mshost'
$field['mshost']['Hostname:'] for example
Parsing Error: parse error (line 2)
read it again
oh pastebin code -_-
yes, but i would like to make it dynamic, like using
$fields[0][0] (if i change keys or, add one, ...)
man I'm soo still sleeping
is it possible first ?
why are you using an array key Djoobstil then? keys are
supposed to make it dynamic, in case your array is in another
order.
thats why you key arrays, and DNS computers, and so forth.
cause dunno how to make it in another way
$field = array('127.0.0.1','timwol','',3306,''); then $field[0]
= host, $field[3] = port. for example.
array('title'='Hostname :', 'value'='127.0.0.1'), .. );
$fields['mshost']['title'] == 'Hostname :';
$fields['mshost']['value'] == '127.0.0.1';
but its better design to use keys.
that works too.
yes, that work for one entry
if you plan on changing the $fields var that much, why not make
it a class?
if you plan on changing the $fields var that much, why not make
it a class?
lol
a machine thats pretending to be localhost?
a machine to which no traffic can be routed by name
crazy machine~~~~~~~~
cause i tried to, but dunno how to make an array with a
class
I don't think you can use it as a hostname tbh
this is for DB connection params, right? theres never really
gonna be a different set of parameters for that... its always the
same 5 value types. so why not just make a keyed array?
sure you can
that sounds weird
cause learning how to make it in that way can learn me a
lot
hmm, didn't think you could make a hostname with toplevel as
'1'
Keeping a special log just of open connections would take a
fair bit of code and some server load (as each of these connections
will barely last a few seconds), so I'd rather not implement it if
I don't have to
root@lucid.pin21.com:/root 0 #hostname 127.0.0.1
you can't register a domainname called '1'
root@127.0.0.1:/root
Analysing content on websites
The system analyses content on websites
why did i never notice that before Call to private method
xx::xx() from context ''
Its kind of a premium website monitoring thing for black hat
SEOs
(And grey hats, and all the wannabe webmasters too)
what flavour are you using?
[Draicone]: then why not make a tunnel and just request;
instead of making new connections all the time
analysing content on websites? data mining, ew.
what *nixes?
NetBSD will let me, althoug i'm not sure how far it will
go
The problem is all these people host multiple sites on a single
server and there's a 'scan all' function implemented that would
immediately hit all the sites
well you can set the hostname locally maybe, but I doubt
it'll work online
"scan all" wouldnt hit virtual hosts on a shared system - like
most are.
Because they have all sorts of different host names and IP
addresses, just they're hosted on the same server
LJHarb how would you make it with class ?
ofcourse it won't work online
Its not data mining, its website monitoring
[Draicone]: and it's not possible to write a deamon on the
server that listens on a cute port waiting for your request that
has a status report of all websites?
[Draicone]: thats what I would make if the situation allowes it
saves much traffic and hassle
No, it isn't possible, we have no control over the cilent
servers
hm
make a class of DB parameters, and provide accessors and
mutators for all desired information?
It would be great if it was an option, but its a web based
on-demand subscription service, we can't start asking people to run
daemons on their servers
hmm
nagios ftw
(-:
hmm /cheer my new pc is on it's way to be delivered
today
nice
mmmmm new box
I want new box
yeh
[Draicone]: ahm yeah, 'monitoring'
need to give it a nice spot
gonna build a server section on my attic I think
getting a bit crowded
Its more like content analysis, SEO-friendliness checking
etc.
rofl
Admittedly it is primarily a black-hat SEO tool
just leech the sitemap.xml
We need all the contents of all the pages on every site, plus
all the images and the content length of all the javascript and
css
sitemap.xml won't quite cover it
I don't quite see why you would want that tbh
[Draicone]: *shrug* everybody does that
money.
"intelligent optimization"
[Draicone]: I prefer "agressive optimization"
I know people who make tons of money in BH SEO. Not just for
themselves, but also for their customers
Yes, but this isn't just a simple web crawler I'm worried
about, there's a fair bit of connection testing and server analysis
going on and we don't drop the connection until about three
seconds. And "aggressive optimization" is far more accurate,
really
[Draicone]: I always wanted to write a powerful web crawler.
I went through three generations until I got bored with
it
This is kind of the ultimate black hat SEO tool. 194 reports
on everything from keyword density to SERPs to ad positioning
factors and even pagerank improval.
is q{ "agressive optimization" } equivilant to "just deleting
crap code"?
when I try to open a .phps file, my browser asks me to
download the file. if i do 'more index.php | /usr/bin/php' it
outputs the html i would expect.
I think its more like milking every extra cent out of adsense
and every extra backlink out of yahoobot.
i think its a problem with apache, any ideas?
You need to add a line to your htaccess file
!tell phrame about at
One sec, I'll figure out what it is. It basically registers
the phps file type as application/x-httpd-php-source or somethingl
ike that
AddType application/x-httpd-php-source .phps
!+tell phrame about at
Or am I too late?
wow cool thanks fyrestrtr
php-bot: botsnack
, fyrestrtr
I should do it in Lisp one d
[Draicone]: is it a.. commercial service?
ok now i see pretty color coded php script
Yes, it is, but its more like a private commercial
service
thats kind of neat. not what i wanted but neat
$89 a month and the only way to signup is via an invite
What does the bot say?
[Draicone]: ah, community forums etc
!+tell [Draicone] about at
no, just !tell
or you can /msg the bot and say the keyword
Ok then
Community forums..?
[Draicone]: 'via an invite'
Ah. The only place you'll find people offering invites to
strangers is the SEO conferences.
i did what the bot said. added the handlers to
httpd.conf
I can think of a highly placed forex person who would be
interested
is there an AddType as well? it only said AddHandler
Yes, there is, check my previous message
Ironically I was attending web directions when someone offered /me/
an invite =P
I thanked them for being volunteer publicity reps and offered them
an invite generator =D
AddType application/x-httpd-php-source .phps
Hi! How would I go about changing all (\n) characters to
spaces?
str_replace
$str = str_replace("\n",'',$str);
ah excellent, thanks!
[Draicone], where did you learn PHP?
Taught myself from looking at sample scripts (I was
originally a C developer)
Hello all
why do .phps files start with an interpreter, #!/usr/bin/php
?
is it necessary?
hi - how do i fetch the value of a variable, given its
name?
what do you mean aum?
Got the hang of it after some trial and error. Why, is my
coding all wrong or something?
hi all
Phil4, if $fred has the value 'mary', how do I fetch the
value of $mary, given just $fred?
$$fred
ahh, ok
${$fred}
does that work for setting variables by name as well?
yes aum
thx heaps
np
hmmm
everytime I see a $ sign I get headaches
:P
money problems? :P
nah
php must give you migranes Liquid-Silence
just not used to coding php
doing C# daily and php
so its changing over between the lanaguages every 4 hours or
so
I'm doing a fread on a csv file and there exists aa pound
symbol on it that I'm searching for but it's coming up as an
unknown character
now, given the name of a function in $func, and an array of
values in $args, how do I invoke func with args?
ffs
character encoding ?
i'd expect fred is not multibyte safe
fread*
Phil4:
you have to see this request of my client
I do?
mail library which gives the functionality to understand
whether the receipent has opened the email or not.
If you're absolutely sure there's no bad characters in $func
and $args then construct a call and eval() it
lol
thats in a email
lol I dont know how I am going to do this
surely that's based upon a header in the e-mail sent to the
user
which the mail client must respond to
Something like eval($func.'('.implode(', ',$args).')');
yeah
I have procmail on my server strip out those headers
since they annoy me greatly
heh
whaaa...use call_user_func_array()
and then I will have to go read the headers in the mail box
that it replies too to check which users have read but what if the
user replies from a different email?
eh, I'm not too up with how smtp works Liquid-Silence
but I'd /guess/ the message ID would be sent back with it?
is there any way to not display the rest of the output of an
included file if a variable is true. without having an if statement
surrounding the content
no, Jezek.
mk
the question is how do you make a request read reciept in the
header
there's a few different possible header types
Liquid-Silence
How can i when i connect to a mysql database set the charset
to latin1 ?
Read-Receipt-To:
Disposition-Notification-To:
Return-Receipt-To:
those are the three I have procmail strip out on my server using
formail
I need to set either fopen or fread to read a file using
lang=en-gb
in retrospec I will still need to write a mailbox parser
now the stupid thing is
there's an awsome pear lib Liquid-Silence
I am developing on a windows boxen
oh, fun
and it is going to run on a unix box
it shouldn't matter
ah nm
since the pop3 and smtp protocol are the same, irrespective of
OS
err
Mail in PHP for Windows and Unix are not the same
Mace[work]: yeah but using a mail box is
of course not
you'd use sockets to get data from a pop3d
Liquid-Silence: Are you intending on coding your own version
of read-reciept or are you going to use the M$ Outlook
service?
Mace[work]: depends what mail client the user uses
Liquid-Silence: Easiest way is to include a blank image that
is called via a script. Basically - set up a .htaccess file which
converts all .jpg requests in a folder to .php ones and pass the
file name as part of a query string (this is mod_rewrite) - then
you have everything you need. Run the script, set the header() to
image/jpeg, output a blank image. Job done, avoid M$
completely.
most mail clients will respond to Read-Receipt-To
but they will usually prompt the user
however, Outlook will block images in mails unless they are
specifically allowed by the user
so http://youdomain.com/emailaddress_domain_com.jpg
would load an image, but "emailaddress_domain_com" should be passed
as a query string to file.php - you can then do your script to
notify of a read-reciept, then like i say, output the headers as
image/jpeg and output a blank jpeg image.
Can I store a password as a cookie or will this password be
readable by others when transfered between the client's computer
and server?
it'll be readable during transfer unless it's over https,
saul11
hmmm oke, thanks Phil4
saul11, but still encrypt it
the usual approach is to store a salted md5 hash of the
password in a cookie
was thinking about that indeed Phil4
although that's still subject to cookie stealing during
transit
but we must assume that the techs that run the internet's backbone
routers have better things to do than eff with our small sites
heh
or just don't store the password in a cookie
why store a password in a cookie?
beats me.
how else is it going to remember the login?
well i'd use sessions personally, but if you don't want that
you just need a piece of identifiable info in the
cookie.
store a unique_id alongside the password in the database then
when the user comes back check for that unique id - as well as
making sure the user comes from the same area and so on - don't
store the password!!!
god damn these oaks want insane stuff
storing just a simple userid/username is far too
insecure
base_64 it?
heh
most large systems store the userid and a hash of the password
in a cookie
base64 can be decoded, deffo don't store the username..
actually most use sessions
or store some kind of salted hash of both in one cookie
lmao
whatever
if ($_SESSION['username'] == 'admin') echo ""; // secure
most large systems store the userid and a hash of the password
in a cookie
you should be lynched for saying that
MikeSeth, what is wrong with that?
what would you store?
sessions only run the risk of getting hacked by the server
admins
everything
everything?
do you understand persistence?
theres nothing really bad about sending the username/password in
a cookie, it's the same data you send on login
that's my thinking TehSausage
you can store wtf ever you like
i don't see how a hashed password is any different than say a
unique ID (except the unique ID wouldn't give a potential attacker
useful information)
but, if the DB gets hacked or the user's cookies get
stolen
you can change the id if it's not generated well enough
you should not set the password in a cookie!
cookie injection can still be used to fake a login
geez
incredibly unsafe...
no it isn't
yes it is
you send the password when you login
if two people are using the computer
Yes it is
then one person can read the other person's cookies
thats why theres logout buttons
for a _start_
for public terminals
that is so insanely wrong
waawaamilk, why would they want to?
the cookie will let them wander in to the site without login
anyway
if theyre using your computer, most people have auto-login
anyway
because I'm $evil and he's $good and he logs into
$banking_site and I want his money
why do other developers always want to have 6 hour freaking
long skype chats with me
then tell him to gtfo your computer
yeah but that's just the start
the only difference is a hashed version of your password is
send every request, instead of just plaintext once
and slightly more bandwidth usage
okay, ignore bandwidth
nobody cares
i do =\
I've never heard so much naive nonsense in this room
what would you store in the cookie waawaamilk?
you seriously, _seriously_ need to read a security
book...
lets keep all our images bitmaps while we're at it
I'm intrigued of a better way to do it
noone caresa bout bandwidth
without compromising security
the "better way" gives very little advantage
rubbish
what is the "better way"?
if you're serious about security, you start with https
they have yet to give 1 good excuse why username/password
hash cookies are bad
because you're sending it every request, to every page
and you send it when you login
in plaintext usually
so what would you send waawaamilk?
if you send a session id, that can be stolen too
you give the user a session id
at least a session id is only valid for a session
passwords are _always_ valid!
lol
my sessions are still alive after 2 years
people are lazy
the 'better' way to do it is to authorize with https, and
carry around an abstract, non-reversible security token that
identifies a session
you can expire sessions for people
people don't want to have to login again at the end of each
session
sessions can last two weeks
can I pm?
they don't have to last a session
yes Liquid-Silence
(browser session that is)
whew
You have to assume that the users computer is an open book
ready to be read by anyone. You do realise cookie's are only stored
as temp files on the users computer? They aren't encrypted,
protected, or even hidden. They're just there. Doesn't that tell
you anything? You have to be careful and use data you control not
what can only be "reset" by some user once in a blue
moon..
I understand that Mace[work]
but why is a hashed form of a password any more use to someone
than say a unique user id
i'm sending my http request, now hack me
userid = 32674
password = 8c5b72833693e9616bb563595f691c2e
oh wait, your in control of my network traffix
you already won
because you can authenticate with it?
you can use cookie injection with anything MikeSeth
session spoofing happens all the time
you know what
writing shitty code is not an excuse to write more shitty
code.
lol
why do people keep swearing today
remember Invision 1.3 Final?
carrying around [hashed] passwords on every request is mind
bogginbly stupid and borderline incompetent
there were so many exploits on that to allow password hashes
to be gotten from the database
I should be glad you are not my employees, and this is the end
of the discussion
so much for final :P
you let you're employees decide on security protocol? you must
be mad..
your*
nobody needed to crack them since you could inject them into
cookies to login
if it used a unique user id instead, that wouldn't have made a
blind bit of difference
that would have been gotten and used instead
Phil4, doesn't the exact same thing hold true if you store a
hashed password in a cookie?
your argument isn't saying anything
Mace[work]: well apparently the folks here don't agree on the
notion of a security protocol and even a need for one since
'everything can be hacked/spoofed/injected/owned/doused in gasoline
and set on fire"
it holds true whatever you store in a cookie Shrike|work
if someone steals your cookies, they can get into your
account
no, there are additional measures you can take on the
server
not if i don't use your web sites heh
imo, all a cookie should be used for is to associate a request
with a user
why does that make a difference Mace[work]
if I see you have a cookie header flying out of your PC destined
to thesiteidontuse.com
There are things you can do to be sure the person is who you
expected them to be..buy a book ffs..
and I really wanted to see what it was about, I could use
your cookie to login there
my god
someone should feed you people printed copies of Kerberos
tutorials
just so that you wake up and think on your own a little
lol
indeed
I'm not saying there aren't other more secure auth
mechanisms
paired keys, for example is massively more secure
well shut up then you're wrong
no, we are staying that
s/st/s/
but what I'm saying is, most sites store data in cookies
no, they don't
and unless they expire after your session, someone sitting at
your PC can get access to them
most large systems store the userid and a hash of the
password in a cookie
you should be lynched for saying that
no, they don't
he is right, you know.
please, what's next, phpbb as a prime example of how web security
should be done?
forum software isn't secure ffs
phpbb is shit
Phil4, as MikeSeth just said, shitty code is not a good
reason to write more shitty code :p
-_-
I'm not debating whether it's shit or not
we're telling you it is
it is an example of data being stored in cookies
and I daresay that we have more experience in these
matters
have you ever heard of the notion of security by
obscurity?
yes
well, storing a password in a cookie is just that
not really
it's pretty plain and simple that the password is in the cookie
nothing obscure about that
that is not what term means
this is crazy
what is Liquid-Silence?
it is an example of BAD FRIGGING IDEA, which you for some reason
take for awesome
did you know that phpbb has security history longer than that of
sendmail? did you know that merely a year ago, someone wrote a
trojan that exploited a hole in phpbb and wiped phpbb forums in
THOUSANDS?
did you know, there is a #phpc ?
If anything, phpbb is /not/ a role model
please educate me on a more secure way to stay logged into a
site MikeSeth, and I will try to use it in the future
That's more like it.
Now, I suggest you read first into the theory. When you are
implementing security, you need to be very clear about what is it
that you're guarding, what is considered safe and what
unsafe.
when you log in, you send a username and password. The server
gives you back a random hash associated with your session. That is
sent each request you make. The password is never stored on the
user's hard drive. The session can be expired by the user logging
out
uwhen you log in, you send a username and password. The server
gives you back a random hash associated with your session. That is
sent each request you make. The password is never stored on the
user's hard drive. The session can be expired by the user logging
out/u
sessions can be bound by IP
well yes, I'm simplifying a bit
sessions don't have to correspond to login sessions either for
examples
s/s$//
IP-restricting is a bit limiting for poor aol suckers
indeed
I wish someone carpetbombed their dumbass WAN
people's IPs will change
then again, you can use geoip e.g. maxmind to relax
restrictions on AOL users
regenerating the session ID every once in a while is the way
to go, particularly when a priviledge change is
involved.
it's a subjective policy wwhich might be needed in some
places and not others.
allowing any AOL user to steal another AOL users session ID and
login?
sigh
ip binding isn't the be-all and end-all as you can see
nobody here is suggesting you do that instead, just that it's
one possible strategy
indeed
I've always seen sessions as a temp thing
and a darn sight less stupid than sending the password in a
cookie
when the user logs out, under the password-in-a-cookie scheme, what
happens to their cookie?
There is no completely fail-proof solution. But there are much
better ways of securing an application than storing a username
password hash of a users account on their computer!
This conversation started when I asked why on earth you'd store
a hash'ed password on a users computer and now you're questioning
the logic of IP security specifically for AOL users. I do believe
you're a converted man!!
I'm not converted
cookies can be bound to IPs also
I've always seen sessions as a temp thing
is that not true?
i.e. the expire when the browser is closed
+y
not always
oh well, I have to head off
thanks for kind of educating and lots of "flaming"
it's been fun
Sorry if you feel that way
lol
You're just wrong.
I've been on IRC way too long to take offence to people who
flame rather than educate
:P
so perl is wrong because i think php is better?
that's the one TehSausage
perl is just wrong
nice talking with y'all
true rofl
can you check your pm?
oops, sorry
Is there some library for text fitting in the GD package? For
example if i have a 400x100 png and whant to append text to it is
there some function that takes care of fitting the text to the
image?
I'm certain there is.
theres an example on the imagecreate page i think
which is just text
ah birde ingilizce bilsem
TehSausage, i would like a function that appends a \NL to the
text if the text is near the edge of the image (eg. width of the
image)
php.net/gd - List of gd functions and tons of text functions
on it
bphp.net/gd - List of gd functions and tons of text functions on
it/b
hi, how can i enable Shockwave Flash Functions in php5?
theres flash functions? XD
ick
yes
with libswf module
oh yeah, theres ming aswell
marek82 - take a look - http://www.phpbuilder.com/manual/en/ref.swf.php
yea
got i wkring
tkx
with ming
np
is there a function to remove an element from an array?
unset()
will that move all the other elements down?
if my browser is downloading my script instead of parsing it,
what's more than likely wrong with my config file ?
no
loop over the array with foreach, then you don't have to
worry about the indexes
ksort() will resort the keys
or $array = array_values($array);
ok, thanks
most of the array functions mess up ^H^H^H^H^H^H reorder your
keys
:P
is @func() "recursive"
function x(){y()} @x(); == @y() ?
what are you talking about?
if i call a function with @ is the functions that function
calls have error_reporting 0 aswell?
it would only be recursive if function y() { x() }
i don't know if it changes the error_reporting internally, i
think it just discards the messages
it does
ini_get('error_reporting') returns 0 in my error handler
oh well, lets see if it works
i love that ini settings are changed so dynamically in
php
:P
hi!
does text-align in css align only text or other elemetns
too?
=\
YEAH LETS TALK ABOUT CSS
whoa geez
calm down
it aligns other things too
try #css people on ##php mostly know about php
i'm not even sure about that
i think you have to use margins yourself to center a div
it i have an array like array('foo', 'bar') an an other like
array('beer', 'whine') who can i make those to an array like,
array('foo'='beer', 'bar'='whine')?
thanks folks
you'd have to do it by hand, iterating over both arrays at the
same time
foreach ($array1 as $index=$value) {
$arrayfinal[$value]=$array2[$index]; }
thanks!
uh... it works ?
surprised -_-
my code never uses to work at first try
array_combine() too if you're using PHP5
nice note, MarkL, didn't know about that
count how many str* and array_* functions there are in php,
you'll probably get a 3 digit number
bcount how many str* and array_* functions there are in php,
you'll probably get a 3 digit number/b
that's because most of them are duplicates of other
functions
is there any mod function in php which converts a negative
number into positive?
abs()
thnx
please tell me i was right
rarely use the math functions
$foo *= $foo 0 ? -1 : 1;
TehSausage, you were right, abs() is the function i was looking
for
an other question, if i have an array('test', 'foo', 'bar') and
i want to make an array from that to be like; $arr[test][foo][baar]
= "string"? now i use a loop making "[test][foo][baar]" to a string
an run eval($myarray."[test][foo][baar] = 'value'")
M_2_SQRTPI =\ is it really necessary to have a constant for
that
you have to do it recursively
you know array size ?
hmm, and that meens?
well that wasnt the error i was expecting XD
$arrayfinal[$$array1[0],$$array1[1],$$array1[2]]="String";
it's a programming concept... a function calls itself on a
subset of the problem, until it reaches a solution
no its not always 3 leveld
then you need to do some pretty old good recursion
ah, okay
okay, used it for a treemenu once
should php be segfaulting because of infinite recursion? (the
infinite recursion is my fault, but I wasn't expecting to get
segfaults because of it)
I've seen it do so before...
the apache child segfaults
ok, that's what was happening
so should it? probably not , but does it? yes
i have seen that using some gd functions sometimes
in combination with phpeaccelerator
hmm, error_reporting() is still returning 8192
a very rare bug i reported to php.net
why is that a problem?
because i want to not give a giant error box if it can't find
the update server
it's probably because it's part of the hook system
and it goes through about 2 or 3 other functions
this means... block deeper i guess
nope, that guy lied when he said it was possible to tell if you
used @ with set_error_handler
so, @ doesn't set error_reporting at all, did it?
and you, in turn, lied to me
Can anyone tell me what the 'mysqli version' of mysql_num_rows
is?
some guy lied to win an argument with me i guess XD
@ just hide a single error for the user in a single
function
i thought i tested it though
if that "function" is include ... it hides all the errors
through the whole script
sure
don't know, but pretty sure it does
it was a statement of fact.
http://php.net/manual/en/function.mysqli-num-rows.php
Oh lol, thanks xD
nope, it does set it
http://sausage.no-ip.org:88/error.php
returns Error_Blocked
so does calling another function which generates an error
okay error_reporting(0); beforehand still isnt detected something
is wrong XD
maybe it's a class thing
when you are working with cases, how you write it what it should
show when it's none of the cases?
the standard thing it should show
default:
default: ?
and also end with break?
php.net/switch
"A special case is the default case. This case matches anything
that wasn't matched by the other cases, and should be the last case
statement. For example:"
Hi there, how do I actually remove php completely from my
server? ie. remove everything thats compiled etc.. I installed php
from the source if that helps...
15 megs ... does this sound like a server issue or a PHP
issue?
See the 5th example on that manual page
post_max_size is set to 2mb default
change it in php.ini
Was that for me?
it was
cheers, I shall pass that on
anyone got any ideas for my "problem" then?
you could try make uninstall in the directory where you ran make
install
but I am just guessing
k
thats one option
lol
php.txt
and the php.txt is 1mb big
Check the install target in the Makefile and remove those
files or add an uninstall target in the Makefile to do it for
you.
look at the make file, for the install target, and see where
it puts things
k
joebrg, try locate /php instead
k thanks
how can i paste it to this site?
MarkL i can show you then
http://hashphp.org/pastebin.php
http://hashphp.org/pastebin.php?pid=23317
it gives a blank page
case 'about'
does that matter??
Yeah
no it doesnt
:P
Also put error_reporting(E_ALL); at the top of the page and
make sure display_errors are On
it still wont work
how i do that
The 'about' does matter .. you're just not seeing why it
matters ..
but it doesnt work
You are getting a blank page .. you need to see what's wrong, so
use error_reporting(E_ALL) and make sure display_errors are On, it
will then tell you what's wrong
And your quotes are all wrong too
print "div id="left"\n";
hi
but how i set display_errors on?
Either in your php.ini file or use ini_set('display_errors', 1);
at the top of the script
ok
now whats the quote problem ^^
Use single quotes on the outside in your particular case, echo
'div class="whatever"foo/div'."\n"; .. a few ways to do it, just
preference
yep
echo "div class=\"whatever\"foo/div\n"; is another
or use a template, and avoid quoting your html all
together
undefined index page
is the error
i dont have ?p anywhere
Related Topic:
1 Displaying news from all categories with settings only 1 important setting disable comments of one category