i want to just get the raw exact data from the post and then use it if i am going to use it in a mysql query i
mattmcc, right, but nothing in program files is in my path
it's a posix layer, so of course it's not going to let you execute cmd.exe commands unless you explicitly run that shell
err… not really running on unix
caffinated, i meant more like progams, nut builtins for cmd.exe
i installed mplayer for windows and couldn't run it from my bash shell
piss on that.
you would have to cd into the place it is instelled to.
fireflymantis, yeah, and thats jus tnot ok with me. because the place its installed to is too far away.
why you'd want to use mplayer is beyond me .. windows already does media fairly well.
whoever came up with the name "Program Files" should be shot
caffinated, i'm addicted to mplayer. I hate every other media player
progra~1
shudder
lol. yeah i hate that more than the full name
It's VLC and winamp for me when it comes media on wndows
yay totem.
Cool, that only took 9 minutes.
hey, nice
chanserv++
VLC is okay, but it never shows up on the right screen (I use tv-out_) and it gets all buggy when you try to open a file and the play is already open. you ahve to drag it between screens and resize it.
plus no other media player has the keyboard controls that mplayer does
Does anyone see something wrong with this code? http://pastebin.osuosl.org/2045
Attempting to use an array as a scalar?
bkero, you need to lose the $ before stuff un 4this-stuff
if ($thing) array_push($this-$stuff,$thing); should be if ($thing) array_push($this-stuff,$thing);
should be $this-stuff
o, so no second $
right
3
Syntactically valid, but not likely what you intended.
Danke
with the $ would be a variable variable reference
i didn't know that would work.,
does anyone have strong mod_rewrite-fu? I'm after a rule to translate /* to /vfs/* - assuming of course that it's not already /vfs/..
is anyone good with php/openssl bindings?
fireflymantis, is that how simplexml does those dynamic properties?
so if $foo == 'bar' then $this-$foo == $this-bar
actually i think that kind of works in the opposite way
Is there a way to make PHP not store large ints as X.XXXXXXXX EXX ?
Hahah.
http://pear.php.net/package/Math_BigInteger
what is this php webhosting thing for? fb?
Euler Project
Is there anyway I can use a variable to declare a variable name? like: $_POST['q'.$i] ?
hmm
$$?
i think thatll do it
hm
when you have is correct.
Xinil, that example you posted should work too
/s/when/what
what do you know about creating a mailserver?
Some
PM Me about it though.. this isn't the channel :p
well I am going to have questions about its operation with php anyway
ok…
ah, $key did work
dunno why, just thought it wouldn't work for sure
because when I validate someone and make them able to log into the site, it is supposed to send them an email allowing them to do so
Xinil, your example looks to me like it would obviously work, but php is capable of more surprising things than that for dynamic variable names.
Is there a mail server running already?
it lets them know they have been accepted on the team
mailserver? naw
not yet
WOOT Works great
thanks andre_pl
DARKGirl.. linux or windows?
OSX (Unix)
Uhh… lol
No idea
haha
its just the same as Linux, silly
if you're banning those mass join/quits they're just bots heheh
Its unix based, but the same applications won't run on it
DARKGirl, look into the PHP mail function
Should work fine though
sure they will
OSX (Unix) Lol. I wonder how much we're going to see OSX being called unix host now that its got the seal of approval. not that anything actually changed.
csc`: yep, they're bots which won't join/quit after i'm done
lals
what if those ip's are stolen from others :
It's just a perl script connected to a pool or tor proxies
so you're banning legitimated users from your channel
np
you just have to compile whatever application for OSX than Linux
Aww
Opps wrong indow
window
Having fun?
heh… so aqua data studio works, but it still doesn't solve the problem that I'm connecting to an mssql server to get data dumps…
Notice how everything starts with either "88" or "85" ?
wietz0r, you can't ban a whole subnet though :p
goddammit just blanket ban tor from the channel
hi
hi brenden
I have to Logins screens on my App, one is for admins, and the other one is for customers, when an admin logout of the app the customer session getlost…. anyone can help me??
is two, not "to"
omp arent you ruby
csc`: yeh
do if(array_key_exists($key, $array)) {} and if (isset($array[$key])) {} do the same thing?
NemesisD they are very similar, I would double check on the case of an initialized key pointing to a null value, because that should return true for array_key_exists, but it might return false for isset($array[$key])
hey there
hi guys i'm trying to learn how to hack php
ok chewy, i think ill go with isset in that case then
hack();
k
yeah thats what I would do
have an embarassing question
re logical operators in php i'm used to seeing && when doing a logical AND statement
was php made for people who can't understand perl?
however in Drupal I'm seeing a lot of & instead of &&
is there a difference?
&& is logical AND || is logical OR, & is bitwise AND, | is bitwise OR
not especially. an alternative, yes.
ahh bitwise that would explain it!
thanks chewy one of the items is indeed bitwise
why use perl if yyou dont have to… sure I can understand it, but that doesn't mean I want to deal with it.
eh.. perl is fun
perl IMHO
in fact, a lot of people in here can write perl, and just choose not to.
for web scripting definitely
btully np
NemesisD, I agree… i wont doubt the power of perl, but its just too nasty to look at.
perl is a lot more fun that php for one liners
yeah, if thats your idea of fun.
i prefer video games for my fun
'one liners' are generally not realistic.
well I do a lot of php -r one liners
and perl would make a lot of that easier
what about in an if statement you need to see if 3 things are true/set and only one is a bit
but then I would be writing perl code to generate php code and thats just too much of a head ache
if one of your goals when you code is to make things readable without 10 lines of comments, the 'one-liner' is usually not a good idea.
if ($foo && $bar && ($num & 32))
caffinated well I just use one liners for code generation, so its more of just quick hacks than never get looked at again
fair enough.
lets bash asp.net instead. I just found out that's one of my classes this year, and theres no php at all
ouch that sucks
if ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB && $item['path'] && _menu_item_is_accessible($mid)
) {
does that make sense?
i think its ridiculous. I understand forcing us to use .net for general desktop programming, because they want to make people know whats going to be used mainly in the workplace… but lets face it, ASP.net is a HUGE minority on the internet.
not giving them php experience is shooting them in the foot.
MENU_VISIBLE_IN_BREADCRUMB is the bit
the rest are either true or false
that looks alright, I would put parenthesis around the bitwise and
eh, any programmer should be able to pick up at least rudimentary php in a week or two.
but that seems fine
it's hardly complicated as far as languages go.
caffinated, yeah but in school, most of the people in my classes are idiots who need to be spoon-fed everything.
and they're the ones who will fail.
if they dont learn it in school, they wont learn it.
you mean if ($item['type'] & (MENU_VISIBLE_IN_BREADCRUMB) && $item['path'] && _menu_item_is_accessible($mid)
yeah php is pretty quick to learn because it lets you do whatever the hell you want, haha
?
you don't need to be concerned about them though. you only need to be concerned with you.
caffinated, i wish that was the case. but no. my school sucks and everyones stupid.
naw I mean if ( ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB) && $item['path']…
ahhh i see
thanks!
and if i need to add another item that is bit but i need to check that it is not set?
that way you're sure its doing bitwise and comparing item['type'] and MENU_VISIBLE_IN_BREADCRUMBS, rather than bitwise and between item['path'] and (MENU_ITEM_IS_ACCESSIBLE && item['path'])
just out of curiosity, for anyone who is in post-secondary school in the US, what are your computer courses like?
$item['type'] & MENU_VISIBLE_IN_BREADCRUMB ~ MENU_LOCAL_TASK)
?
I always forget the precedence tables so I like to make sure its not an issue
andre_pl absolute crap
I dropped out of comp sci and I just work full time now
Is there in PHP anything similar to "friend" keyword from C++?
btully you can add && !isset(NEW_BIT_ELEMENT)
nice
JaBoJa is friend similar to protected, or is more of a casual relationship
thanks SO much!
I have a php script that generates text files from a mysql database. The files are probably 20-60 kb in size each and about 5-15 files at a time. When this script is running, although only a few seconds, I cannot execute other php script on the server simultaneously?
yeah np
it blocks other requests and it shouldn't. the server is fast enough and with 4 gb ram…
Crytor well if you're doing a db dump then the db is locked
it allows to access protected members from methods of another class
chewy, I'm in college in canada and i'm pretty confident that i'm not going to learn a thing until at LEAST my last year.
check http://dev.mysql.com/doc/refman/5.0/en/table-locking.html
well, SELECT queries and file_put_contents - on selected fields from database. not a total dump
andre_pl ya know, I thought that too, then I started getting into the more advanced classes and it was just letdown after letdown
aha
I had an operating systems class where we did a fucking play for the dining philosphers problem
LOL
Crytor well as long as you're not locking the db, and you're on a multiuser os then you should be fine
chewy, my OS class was using VMWare to install windows, then we learned about some of the advanced control panel things, then we install sisoft sandra to inspect our hardware.
that was it
wow that sucks
MUTEX EXIT STAGE RIGHT
I'd love to see the script for that play.
chewy Totally. 10 assignments, every one of them was "Create a power point presentation with screenshots from your VM. showing the following 10 screens"
mattmcc lol
I think mysql locks the table anyway per default
andre_pl ahhh that sucks, we got to do a final project where we analyzed the VM of an os, so I did it on unix version 6.0, using my lion's book, so that was pretty cool, but there wasn't anything in the class I couldn't have done more effeciently and had a lot more fun, doing it outside of
class
Crytor you might be right, but I didn't think it locked it for selects
chewy, in my java class, we were supposed to be using linux hosting (just to give us a taste) but my teacher put it off ALL Year (i assume because he didn't know how to use it) and then he ended up just giving us a bonus 5% if we demonstrated hello world
running under linux.
LOL
the issue is that lets say you have long running query A. then along comes a update B. then there is another select C. B has to wait for A. and C won;t run if there are waiting updates (b)
(where A is a select of course_
)
I used linux all year for everything
but won't those queries be queued?
yes
but also I thought he said he was just doing a series of select statements
that should just take a min longer if hes doing selects and updates, but it shouldn't lock him out completely
with MyISAM, it often does
if A is a select and B is an update why would B have to wait for A to finish?
heh… time for some regex fun… gotta take an mssql create database dump and then convert it to mysql
because otherwide A's select could be corrupted
andre_pl because you can't have the update modifying rows while the select statement is running
caffinated see thats something I would probably write a one liner for, going from mssql to mysql
INNODB has row-level locking, and might solve your problem Crytor at the expense of a small loss in speed.
well I might make that an actual script in case I need to run that again, but that would be a fun one liner
erm, i would use an adapter pattern
does anyone know how to dynamically create div tags based on a list?
What type of list?
How about a loop?
well, i am supposed to read from a mysql database hosting a list of users that have asked to gain authorisation to log in
this is an administor-apprroved site
you cant just sign up with a username and password and expect to log in right there
foreach($users_needing_auth as $user) {echo "div$user/div"};
like that?
ah an echo?
facinating
yeah, that's kind of complex
well you could just kep adding to a string and then send it out all at once.
complex?
how so?
he's being sarcastic.
oh, lol
Nah, just echo it as you get it
well I will need some special stuff. I will need a checkbox to be added next to a userid to show what settings the users have on their accounts
DARKGirl, you can add all of that inside the loop
that is so cool
lol, pretty basic stuff.
I didnt realise echo was that powerful
its not echo.
its the foreach
echo just prints things
ah, I am familliar with foreach
ask Thecks
Nooo!
I am not an oracle
yes, you don't even support views
nonsense, youre a PB programmer just as I am
PB?
I don't support views?
Oracle does
aye, but its supposed to load all of the users in the database
I'm learning Zend framework… that uses the view model
I meant An Oracle… that mystic thing you go to for advice
PB = Pure Basic
i'm just being an ass. don't sweat it.
its a user managment system. it allows me to easily remove/modify users without having to resort to the damn console
http://www.evolt.org/article/Storing_form_array_data_to_MySQL_using_PHP/18/60222/
Take a look at that, it shows how to load all the data from MySQL into an array
And cycle through and output it
aye! thats something of what I was talking about!
Its more … untidy than the foreach example
its going to be a makeshift table though
But you get the idea
not a real one
just something I made myself
well, you can also do it directly in the result set loop
I do understsand the concept now, yes
it really depends on your code logic
DARKGirl, http://pastebin.ca/669698
pastebin is a nono
lol
why?
http://rafb.net/paste/
use that
because its slow
VERRY slow
i'm not gonna re-paste it.
eh, pastebin is fine. you're right, we were encouraging people to use other things in the past, but that's because it was taking like 3 minutes to render the page
it was just a simple example
i wont be able to see it then
its fine for me. not slow at all
improvements have been made since then
DARKGirl, it loads fine.
I tried it
its still loading
it almost never works for me
thats messed up. never had a problem here.
fast for me as well
it must be a netowrk problem
i was going to copy it to rafb but when I copied from pastebin it numbered the lines and made a mess of it.
don't feel like cleaning it up
ah good, you use mysql_fetch_assoc()
caffinated, imho only a moron wouldn't.
"Safari can't find the server."
who wants to refer to column names by a #?
i don't have to use my ##php user vodoo doll
yeah, I can never connect to that
it keeps timing out
caffinated well an adapter pattern would work, but then I would have to make that, and thats a little more complicated than I'm looking for, for two reasons, 1) This is just a table dump, so there is only 3 regex I need to parse the whole thing, and 2) if I made an adapter pattern that would
imply that I'm expecting to run into this again, and I really don't ever want to do this again
what can i say, i'm a sucker for punishment
haha
well at least I'm going to do this in a script rather than a one liner, I'm not trying to punish myself that much on a friday
someone in the community channel was making some joke about someone eating something, and representing it as object/method calls. I fixed the composition.
lol
caffinated, sounds like my C++ final project.
well, a lot of people here don't really understand object relationships too well.
which is fine i suppose, considering php's procedural nature
caffinated, strangely enough, when I started lto learn about OOP in java, i found it easier to apply the concepts to php than to java.
haha yeah because objects in java hosting are just annoying
likely because java is very strict.
php really allows you to get away with a lot. some would argue too much.
yeah I think php is too loose
I'll never agree to that. the looser the better!
But, that's what we've got ruby & python for.
eh… a loose language is nice, but its annoying when you don't have variable checking so typos create interesting little bugs
of course its nice being able to declare and increment a count variable inside of loops and conditionals
chewy, that's so rare though, I almost never mistype a variable name, and its just not worth all the hassle.
if that made any sense
yeah it did
well I would just like use strict for php
haha
chewy, I think theres something you can pass to error_reporting that's supposed to indicate possible misspelled variables.
in php5 oo you can force methods to accept only objects of a certain class
E_NOTICE
thats it
which is some kind of exception to the loosiness
Cahaan, I didn't know that, but I can't see how I would ever use it.
mm .. loosiness
Colbert-style programming.
Boolean operators that determine truthiness..
yes. it has an exceptional truthiness quality
well I don't use many objects, but I would like to at least have my variables checked that they have been declared
lol
That's great until you want to type hint a string or int.
hey is there some way i can use php to change my current link in my navbar?
yeah you should then create your own classes to encapsulate string, and int
byeah you should then create your own classes to encapsulate string, and int/b
which starts to be annoying
And eventually you'll have a nice Java class hierarchy…
Oh, wait, Zend's already working on that.
if i had a stick, i would poke you with it
see you click on the different links but it doesn't change because its reloading the new page in the middle iframe
carlolorenzetti.com
I don't mind
lol
eh, I would rather have ruby style objects that just allow you to add methods on the fly to predefined classes, than be able to make wrapper classes for primitives
class String { } … that is a little overboard i think
lol
Yeah, then you get a few third party libraries into the mix, and pretty soon you don't have the foggiest idea how a string behaves…
well it exists in Java, in C++, and a lot of other languages
well, yes, but it's a part of the standard library
sure it is
AND Those are "Strongly typed languages" php is not, and shouldn't be
mattmcc well I don't remember exactly how ruby does it, but I'm pretty sure you could keep the changes in the third party library isolated
that wouldn't be. worse, it would be in userland code
I agree andre_pl
I'm not trying to argue actually
Monkeypatching gives me the willies.
I don't know how ruby folks can like it so much.
so it is possible to do yes?
they are all crazy macbook users
and they like danger
method_missing magic really angers me some times. people abuse the hell out of it.
My Dad wants a MacBook for his next laptop.
clos, you're not making much sense. php can probably help you, but you need to know more than just that you want your links to change
tell him it's a trap.
I like it because then you don't have to makes functions to act on passed in values, but rather functions to operate on values
caffinated lol
andre i'm just starting to learn php and i think i need to echo back some html somehow
I find it a non-coincidence that he started thinking about getting one around the same time he started poking with Rails.
do you think OO in php webhosting can be interesting for some projects ?
if you go to the site you'll see what i mean
I've got a macbook and I love ruby, and my good buddy who is a ruby hacker also has a macbook
it's sort of hive-mind mentality i think.
i just need to change the current link
Silly humans.
Sorta like how everybody has a webcast now.
clos, if its loading in an iframe like that, then you probably need to use css & javascript to change it
Cahaan not really, because you're limited by the lack of state, however there is a pretty good book on design patterns in php 5, and you can do some cool stuff, but you are significantly limited in the useful of design patterns compared to most languages
After all, how are people supposed to learn about your software if they can't watch a movie?!
write a mac virus, and set it loose on the conference wifi.
that's right
We already know nobody reads documentation..
yeah i fugured i could do it with javascript, but i don't want to
i fugures i could do it with php
clos php can only change a page when it is refreshed. that page never refreshes
i see
well, the quality of most documentation is very poor until said project reaches a certain mass of followers.
most people don't like to write documentation. even fewer are good at it.
and since OO seems to change with every new version of PHP, I would think twice before using this paradigm
and then once you get the mass of followers you get the comment system that is php.net
Django's docs are pretty good, I'd say. However they made (imho) a critical error in making the default docs apply to the dev version, rather than the latest release.
Case in point, http://www.djangoproject.com/documentation/tutorial01/
caffinated psssh… write documentation? shiet I don't even like writing comments
my comments are usually commented-out echo's
A couple weeks ago, 'max_length' in trunk used to be maxlength (As it was in all released versions to date). It was changed for consistency, and to avoid confusion with the HTML attribute.
that's the ruby attitude too - if you need a comment, your code is too complicated.
Now, at the top of every docu page, it says "This document is for Django's SVN release" with links to the docs for the last two releases.
as a result, there is a lot of poorly documented "magic" ruby.
And yet when max_length was renamed, we literally got a dozen bug reports about it.
caffinated haha yeah seriously, ruby is all about breaking things down into so many small cases that if you try to comment it, you will more than double the code for thank chunk
"Your docs are wrong!"
hah
*for that chunk
wow I'm having issues typing today
well, it's good until you understand how much the community loves to metaprogram
it's quite fun to write documentation
its friday and I'm ready for the weekend, but I'm going to be here at work all day tomorrow
then simple-to-understand things become simple-to-understand-for-the-initiated
tools like doxygen can make it even more fun
caffinated yeah they tried to avoid doing shortcuts like perl so that it didn't have the initiation overhead
as with all languages though, the core group doesn't give a rats ass if you understand it or not
i hear it a lot at the conferences that people are afraid ruby will be "overrun by php users"
haha yeap, and they shouldn't beyond an extent, I mean they're the people who are using the language constantly, so they have the best idea of what it does and does not make sense to turn into shortcuts
caffinated haha yeah I could see that, because ruby on rails lets you knock out a lot of code very effeciently once you're used to it
so as ruby becomes more widely available I'm sure a lot of php users will switch over
well, also, if you go from rubyconf to railsconf, people at rubyconf have a disdain for the people at railsconf .. even though it's a lot of the same speakers
some hardcore eliltism there
caffinated really? I didn't realize there was hostility in the ruby community like that, as powerful as ruby on rails is I would have thought the ruby people would be all over it
"hey cool I can knock out badass MVC websites using ruby code.. sweet!"
well, people at rubyconf are interested in the language, and some see rails as a gateway to let idiots in.
I don't see why they wouldn't like having that tied into their language
caffinated well anytime a language gets to the point that you have really cool features that can be easily used, you get a certain amount of hype from people who actually know how to use it and love it, so then you get a lot of idiots switching over
thats just part of the internet tho, eventually you can't hold the idiots back
oh, it's just like linux power users wanting to keep linux complicated so the newbies don't pick it up.
it's kind of sad, actually
Every tier of society has to have another tier to look down on, to feel better about themselves.
what is a registered, but unused domain name worth? like if i want to make an offer on it?
person Y want item X to be popular enough that you can do it as your job, fulltime. but in the same token they don't want it so popular that idiots use it. however, that sort of adoption is in person Y's _best interest_
caffinated haha well I do agree with that to a certain extent, to be honest I don't really like the current state of linux distros, ubuntu rocks and has a lot of cool features, but its become bloated and unreliable, I'm not much of a fan of suse or redhat or mandrake, slack is cool but I would
rather just run freebsd, and my old distro of choice, debian, has been overshadowed by ubuntu, so there isn't really a distro I like that much right now
right. which is why there will be another one some time in the future to further add to the confusion.
I love fluxbox, and I played around with getting fluxbox working with ubuntu, but all of the cool ubuntu apps require tons of gnome or kde libraries, defeating the purpose of having a lightweight WM like fluxbox
i hate how fragmented linux is.
caffinated, it hates you too.
well, distros are i should say
:P
caffinated yeah no kidding, its becoming a serious issue
no its not.
distros? they sure are.
theres like 4 different MAIN Distros. and they're similar enough
to be honest, I've switched over to OSX with my macbook, and I use freebsd/openbsd for my servers now
hi aain
i swear, i've screwed up so many times on this batch i probably couldve done it manually by now
andre_pl they don't have many similarities, they all have different package management systems, they have different directory trees, they have different base applications, etc etc. Linux distros are getting farther and farther apart rather than becoming more standardized
similar enough to you.
extracting all images from a dll, renaming them in order, removing every 4 starting from 2, renaming them to (style)(color) then converting to transparent png
if they were "similar enough" i should just be able to install a package on any machine with minimal hassle using any packaging format i like.
what would you name a variable that stores either 'ASC' or 'DESC'?
caffinated, i can install rpms on debian, thats good enough for me
`cb, $sort_order
yeah, good enough for you
yeah but installing rpms on debian just makes me want to stab myself in the eye
I hate rpms, they are evil
order… hmmm
good enough
downloading and installing .exe's is worse. who wants to click through all that crap… and then having to google for your software and downloading it fro a wbe page.
thats so old shcool
to be honest I would rather download and install an exe than an rpm
ever use apt-get or yum ?
because at least the exe comes with everything it needs, shit rpms are just a trail of installing random rpms
apt-get install [package]
gg
yeah i'm not going to argue that rpms are total crap.
I love apt-get, I try to avoid yum as its slow and fills my screen up with downloaded header messages
they're terrible, but i'd still rather just have to type one or 2 commands to install something hten google, download, unzip etc.
`cb I'm just saying I hate rpms, you should use a package management system
but overall my favorite package management system is freebsd's ports tree
yeaaah, im not really interested in compiling and whatnot
I really liked gentoo
's portage
just got sick of compule times.
mac spoiled me D:
I have an array with a bunch of ID's in it. Is there a way I can run a query with the WHERE statement matching *ANY* of the ID's within that array?
¿?
lols
IN ()
`cb I like it for servers because then you are always right there to change the make files to what you need
implode to a comma sep string first
SELECT * FROM table_name WHERE id IN(2,4,5,,8,12,43);
err, ignore the double comma above
oh! nice… thanks guys
after the intel switch I love apple, my macbook is by far my favorite laptop I have ever used
exactly
Anybody know of any places that you can submit your database structure too and a database architect will take a look and give their feedback?
Is there a way to pull data from a pdf with a php script
yeah right here, but I charge $50 an hour
depends on the PDF
And I love my Vaio's keyboard that people keep thinking was an Apple thing, when Apple really just lifted the idea from the Vaio X505.
$50/hr is all?
chewy.. I'd be willing to pay that
`cb, What am I looking at for issues? What matters?
As long as you can guarentee it won't exceed X amount of hours
takes balls to buy a sony product now-a-days
run your queries with EXPLAIN too. helps you optimize the,
..the structure a bit
In PHP regexps, escaping just a space (and not any whitespace as with \s) is just backslash space, right?
Thecks well the amount of time it takes is completely dependent on the complexity of your db, but I can give you a rough estimate
`cb: Oh, hell no. I'll never buy a different brand laptop. My first Vaio lasted 5 years, I beat the crap out of it. Second one survived two liquid attacks before finally giving in.
Anyone use PHPGTK here?
`cb: They does not screw around when they build a solid product.
http://www.devshed.com/c/a/MySQL/MySQL-Optimization-part-1/2/
all i know is the last few dvd players, tvs, and other assorted stuff have been pretty crappy
i use it quite abit, but not enough to be able to help anyone
mattmcc, I believe they're one of the few companies that actually have a laptop factory too
`cb: Ah, yeah. That stuff is virtually a different company.
Can I specify character set for file functions (like require, fopen). I mean the charset that is used to encode file names, not the content. I ask because I've problem with filenames with non-ASCII letters (I use UTF-8 in my script, but filenames are [probably] encoded in windows
encoding).
Just play around with it or?
nah, just my apps end up sucking
craigbass1976 I had a buddy who parsed pdfs using ruby and he was able to get a text dump and regex the data out of pdfs that were locked, I don't remember what he was using to get the data out of the pdfs tho
Indeed. Gateways and HPs are all outsourced, iirc, along with most Dells.
All dells
:P, I was just wondering if it would be worth learning and playing around with it. Obviously I wouldn't be building any large scale app with it :-p
I was amused a couple years ago when Gateway & Dell had a line of laptop that were completely identical.
they might throw hard drives and more ram, but they dont' make anything
yeah, but it's 5mb and open source if you want to distribute it
These days they try harder to have slightly different offerings, so that you can't make apples-apples comparisons.
does anyone have a function that will strip all special characters from a variable?
ahh
because magic quotes is broken
the thing is
I probably won't learn it, most likely end up learning C++ or Python.
I only want/need letters and numbers from any input from the user anyway
special characters for HTML or for insertion into a SQL query or wat
DARKGirl, html_strip_special_chars I think
mattmcc, http://gen-x-pc.com/laptopmanu.htm
there is also a chart somewhere I saw of who buys from who
…are you sure that function is not broken?
because they told me that I would be better writing my own
html_strip_special_chars() is non-existant
right now I use "mysql_real_escape_string"
but they said that is not fool-proof
Damn/.
mysqL_real_escape_string is fine, so long as you check for magic_quotes first
otherwise you can get some nasty things like \\\\\\\\\\\\\\\\\\\\\\\\' appearing in your content
Heh
are you doing something like user registration?
thats right
and you awnt to restrict to like alphanumeric?
are there any special characters that are not dangerous?
ah… if you only want to allow certain characters, validate against regex
for passwords, just hash, and allow whatever characters they want
ctype_alnum checks for alphanumeric, returns true if yes, returns false if special characters.
http://us2.php.net/manual/en/function.ctype-alnum.php
oh, I dont strip the passwords, because they are immediately MD5'd
PHP-WTF: http://rafb.net/p/YDiIVc43.html
nice !
holy crap
heh that function is not really helpful because I am looking for something to strip the chars, not just check if something is there
oh ok. sorry.
please tell me what's wrong with this code? http://pastebin.ca/669727
DARKGirl what chars are you trying to strip?
if you strip, and do not warn, they will not be able to log in
its should be returning "img there" because the $_SESSION['profimg'] session is set
and you will be accused of releasing a broken product D:
`cb: haha, fnny
it's set to show img there if the session is NOT set.
well I am stripping any user input fields before I actually process them
stripping them of what?
doh! thanks
:P
that said, usernames can only be alpha-numeric
how can you validate them if you strip them beforehand?
what about preg_replace(array('a','b','c','etc'),array('','','','',''), $input)
How to get know which encoding filenames are in?
also, not sure if your a fan but, check out 'Terany Operator'.
never heard of it
= ? : ;
3
`cb: how? well they are not allowed to create usernames with special characters anyway
ternary yay!
yeah ternary operators are good times
so, if they try to create one, make it fail validation, so they can change it
except php is kind of weird when dealing with nested ternary operators
http://us2.php.net/operators.comparison
don't change it for them
do you mean ternary?
Magic quotes is not dependable and many shared hosting servers do not allow users to use ini_set
sorry, thought that's what i put :-p
i don't nest ternary in php
what does it do?
`cb: that is already in place
`cb yeah neither do I, I always have issues with it
i try not to nest ternary in anything really
so whats the problem?
http://us2.php.net/operators.comparison Check out the heading Ternary Operator
thanks
i was just wondering if thats all I needed
I like to use them in sprintfs when you don't want several levels of if statements
Im having real trouble with conditional tags, anyone see anything which looks wrong? http://www.nomorepasting.com/getpaste.php?pasteid=2985
…
does a session end when you close your browser window?
It usually does
you can specify the settings in php.ini
or using the session functions in php
by default I mean
default is kinda vague, depends on your distro's default settings
butt, usually yes
hehe you said butt
hehe
It was meant more of a but….
should have used …
distro?
butt distro… I like it!!!
distro refers to your distribution of linux. Many distributions come with php bundled by default and have their own settings
depends
hmmm
’cause I'm setting a session variable in a page that I haven't gone to yet, but its showing that variable form the previous session I was in
how do I delete a session variable then?
unset
the variable
it would be easier if it deleted when I closed my browser window….
wouldn't it?
so, set it
can I do that?
yes
go on…
you can do anything you put your mind to
lol
use google man
come on
why do I have to spoonfeed you
just google php + setting session properties
something along those lines
that is the purpose of a session
it carries over to pages you haven't gone to yet
if you have previous sessions, perhaps a call to session_destroy() might help you
thanks
closing the window won't do anything, you need to quit the browser
want to empty your session data, simply perform $_SESSION = array ();
yeah, also what sean` said
thanks
hmmm… anyone see why preg_match('/^CREATE TABLE (\[dbo\]\.)?\[([A-Za-z]+)\] \(/', $line, $matches) isn't matching CREATE TABLE [dbo].[CC] (
`cb, what if it's the last window of the browser :p
so if someone forgets to logout, it will clear the date
swimrr, if you forget to remove the session data, it will stay as long as its ment to be there
its failing on the [dbo].
sean`: if you are using Winblows, it quits
but not on mac
`cb, I stand corrected :p 50% at least
I can match create tables with the [dbo]. but I'm failing on any that have it
swimrr, assuming there isn't anything else that interferes, like emptying the local cookie data
hmmm
sorry it matches any without [dbo]. but it fails with them
eh
any ideas?
my regex method is the 'trial and error' method
hmmm - right now, if I log in as one user…then go to the site again, log in as user2 - it keeps some of the session data from user1
you aren't cleaning sessions on logout?
are you using cookies or session saving extensions / addons?
'cb - that's just it, what if they don't logout?
they just leave it there?
you know how users can be
session eventually timeout
oh….
okay
ok this is starting to irritate me, any ideas on this guys?
how long?
hmmm… anyone see why preg_match('/^CREATE TABLE (\[dbo\]\.)?\[([A-Za-z]+)\] \(/', $line, $matches) isn't matching CREATE TABLE [dbo].[CC] (
variable, depending upon server
you can set in php.ini iirc
thanks
or more specifically why (\[dbo\]\.) doesn't match [dbo].
it should match just fine
hehe yeah thats what I thought too, but I've got empirical evidence to the contrary
you've peaked my interest
Check your variable I guess.
piqued
I can match CREATE TABLEs without the [dbo]. but it fails on any that have it
chewy, whats up
why are you regex'ing on that string?
http://pastebin.ca/669748 - when I ran that on my localhost, it echo'd true.
I'm trying to use preg_match('/^CREATE TABLE (\[dbo\]\.)?\[([A-Za-z]+)\] \(/', $line, $matches)
why?
CREATE TABLE [dbo].[CC]
chewy, strpos ('create table [dbo]', $string)
JymmmEMC because I'm trying to write a converter from mssql create table sql files to mysql
oh, duh
sean` well the regex matches any create tables that don't have the [dbo]. in them
chewy, so.. your point?
You're telling me you can't achieve this with strpos?
strpos ($string, 'create table [dbo]') * mixed them up
I'm sure there is a lot of ways to do it, but a regex works just fine as long as I figure out whatever syntax error is there
chewy, it doesn't seem to work.. so why don't you go for the approach that will work 100%?
lol
silly
sometimes I wish PHP/RegEx were explosives…. one lil mistake and no more problems.
chewy, I'm not saying you should not investigate the error i fyou're interested, but why let it stop your work.. continue with your work and think about it some other day, maybe when your mind's a bit more clear
well first off, I like regex more than strpos, second off its more convenient, 3rd off it should work 100% of the time
lol @ jymmy
because I need this working right now
what Sean said
heh
then use string functions
try your hand at regex when you have learned how
!+mre
http://www.weitz.de/regex-coach/, or http://www.ilovejackdaniels.com/regular_expressions_cheat_sheet.png
heres the thing, I don't want to rewrite this using somethign less useful and less convenient because theres a stupid syntax error, thats a lame way of quiting
chewy, so.. I like a 100$ bill more than a 50$, but if you hand me 2 50's I'm not gonna say no cause they aren't 100's
hahahaha yeah you're right I don't know any regex
I think you don't know any regex if you're idea to fix that is to stop using regex and automatically assume I'm some random noob who knows nothing about regex
So you want to TRUST something that you are not 100% proficiant with?
yes as a matter of fact I do
chewy, we aren't assuming you're some random noob, nor are we assuming you don't know regex (however you just told us)
http://dev.ngisedesign.com/test.phps
chewy:
because I write regex all the time, and I would say I'm at least 72% regex proficient
We're just giving you a feasable and easy to integrate solution
…
FIGHT
Usaing regex as a "cure all" is not the right approach, lots of overhead, use the right tool for the job,no more, no less.
chewy, is your ego that big, that us helping you upsets you?
chewy, i think you are high, cuz it works fine on my box
I'm not looking for an alternative solution, I'm looking to know why the fuck (\[dbo\]\.) doesn't match [dbo]
chewy, watch the language -.-
Anyway, good luck, I've got better things to do
then stop trying to tell me I'm a noob regex tool trying to use a grenade to blow my foot off because I have a subtle error in my regex
this is a rather simple regex that isn't working
chewy, stop saying stuff that hasn't been said
if it was a subtle error and you know what you're doing, then why have you asked repeatly in here?
because I am not subtle today, I'm exhausted, overworked and I have to work tomorrow on my day off
you want to see some fun regex? :%s/\($this-\([a-z]\+\)Values.*\)\@=\($indexed\[[0-9]\+\]\) \/\*\([a-zA-Z0-9_]\+\*\)\*\//$this-getFeats(\3, '\4', '\2') \/*\4*\//g thats some vim regex I wrote this week
and your point is?
haha
DAMN, you've really got some issues
chewy use www.regexpal.com
http://dev.ngisedesign.com/test.php // http://dev.ngisedesign.com/test.phps
it's a great tool and helps with testing
nothing wrong w/ that regex
JymmmEMC I've already made my point, and my point being it doesn't work, but we're way past that now
There are more ways to rome, remember that
Does anyone see why this is returning 0? http://pasteosaurus.com/415
!+doesn't work
Look buddy, doesn't work is a strong statement. Does it sit on the couch all day? Does it want more money? Is it on IRC all the time? Please be specific! Examples of what doesn't work tend to help too. Finally, showing us the code is helpful (after you've explained your problem). /msg php-bot
pastebin for more information
JymmmEMC what have you contributed to this conversation? you've done nothing but tell me to rebuild what I've already built and that I don't know what I'm doing… you said what you've had to said and you keep reiterating that you're just trolling
because I've already said several times before that it failes on [dbo].
!+go
it doesn't
but whatever, I'll figure it out
[GO] Gross Overgeneralization. Everything that we tell you in ##PHP is what we consider "best practices". Of course, only YOU know your own requirements, so you may feel you need to do something we told you not to. Just don't say we didn't warn you.
lay off the pipe, sir
hey, thats a nice one
@ GO
hahah yes because OMG STAY AWAY FROM REGEX NOOB is your official best practice
chewy, who in here actually called you a noob?
using php native functions is good practice
JymmmEMC
I call em, as I see em.
haha yeah and you've established that you have 123/89 vision
get your eyes checked
chewy: So you want to TRUST something that you are not 100% proficiant with?
-.-
arguing about this issue won't solve your problem
yes because no one is 100% proficient with anything
you must realize you're in an IRC room and nobody's perfect
chewy, we are actually giving you a better, faster and easier way of achieving your goal..
so, let's try to solve your problem
ASnyde1, liar!
lol
what sean` said
and you can then decide to take our advice or not. That's your decision. But realize that you're coming into a room of strangers that are willing to help you.
Jymmm, wish me luck
it's best to not create enemies
hey guys what do you think of this idea? http://www.doctorrescue.com/
I just turned 21 and tonight's the night my work buddies take me out
I may not survive, but my IRC connection will
pregnant? (You, not your female half)
InuZ|afk thanks for the help, I know its matching on some, but not all of them
Ah, well congrats. GOT BAIL MONEY?
wtf…. is that english?
sorry
i forgot to update my nick
Jymmm, got bail money + my medical insurance card on me
sorry I'm not trying to be argumentative guys, I just got a little irritated when you guys told me my method is flawed, that I'm not the master regex master of the world, and that you're alternative solutions are strictly better despite the fact that you don't know what I'm trying to
accomplish
In an envelope in my pocket, labeled "In case of emergency, tear here"
lol\
chewy, you are trying to check if a string does NOT contain your string
you obviously dont want our help, so………
no no yoou can't bail yourself out, someone else has to
and we've given you a solution for that using strpos
one of the key things I'm using preg_match for is to get the matches array, because I'm not just checking the string, but I need to parse the string
Is it next to the Pocket Shot?
Oops
Yeah.. I have three priorities tonight, in order:
and I have several other working regexes covering the rest of the code
sean`: ^ at the beginning of a regex marks begnning of the astring
1) keep my clothes on 2) do not make passes at female (or male) co-workers 3) do not throw up all over the bar
`cb, I am not looking at the regex, but at what he said
ah
sean` no what I'm trying to do is parse every line of a file, divide it up into distinct cases that give me different data from each line so I can rebuild it
Bad Boys Bail Bonds - Because Your Mama Wants You Home 1-800-BAIL-OUT
http://www.badboysbailbonds.com/html/index.html
chewy, and what do you want to achieve with regex?
Expect to throw up, just also expect photos to be posted at work too
Julian|Work, YOUTUBE
Order a Cadillac Margarita, on the rocks, with salt
JymmmEMC, just drinjk 15 tequillas, works good fo rme
some mix-drinks, and the perfect night is almost there
sean` what do you mean? I'm using regex to classify each line and then pull the desired data out of that line
sean`: http://www.drinksmixer.com/drink7393.html
sean`: a href="http://www.drinksmixer.com/drink7393.html"http://www.drinksmixer.com/drink7393.html/a
Ok seriously…. Do NOT mix alcohol, stay with one type, run, vodka, tequilia, wine, etc. A beer in there is okey. Avoid eating sweets too.
chewy, and what do you want to extract from create table lines?
sean` bah I figured it out, give me 2 mins and I'll show you what I'm up to
good to hear
Jymmm, that's good advice, but may be hard, since people will be buying me drinks
I'll wear a shirt that says "VODKA ONLY" or something
2 asprin + a glass of milk before you begin.
Darker liquors and drinks that taste like candy will be particularly bad combinations.
And food. Eat stuff.
Yeah, I'm picking up some bready food on the way
heavy stuff, chili, burger, etc
mexican food will be the best
the hot sauce will sweat out the alcohol too
But the worst coming up, hah
Alright, it's time to go
HAPPY BIRTHDAY!!!
I'd say, have a good day and happy birthday Julian|Work
Thanks guys, take care
I'll report back one day
I'll watch the newspaper in the morning for ya
'one day' :p
!pastebin
Close enough
ok here you guys go
http://hashphp.org/pastebin?pid=27526
thats why I was using regex
so I'm curious if you guys still don't think regex was the viable solution for that
i am having a little trouble with escaping characters in php, I have a textarea which posts its contents to a php script which escapes it with the mysql_real_escape_string and then puts it in a database, another page then retrieves it with a SELECT mysql_query and then directly puts its value
inside a textarea
my problem is that a single quote will come out the other side as a \' in the textarea, what did I do wrong?
I think its getting escaped twice
often the server automatically does addslashes() and stripslashes() without you knowing
[fields], that was my thought too, but its not… i have checked so many times
gpc_magic_quotes is off?
I need some desperate help, can someone private chat me to help debug a PHP script?
either way, throw a stripslashes before outputting to your textarea and the problem is gone
[fields], just to clarify mysql_real_escape_string will only put one \ in front of a ' and that is not actually stored in the database, it just makes sure that the ' is stored in there right….? am I right?
sure
I don't know. I haven't needed to use mysql_real_escape_string
[fields], havent needed to use it? im curious how that is….
You REALLY don't want me to answer that.
I remember the days of php3 where I needed to addslashes() and stripslashes() on just about everything
JymmmEMC no actually I do, you have a more effecient method to perform that same task?
I'm having a bit of problem with this PHP script:
http://pastebin.com/m4056d0a0
Can anyone tell me how to make my server show the error message?
which one, ragon?
well, i really dont want to just strip out backslashes…. there has to be a reason for this, does mysql_query() or mysql_fetch_array() escape characters…?
never mind, it was set to report all error messages
Can anyone debug this script anyway? http://pastebin.com/m4056d0a0
on post it happens
Ragon_, if ($check != "FALSE"); is a bad statement
use if (!$check) or if ($check !== FALSE) instead
[fields], so posting data will escape it?
yep
err. use if (!$check) or if ($check == FALSE) instead
[fields], on the clientside or the serverside?…
serverside
thats why you're getting doubled
[fields], you're sure?
dude… test it for yourself for proof
[fields], so, is it php that does it or apache?…
I think its php
yeah, its php
[fields], just a general escaping… or one specifically for mysql?
every server I've used since 2001 automatically escapes post data
[fields], perhaps i should turn it off. ill look it up online, do you know if there is a name for this feature?
see, before that, you had to addslashes() to every single damn variable, oh that was time consuming
gpc_magic_quotes
i see
interesting
so, i really dont need to be using mysql_real_escape_string to all my input then….
exactly!
but if you must…
then use stripslashes() too
odd, i was just always taught to totally distrust input, but if php pre-escapes it then…
huh
you're gonna love it when magic quotes is removed
haha
It dies in PHP6
InuZ|afk, probably good
i cant wait
i'm using php5
you in france?
means you don't have to do stripslashes on all input at least
think I should disable it in php.ini then, i assume i can?
In the UK
magic quotes is a good thing. Its real annoying to addslashes() on all your input before putting in the database and stripslashes() on all your database queries/variables
but if you want to, have fun
reminds me of 1999
party like its 1999
technically, it's not. addslashes doesn't always do the same thing as mysql_real_function name I forget.. afaik anyway.
so depending on the DB type you're gonna use, you'd have to use stripslashes first anyway
mysql_real_escape_string
yeal, that thing. that function name bugs me I wish it'd just been mysql_hawt_escapage or something. oh wells.
InuZ|afk thanks for the help a while back, sorry I couldn't reply as I don't have a registered nick, so I can't send private messages
i dont understand stip slashes, why would I use that?
oh really? forgot about that. glad you got it all working anyway
yeah it was a stupid little error, I was missing an _ in one of my character classes
ah
i want to just get the raw exact data from the post, and then use it, if i am going to use it in a mysql query, i want to use mysql_real_escape_string before using it in the query, then when I retrieve the string, it should be exactly the way it was before the mysql_real_escape_string…
right?
but hey, now I have a script to convert mssql sql files into mysql sql files
_Quintus_ yes the data should come out of the db without the extra escapes
chewy, so it sounds like i want to disable gpc_magic_quotes in php.ini and then use it the way I have been using it, with mysql_real_escape_string… does that sound right?
Anyone know of a way to discover the tablename of a particular query from a mysqli_result object? Don't suppose it'd be possible, eh?
fieldnames yes.. table name.. don't think so
I'm not too sure, I haven't use magic quotes that much, but as long as you do any escapes before you run mysql_real_escape_string then mysql should handle it just fine
darn. thanks anyhow.
or sorry, if you _don't_ do any escapes, and only do mysql_real_escape_string you should get the data out fine, but if you escape it before mysql escape you'll get things like foo\\\\\\\\\'bar and that won't come out of the db properly
So… I guess it's not possible to override magic_quotes_gpc on a shared hosting server (not my own), am I right?
might be, htaccess php_flags I think it's called
Most likely not. You can simply undo its effects, however, with stripslashes and get_magic_quotes_gpc.
if you have permissions to change php.ini you can probably change it with ini_set
No, it's too late by the time ini_set is seen.
mattmcc so you can't change that on the fly?
you can override any of those server settings with .htaccess
From within a script? No.
Magic quotes has already been applied (If it's on) by the time your script is executed.
[fields]: how often does a hoster allow that, though?
I can try it, but I'm assuming my hoster won't allow such a thing.
mattmcc ahhh ok, yeah I haven't played with magic_quotes much, but I have used ini_set fairly often to change other ini settings
I don't see why a host would disallow .htaccess
Not htaccess in general, but allowing to edit php settings.
matmcc, chewy, ah ok. So stripslashes is used to just undo gpc_magic_quotes on servers where people dont have access to their php.ini, but for a dedicated machine its fine just to disable gpc_magic_quotes?
[fields] its pretty common to disallow both, or at least that you have to get htaccess enabled by your host
If you can disable it, by all means do so.
If you can't, then naturally you're stuck just undoing its effects.
if you run phpinfo() you'll see there's two columns, one server side (php.ini) the other is local (optional .htaccess modified)
mattmcc, ok, thanks for the help!
Is Perl a dependency for pHP?
PHP*
don't think so
Hm. FreeBSD ports seems to think so.
Why would it be?
Not sure.
B-deps: autoconf-2.59_3 autoconf-wrapper-20070404 libiconv-1.9.2_2 libxml2-2.6.29 m4-1.4.9 perl-5.8.8 pkg-config-0.22
Hm, magic_quotes_gpc says Off On now, but it still adds slashes. Does that mean it failed?
that would be funny if php runs all its pregs through perl
but if it did, then you would be able to do non fixed with lookbacks, so I don't know what perl is required for
s/with/width/
It'd make them more functional.. PCRE doesn't have quite everything.
yeah that would be helpful
What is the 'Suhosin protection system'?
Do you think its worth taking courses to get the qualification for Project management.. Its not a case of learning the stuff but getting the qualification.
Nevermind, got it.
http://www.freshports.org/security/php-suhosin
bloop
I'm building a newsletter sending system. When an admin clicks "Send," the PHP script will send to perhaps thousands of addresses… we want to send to a set number of addresses (say, 200), then sleep for two minutes so the server doesn't melt
how can I impliment this without having the user wait for the page to finish loading after the entire queue is run?
I was thinking I would fork another process and run it from there… but process working in web apps is bad
use a cron job
also make sure you don't send 200 message all at teh same time
in other words, put the messages in a queue then have a cron job process the queue?
how can I ensure I'm not sending 200 at a time? I guess I'd foreach through the queue and run mail() for each?
I think there is a sleep command
http://php.net/sleep
yes, I was going to use that… but you said not to send 200 at once, which is what I'm processing each iteration (after each sleep)
yea
well, what I was trying to say, don't try to send 200 mail messages as fast as possible
oh, yeah
also do a MX lookup for each domain and make sure you don't spam one mail server with 200 messages/minute
so you spread that a bit
ohh, good idea
fopen('./'$user'.txt', "a");
no
is that what the manual says?
No
fopen('/.'.$user.'.txt',"a");
Thank you
read about the concatentation operator
Sorry I am new to PHP
that's what the manual's for
php3333
why not fopen("/.{$user}.txt","a");
Not sure what path you are actually trying to use…
./myusername.txt
Thats the path
Why use files for users? MySql is the best 333
why is mysql if you can use files
Except I need to use txt files, my sistuation is a bit tricky
And now… Parse error: syntax error, unexpected T_STRING in register.php on line 28