rather long split
I'm sure he will shout at you for getting help
doesn't look like a once-in-a-lifetime rocket science code,
either
Yeah, I know, just being a little paranoid
AlexC_, _tfr_ is there another way?
depends on what you want to achieve
That's the easiest way
weird, I'm out of ideas
read a file's contents, but without using an external
prog
Cheers, that's the problem I've been having :P
file_get_contents reads the file contents without using an
external prog.
file_get_contents is a built in function
? you don't need to use an external program/extension
same here, it looks okay to me
but the usual debug method (at least for me) in this case is to
start cutting out code _before_ the error
or remove the buggy code just to check it is that causing
it
yes, i want another built in function that does the same
thing\
why?
what's wrong with file_get_contents ?
i dont get any syntax errors on my end
nothing i just want to know if there's another way
file()
In that case check the documentation for fopen() and
fread()
$var = explode("", file('filename'));
grrr, i hate not getting my regex's right,, trying to match
this list of country codes
will do the same thing as file_get_contents
there's file(), there's, fopen()/fread()/fclose(), there's
readfile()
i have country code then country name seperated by 5
whitespaces
er not explode, implode
Hmmm... that's everything but getKeys() commented out
now!
can enyone recomend any good pastebin sites?
pastebin.ca ?
move getKeys to the top of the class and rename it, or
something
paste2.org
you have something very odd going on, i dont get any syntax
errors on your file
is your php
hosting engine doing any script prepending?
Definately - I just moved the function and still get an error
on the same line
And no, it's not doing anything unusual other then setting an
include_path
comment out Config.php
just for some giggles
replace the entire file with echo 'foo';
hah yeah, that too
if it doesn't echo foo, then you're probably having a case of A)
Editing the wrong file, B) uploading to wrong directory without
noticing
Hmmm... good call, although I just edited the file on the
live server. Same error
bHmmm... good call, although I just edited the file on the live
server. Same error/b
http://rafb.net/p/mqYPgf82.html
- I got this little script to controll if the user is logged on or
not. Problem is when $_SESSION['verified']="no" I still get the
admin controls. any ideas?
but just make sure your editing the eight file... if you do
an echo, and it doesn't echo, and you get the same error... you
have the wrong file
i have a class users that extends another class, how can i pas
the arguments submitted to the new user object to the class that
user extends ?
on your load function, wouldn't that ${lang} be
${$lang}?
Bingo - my include_path was using an old config
hehe
Nope, ${lang} is just fine thanks
can anyone think of a disadvantage to having form fields named
the same as your database
host columns (for form submission)?
Woot! New error.
Thanks guys
nothing wrong with it, so long as you clean your data
first
figured that, just wanted to make sure there wasn't something
obvious I was missing
grr, ok, i'm trying to get a pattern match agains a list of
country codes and country names eg "ci Ivory Coast (Cote D'Ivoire)"
so i want the replace output to be "ci"="Ivory Coast (Cote
D'Ivoire)", the ci and Ivory are seperated by 5 spaces.. soo what I
have that works sort of so far is
^([a-z]{2,3})[\s]{5}([\w,\s{1}-]*)
I don't match the () or , or . or '
also have a carriage return problem
*blink*
WHY
there's a handle for that
do a XML parser first
run the start handler, then the data handler and the the end
handler?
handler for??
Well i'm trying to get the regex to work as I am in my editor so
trying to do a regex search and replace
handle. If the machine get's stuck, it will perform a
carriage return when you pull the handle
but I suppose if i parse the file with a little php script i
can just explode each line.. easier..
anyone here who can change the topic?
Why can't you use pastebin here? (Just out of question)
use pastebin.ca
pastebin.com is slow / dead
Right.
What happens If you were to use www.pastebin.com ?
Does that incur a channel ban?
'(\S+)\s+(.*)'
No, it just doesn't get anyone looking at your paste
Since many of us cannot reach it (browser times out)
arrgg, that's so bloody simple.. damn you!
:P
thanks though
I neeeed more regex practice
Counting is "hard" for an FA, so any time you can skip the
counting and write to the PATTERN, do it.
FA?
Finite Automata
oh.
"regex engine"
gotcha.
actaully what is simply the best example of an email host validation
script you've seen,, i was looking at one that's in Linux Journal
there last month.. quite good, based on someone elses (i think it
was from the ilikejackdaniels site) but added dns lookups to the A
and MX record for the domain
sorry, www.ilovejackdaniels.com
hey quick check.. its monday and my brain isnt fully
functional.. to grab the php mysql web hosting
AUTO_INCREMENT value of the last inserted query of a table..
mysql_insert_id correct? like mysql_query(insert into tbl); $id =
mysql_insert_id();
yep
thanks
correctamundo
happy monday
whats so happy about it.. i still have a headache from
saturday night...
hah,, doh.. I don't seem to do that anymore..
Havn't been drunk in a donkeys age
might well be 8 months since my last drunken state.
that one scared me sober
i realized this weekend im getting too old for this crap..
when you still hurt on monday, its time to hang your liver
up
Never seen myself that drunk before(there was a short video),
and never want to be that bad again..
hehe.. gotta hate the video evidence
there it is.... http://www.ilovejackdaniels.com/php/email-address-validation/
not for the first time, i'm a youtube star
i really dislike the drunks where you say somthing or do
something you are 100% sure youwill regret when you are
sober
:P
i stick to nice easy beer shandys at parties these days...
that way i don't get stupid
nice
yeh, saying things you regret the next day is baaad.. specially
when it's your girlfriend you say it to.
what's bcompiler?
well its bad if she is not your GF the next day
hi
speak you polish ?
i dont i can hardly speak english
and thats the only language i speak. man im worhtless
i have a problem (PHP). http://wklej.org/id/a4e8930360
| http://armageddon111.no-ip.org/homepage_armageddon/port.php.
why is double ?
i have a problem (PHP). a href="http://wklej.org/id/a4e8930360"http://wklej.org/id/a4e8930360/a
| a href="http://armageddon111.no-ip.org/homepage_armageddon/port.php"http://armageddon111.no-ip.org/homepage_armageddon/port.php/a.
why is double ?
i have a problem (PHP). a href="a href="http://wklej.org/id/a4e8930360"http://wklej.org/id/a4e8930360/a"http://wklej.org/id/a4e8930360"http://wklej.org/id/a4e8930360/a/a
| a href="a href="http://armageddon111.no-ip.org/homepage_armageddon/port.php"http://armageddon111.no-ip.org/homepage_armageddon/port.php/a"http://armageddon111.no-ip.org/homepage_armageddon/port.php"http://armageddon111.no-ip.org/homepage_armageddon/port.php/a/a.
why is double ?
i have a problem (PHP). a href="a href="a href="http://wklej.org/id/a4e8930360"http://wklej.org/id/a4e8930360/a"http://wklej.org/id/a4e8930360"http://wklej.org/id/a4e8930360/a/a"http://wklej.org/id/a4e8930360"http://wklej.org/id/a4e8930360/a"http://wklej.org/id/a4e8930360"http://wklej.org/id/a4e8930360/a/a/a
| a href="a href="a href="http://armageddon111.no-ip.org/homepage_armageddon/port.php"http://armageddon111.no-ip.org/homepage_armageddon/port.php/a"http://armageddon111.no-ip.org/homepage_armageddon/port.php"http://armageddon111.no-ip.org/homepage_armageddon/port.php/a/a"http://armageddon111.no-ip.org/homepage_armageddon/port.php"http://armageddon111.no-ip.org/homepage_armageddon/port.php/a"http://armageddon111.no-ip.org/homepage_armageddon/port.php"http://armageddon111.no-ip.org/homepage_armageddon/port.php/a/a/a.
why is double ?
aww man you broke the pattern!
i'm so easy english speaker
why ?
do you have your files in that directory as file.txt and
file.jpeg and file2.txt and file2.jpeg ?
eee... yes
there is your oproblem
not jpeg, gif :P
if file.gif & file.txt is good ?
hold on im sending you new code
http://saint-tomy.miniville.fr/
i don't ud nothing!
a href="http://saint-tomy.miniville.fr/"http://saint-tomy.miniville.fr//a
i don't ud nothing!
can i embed c in php somehow?
How to be impossible to know people visit site from proxy or
not? It this impossible?
stop highlighting me and most of all, stop spamming stupid
urls
http://nopaste.com/ please
;P
http://nopaste.com/p/aOq8aAAmV
give that a shot
!+pastebin
wtf
where's the bot
ist good - thanks
there was a netsplit before and little bot went
death to netsplit infidels
- Can only " character cause XSS?
do you understand now why you got 2 instances instead of
one?
you shouldn't be using =
yeah use %
hehe
..
:P
SettlerX, and you have a space
2 spaces
it's only an example
damn right.
?
it's using short tags,
http://www.php.net/manual/en/internals2.ze1.php
the syntax is deprecated and would be removed in PHP6
Any other characters that can make XSS?
which are not enabled on every server, so on some servers
your script will not work
ah, I see
or only " in that case?
php and = will go
php ... ?
any ones.
I think you mean
what about zend?
yes my code all files showed. It must only .gif.
SettlerX, plenty of characters can be used for XSS
you wanted to know how to "embed C in PHP". you'd do that by
adding it to PHP, or writing an extension or such.
but inside "", e.g. value=" "?
backticks, single quotes, double quotes, UTF-7 code
exactley
ah, it's not been done already?
afk
can doing what he said name="php echo $value; ?" cause an XSS
attack? if $value has " in it or any other XSS goodness?
yes
htmlspecialchars() ftw
yep.
I do.
yes.
$value = '"script......';
I know one thing people keep forgetting
values in urls
okay, htmlspecialchars() maybe good but too long name
or (int) of numeric value
htmlentities
but .... hum, I've had Firefox extensions before and still have
- that let me run javascript hosting
code
better than htmlspecialchars?
function h() { return call_user_func('htmlentities',
func_get_args())' }
well, it will escape everything that needs escaping
not just a fixed set of chars
that's Firefox-specific chrome
is there a list of major changes in php6 compared to 5?
yes
register globals, magic quotes and safe mode goes bye bye
by the time that php6 is released, there will be a
changelog
aww really? my app needs all of those =(
hehe =D I'm just kidding =D
im glad theyre gettin rid of safe mode.
and magic quotes!
too bad they force you into unicode instead :P
i dont mind those, they can be disabled at the user
level
that hasn't been fully decided yet
actualy encoding is another common issue
too many webhosts use safe mode, makes me wanna cry.
really? I've never, ever ran into a webhost that does
magic quotes? is that like saying "what me pull a rabbit out
of a hat ... "
they need to figure out a way to run php/cgi scripts as the
correct user
I thought you already could?
possibly
why does register globals go bye bye in 6?
it sucked
no seriously how do you really feel
is there any function or something like this to know users
who join to my web using proxy or not
I hope they get rid of session_register too
why? session_register or session_start();
register globals is doodoo.
register globals is very bad
i can see how it could be useful for a large app
I don't know of one. sorry.
register_globals for a large app is not useful - not for any
app
if($ext != "txt") && ($ext != "php"){ - not good
?
i disagree.. and if you smite me again.. I SHALL TAUNT YOU A
SECOND TIME!
if you need it that bad, you can reproduce the effect with
something like 3 lines of code.
do you know what register_globals does?
yes. its registers a global
...
keep in mind that $_GET, $_POST etc are superglobals, whereas
the regular userland vars created via register_globals are not, so
you'd have to use the 'global' keyword or $GLOBALS all the
time.
it turns all user input into variables, instead of keeping them
in their respective superglobal arrays
in functions, methods, etc
if($ext != "txt") && ($ext != "php"){ = error - Parse
error: syntax error, unexpected T_BOOLEAN_AND in CProgram
Files\WebServ\httpd\homepage_armageddon\port.php on line
8
it's very bad for security
i know.
no, the superglobal arrays are still available with
register_globals.
why ?
add another set of parentheses around the if()
if () && ()
if ( () && () )
i didnt mean to say the superglobal is destroyed.
i'm so stupit xD
stupid*
i'm just saying I could see in certain instances, with a lzy
coder, you could see a benefit for globals.. thats all im saying..
right wrong or indiffertent.. i dont use them, im just syaing i
could see how other people could..
ah, okay
then that lazy coder should give up coding,
are you sure?
http://www.php.net/~derick/meeting-notes.html#remove-support-for-and-script-language-php-and-add-php-var
says: 'We kill "%" but keep "".'
s/voding/breathing/
damn then how am i gonna feed my 6 kids
knitting
im not dextarious
youd still have to filter all of the user input. i dont see it
saving you any time at all.
yes. php host
source code that has embedded confuses XML processors.
it was a terrible idea, and one should not rely on it
if youre that lazy, use your editors find and replace function
:b
aha okay, thanks
im not disagreeing with ya.. im just saying under certain
circumstances.. i see how it could be useful.
s/$username/$_POST['username'] heh
Hello, any idea how I can use a programming language like
java web host to
upload to a php scrip
t
i would never use it, but I have seen crazy people do crazier
things
ask in #java
Cool123 write your script in PHP
Ive done that
at my last job, i watched my coworker do things that you
seriously couldnt imagine. he was so confused that i couldnt even
laugh at him.
seriously annoying.,.. forms just beat me..
and #Java sent me here :P
then write your upload script in php web
hosting as well
bloody forms, why do i HAVE to use a table to get it to layout
in anyway nicely./
have you sat back and wondered.. maybe this guy is so crazy,
he could be a genius?
you don't have to at all, just learn CSS and do it the way
you're ment to
how to get file length of an image resource?
u could awlays use div layers with absolute positioning...
HEHEH im kidding
how??
the upload script that you proposed would be written in Java, so
ask about that particular script in #java. The script that receives
it, though, is written in PHP, so ask about that particular script
here.
agchchch,,, yuck
if flipping my code upside down, pulling out the mysql calls and
sticking them all at the end of the script and then complaining to
me that my code doesnt work is genius, i guess so.
ook
and your original question was about the uploader script, not
the receiving script, so.
there are many ways to layout forms without tables, simple
enough is to use a label then input boc
s/boc/box
hehe... i have seen crazier.
i found it incredibly amusing when he blamed it on me
as a last resort to newline them,, but then the bloody things
just mess up,, look all disorganised
i normally use the go f--- yourself approach when it comes to
people using my code then bitching about it
for that, read up on semantic coding
lolburp
semantics are well and good when you can afford them.. but I
can just never get the block layout to work for me with
forms
ahh broken aian
then go and learn more css
#css
i've read Geofrey Zeldmans book already.
I dunno, it drives me to distraction.. i've tried and tried to get
perffect semantic form code and the layout will never work for me
...
then ask for help in #css #html or #web
Wgat is the goal of call_user_func? What is it for?
on his form examples!
i use it too
I could link you to many, many sites that have bad html -
does that mean you should be doing it :P
_is_ bad
Hi all
but quirksmode uses the br to service older browsers, it's not
bad to be considerate of old systems
and I would dare say quirksmode is not a badly coded site..
omg your lucky i was getting ready to taunt you a second time..
;P dam monty python is stuck in my head
I never said that site was badly coded
I could link you to many, many sites that have bad html "
certainly feels like you were thinking it! :P
yes, I said I could link you to many bad html sites - that
does not mean I said that site has bad html
ok I'm just pushing your buttons
also, that site does not exist
http://www.quirksmode.org/css/forms.html
it most certainly exists..
sorry if i misspelled
in that example you could easily remove the and add margin
property to css
The point of the br is to allow for browsers that won't see the
css
bad example.. he is using but most of his format is with
css
by most i mean 95%
:P ok..
so I should use font-color="#FF0000" in my HTML incase the
browser does not use css?
how are that type of variables called? /_xml
I need some help with the php ldap api ...
or what ever it is you do in HTML for color :P
where did i ever mention colour?
"Warning: ldap_add(): Add: Already exists ..." I would like to
hide this warning
does anybody know how to do this ?
well this is just getting to be a silly pissing contest now..
I'll be the BIGGER man and back down :P
well this is just getting to be a silly pissing contest now..
I'll be the BIGGER man and back down :P
yeah turn off your warninglevel in php.ini
hehe
this is not a practical solution
well you didnt ask for "practical" in your request
;P
^^
help please! can ordinary string functions handle
multi-bytes?
must i use mb_xxxx instead of ordinary string funtcions?
theres a multibyte extension that you probably need.
did you have any particular function in mind, or do you need
several of them?
well you could always turn off the warning level with that
one script.. with ini_set
are you trying to add a ldap user?
(for example, htmlentities() can be passed a charset, rendering
mb_* unnecessary for that purpose)
yes
can anyone have a look at this for me? I'm doing this on
thousands of calls, with thousands of codes, and it's quite slow...
it seems to me to be pathetic http://rafb.net/p/h1t94w20.html
dioxide Vystrix_Nexoth ya, but i found that usual string
functions can still handle multi-bytes...
well, you don't need $nr. dunno how much that'll help,
though.
heh, was it just UTF-8?
you can break out of the loop when you find your first
match
Kobaz the while() breaks when match is valid?
i just wondered if other people did it this way
oh hmm yeah
well any type of pattern match is going to be slow if done on a
large number of items
actually... since i started making the paste for the pastebin
i have improved it a little to be honest so this helps as it
is
Hi. This question is not for PHP but it is a similar
function: Can/how I set the HTTP Header to Plain text as well as an
attachment?
The default configuration of php is really unsafe to use with a
public server ?
in_array is very slow also
index your array by the value itself, and do direct access
header()
emence I know that, I need the string that can set it
"Content-Type", "text/plain"
1);
I need an attachment as well as the text
http://us2.php.net/manual/en/function.header.php
.. not to be a duick, but RTFM
and then you can check if it's in the array by doing
$array[$match];
that should give you a a very large speed improvement
I tried to put a @ in front of ldap_add ... it does the
stuff
thanks
avoid searching large arrays
nice
it should also write the error message to $php_error or
something along that line so you should be able to check that to
xcheck for an error
Kobaz coolness thanks for that tip. this large array i must
search :/ If php doesn't have a built in function for this then
mysql sure won't
Why don't you search in your DB?
hmm, that name comes out in ASCII as "KFA". :P
Wolfpaws because of the weirdness of 'finding the closest
intersection between a string and an array of strings starting at
position 0" - i wouldnt know where the sql even begins to do
that
i guess i should go ask 'em
well, in_array does a search
that's what i was talking about
IIRC, mysql can handle sort of arrays as well.
if you have 100,000 items in your array, and do an in_array,
worst case scenerio... you will read 100,000 items to find the one
you are looking for... average case is 50,000 items
searched
vs if($array[$key]) is faster?
yeah
array[key] will do one access
kewl i changed it makes it easier to read as well
yeah
how can i debug php?
should I use isset() ?
zend debugger
yeah you should
how do i execute that?
debug how?
xdebug is nice
xdebug too
google
xdebug with eclipse's xdebug plugin
very slick
What do you mean by debugging PHP? Debugging PHP code? Debugging
PGP engine? What?
Kobaz thanks thats actually a hell of a lot faster
my script segfaults and i want to see wherre
*where and why
That can sometimes happend with undefined variable in class.
You probably want GDB then
nifty
in_array == slow... heh
I ran a some test an array_key_exists() ended up being
10,000-20,000 times faster than in_array
I ran some tests and
well yeah, you're not searching
but gdb is for executable files, no?
gdb has plugins for everything
but 2 times slower to do $array[$value] = 1; as opposed to
$array[] = $value;
on bugs.php.net there is a link to how to debug PHP.
what's the name for the php gdb plugin?
Can I disable functions for php files in one specific
directory=
*?
i dunno... google?
My hypothesis was that php uses some sort of ordered
hashtable, so it wouldn't have to search the array for the
keys
http://bugs.php.net/bugs-generating-backtrace.php
you can set up php to prepend code that will check the cwd and
define functions... say you want to disable fopen... so you do...
function fopen() {} in your prepended script
you dont search the array for keys, correct
php.ini thing
but in_array does not search keys... it searches values
yeah
hello everybody, does someone knows any ORM tool for PHP excepet
Propel?
so that way
yeah, I know, that's why I suspected it would be much
slower
actually, no wait.. i'm dumb
that wont work
Haha
try AR implementation...
that would prevent a user defining the fopen function... but
you cant redefine built in functions anyway (without an
extension)
I am just learning php, and I am working on connecting to
MYSql. I'm having trouble with my code (very basic, I'm just trying
to connect and add some values to a table), and was wondering if
someone can help me.
that's a good question
http://jaws.townsville.nl/index.php?blog/show/4
I want to disable a bunch of functions for everybody but
me
plan b
hi
edit your apache config and do php_admin values for all the
vhosts you want to disable the functions for
Wolfpaws, tks
hmm, have a big block of html with all the carriage returns
stripped out which i presume is for obfustication.. how can i parse
the html into a nicely indented formated stream?, so how can i
process
php_admin_value disable_functions "fopen" /Location
AHa
Thanks
or something like LocationMatch /home/something/something.*
to match a whole bunch of dirs
Its /home/username
But I want to exclude mine
yeah okay, that's fine
you'll have to put in something like
LocationMatch /home/.*
and set the disabled functions
That will include my dir
and then after that do a LocationMatch /home/jckf/.*
and set disabled functions to ""
Vystrix_Nexoth yes, utf-8 only, i've found that htmlentities has
a parameter to set encoding
ok
Can anyone help me?
i think that should work
can someone recommend a nice SMTP class?
but i don't know whether strpos things can handle multi-bytes
correctly
tidy might do it
ahh, tidy.. ok,, tahknks
have you searchec pecl
nope
or pear
they should have some
So I've got a really weird challenging problem that needs
some wizardry. I'm getting a string value from a Postgre SQL
database using PHP 5. This value is simply of the format
"%d.%d.%d". its a time delimited by periods instead of the usual
colon. when I get this value out of the DB and try to split(".",
$time), the array it returns has no elements. It wont split it! Can
anyone think why putting that string through the database would
cause this
what are we looking for?
http://pastebin.ca/610638
it won't write to the database
I'm looking at that. what-- oh.
Don't use split, use explode
They're not the same thing.
wow. thats all it was. geez. thanks! I was using explode for a
while, not sure when I started splitting instead.
try adding "or die (mysql_error())" after each call to
mysql_query()
split() uses regular expressions... the "." regex will
evaluate to not what you want
You should NEVER use split
as in, mysql_query($query) or die (mysql_error());
To locate which one fails?
right
If you want to split on a regex, use preg_split()
rgr, thanks mates
nanousr, what are the fields in the table you are inserting
in
I'm getting the error: Table 'sample.links' doesn't exist
when executing "$query = "INSERT INTO links VALUES (url,
'test2')";"
I found a problem.
It's not creating the table inside the sample database.
http://pastebin.ca/609426 -- a bit
of Python fun
I notice you only perform the queries if mysql_select_db()
returns FALSE.
which seems somewhat odd.
nanousr, you have id not null and you are not inserting into
it
it's also auto-increment.
nanousr, try using values('', url, 'test2')
and the immediate problem is the table trying to insert into
doesn't exist.
This isn't doing what I want it to "$query = "CREATE TABLE links
( id INT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, url varchar(75),
PRIMARY KEY (id), UNIQUE id (id))";"
remove the unique key and default 0
unique(id) and pk(id) is redundant.
primary is already unique
perhaps, after you CREATE DATABASE, try mysel_select_db()ing
it?
if I can't select the database { create it; create a table in
it; } insert into table;
you dont want to default to zero, you want it to be whatever
autoinc assigns it.
but when you create the database, you never select it.
hello, it's possible to add up date object ( DateTime) ?
and yeah, heed the advice of these others regarding the 'id'
field.
it won't either way, NOT NULL int's default to 0 whether you
spec it or not
Ok, now I'm all confused.
then remove the not null, whatever
add another mysql_select_db ($database, $db); after the CREATE
DATABASE query.
Call to undefined function mysel_select_db() in config.php on
line 16"
mysql_ not mysel_
oops
mysel_sqlect_db hehe
hmm, but it actually calls it, or tries to. figured the database
would remain created after the first time you tried the script.
*shrug*
According to phpminiadmin it's creating the database
correctly
But not creating the table
what error message do you get in PHP?
er, did you try running the script again?
Who else thinks implementing CRUD operations are the ultimate
grunt work
(if not, do.)
I only get an error message when I try to write to the
nonexistant table
any idea what might cause a variable's value to change
immediately after assignment
"?
the problem is in your SQL, not php
ah:
Incorrect table definition; there can be only one auto column
and it must be defined as a key
http://pastebin.ca/610688
I see the problem, I think
CREATE TABLE links ( id INT(10) NOT NULL AUTO_INCREMENT, url
varchar(75))
CREATE TABLE links ( this, that, PRIMARY KEY(), UNIQUE ID (id)
)
CREATE TABLE links ( id INT(10) AUTO_INCREMENT PRIMARY KEY, url
varchar(75))
CREATE TABLE link ( this, that) PRIMARY KEY(id) UNIQUE
ID(id)
half true. there can be only one auto increment column, true,
but not necessary a primary key
or what chadmaynard said, maybe.
The problem in the original sql was DEFAULT '0'
'0' is a string where the col was an int
IIRC, you can do stuff like update/insert on a numeric column
even if you quote the number in question.
still not working
be more specific. error message?
yep, in mysql insert/updates with wrong datatypes throw
warnings and are converted, but not table definitions.
it doesn't give an error message until i try to insert
data
ah, ok
i have two variables, i echo their contents and assign them to
other variables. i then echo the 2nd set of variables and one or
both of their values are different than what i had assigned
i'm pretty sure i'm not selecting the database
I guess the table definition is fixed, then. so, don't make
us play 20 questions. what's the error?
any idea what might cause this sort of behavior?
"Table 'sample4.links' doesn't exist"
you could INSERT INTO dbname.tablename and if that works then
you are not selecting the db
I'm using RC3, and was wondering why users get periodically
logged out, even if they select for them not to
is there an option to disable this?
The problem is there is no table in the database
the create table isn't working
with the error message...?
you must select the database before you can create the
table
"doesn't work" doesn't work.
When I go into phpminiadmin, and select the database, then
paste the sql code it works.
It creates the table.
but you're not using phpminiadmin here. you're using PHP. what
does PHP say?
nothing
$patience--;
haha
Wrong channel
until I try to insert data into the table
whats pinner mean
and then it tells me that the table doesn't exist
what if you use this: CREATE TABLE sample4.links ( id INT(10)
AUTO_INCREMENT PRIMARY KEY, url varchar(75)) ;
ah, we're getting there
I think line 20 in your latest pastebin (610688) is redundant,
for what that's worth. if it selected in the first place (line 13),
it's not necessary at line 20, and otherwise it'll create it and
then select it at line 16. either way, by the time it gets to line
20, it's already selected, or should be.
"Column count doesn't match value count at row 1"
i have an array who's index keys do not reflect the actual
ordering. but i need to find out what position number a particular
key is in. how would i go about this?
that's an insert error
change your INSERT query to remove the empty first value, I
think, or pass NULL (IIRC).
uchange your INSERT query to remove the empty first value, I
think, or pass NULL (IIRC)./u
and, more to the point, remove the third value ('test2')
http://pastebin.ca/610688
^ is nanousr's latest paste
oh yea well that's a pretty obvious problem
array_search($value_to_find, array_values($big_array)); slow but
does what you want.
INSERT INTO links VALUES (url, 'test2')
How large is this data set?
make that array_keys to search the keys instead
jmccaffrey, unkown. typically 50, but sometimes much
larger.
Thanks for all of the help. It's working now.
This would be fine on that size of data
not entirely satisfied it's working optimally, but, if it works
for you, I guess that'll do.
jmccaffrey, ok i'll use it for now then. thanks
It appears to be writing to to database fine. What would make
it work optimally?
well, I'm leery about some stuff. like, where does "url"
(without the quotes) come from in the INSERT?
that's the column name
but it's in the VALUES() part.
Is that bad?
did you notice the PHP constant warning?
INSERT INTO links (url) VALUES ('test2'); -- maybe that's
what you're thinking of?
it's in the query, in a quoted string, not raw in PHP.
oh yea.
^_^
Vystrix_Nexoth, that code works as well
they even do the same thing
his fields are: id INT(10) and url varchar(75), and he was
inserting VALUES (url, 'test2')
meaning 'url' (without quotes) got put into the 'id' field.
not sure what to make of that.
no becuase it's an auto increment. MySQL doesn't care what you
insert if it isn't valid it becomes auto_inc_next_id
the code I suggested should be much better, making it clear what
goes where (and letting the id field increment itself)
i agree it was wrong, but it still did the same thing.
Hey!
I'm looking for a lightweight php/webserver package for my
laptop, so that I can test my pages when I have no iConnection.
This is for linux, perferrably deb ubuntu
z0ap, lighter than apache?
hi
bbryant, I was hoping for a package that included
both...
i can save more GET variables in an url?
frank-busy: well, you can add more than one, if that's what
you mean. foo.php?one=1&two=2
$_GET['one'], $_GET['two']
hmm
i asked this cos i had 1 GET variable in my url, and when i
added another one, the first one was gone
...
zOap, installing apache and php seperately isn't too
difficult, but if you tried to install the php5 module for apache2
without apache it would install apache for you too
what did it look like with the second one added?
try this in the terminal "sudo aptitude install apache2
php5-mysql libapache2-mod-php5 mysql-server"
it just saved only the last variable
bbryant, dificulty isnt the issue here.. I was just looking
for a light server...
ah
nanousr, I wasnt looking for mysql
frank-busy: I need to see some code for this, can you
pastebin?
Lighthttpd using php fastcgi?
That seems to be the leanest setup I have run
jmccaffrey, are theses available in deb?
I would however use whatever you plan to use in your
production environment on your laptop also to keep it
consitant
probably
lighttpd is in the universe repository, at least on
Feisty.
jmccaffrey, well I mostly program cms'es, so having several
servers is just a bonus. allthough I have several beta testers It
would be nice to try out new things. thanks for the tip, I'll look
into it.
Does anyone know of a wysiwyg web editor that can be
ajaxed?
Are you attempting to find a WYSIWYG editor that can be used
to design a dynamic page?
Closest thing is going to be visual web developer .net, your
mileage may vary
Im looking for a web based wysiwyg editor that can be loaded
thru ajax
I dont want no stinkin .NET
Ah different than, this channel does not support third party
scripts or anything, personally I have never used so I don't
know.
:-(
mmmm ajax
check out ext
I have phpbb 3 RC3,and after a certain period, it logs people
out. I'm sure I saw an option to change this, but I can't remember
where... Can anybody help?
:-/
#phpbb
oops
sorry
!tell BARBA_RUIVA about guidelines
hmm maybe they dont have a wizzywig
thought they had one in the demos
oh they do have one in the demos
yeah, use ext
http://extjs.com/deploy/ext/examples/form/dynamic.html
you recon I can suck that thru ajax ?
it is ajax
hi, I'm a begginer in php. I'd like to know why php puts \\ in a
file when I create a file from a textarea with just one \
ext is an ajax framework
:-/
is there a simpler way to detect if a number is odd then
if((int)$x / 2 != $x / 2
if ($x % 2)
mod
if($x % 2 == 1) means it is odd, right?
right, the == 1 is implicit
is there an easy way to take 2 dates and make sure one if
after the other, without regex extracting the info and cross
compare?
thanks!
what format are they in?
MM/DD/YYYY
ugh
if you get them into YYYYMMDD then you can just + 1 and
compare
it get sent from the browser as a string in that format
no actually
MM/DD/YYYY
i guess i might be able to take a timestamp, one timestamp will
be larger then the other
list($m, $d, $y) = explode('/', $date); $ts = strtotime($y . $m
. $d);
i can seperated like that, just trying to figure out a good way
to compare
well once you get those timestamps, isn't it trivial?
true
Hi folks. Just curious, I currently use Zend Platform
Professional for writing PHP. I'm looking for extensibility for
JavaScript as well, what's the general opinion on the maturity of
eclipse?
Bye all
how do you make PHP convert " to ™. ive tried
htmlspecialchars and htmlentities
What do you think about categories and topics and news?
Both arts, files, news, etc. can be divided into categories.
However, all news of all categories aren't shown currently.
And what do you think about it? Only categories? Or division
into categories and topics is better?
anyone know how to make PHP convert """ to "™"?
is it okay to store 500k-1mb of text in $_SESSION?
I've got a max of 10 users doing this at once... how large can
session data be? does php set a limit or is it up to available
hardware?
htmlentities()
htmlentities will replace all & and htmlspecialchars only
certain &?
Did I miss something, or is mysqli::multi_query() really
executed in MYSQLI_USE_RESULT and there is no way to force it to
store result?
didn't work! but i'll just do a str_replace.. :P
I have huge file with many sql queries (db dump) and I want them
to execute all at once with multi_query() and I always get (of
course) out of sync error. Therefore I have to iterate every result
and free it ...
wich is kind of odd
It's possible, although I probably wouldn't recommend it with
the default session handler. The main problem you'd likely run into
is running out of memory, if you have a memory limit set, although
the time to serialise and unserialise the session data wouldn't be
great either, particularly if you have a lot of variables in
there.
So what do you think about dividing news into categories?
Is it sufficient?
Or should they have also topics?
e.g. Hardware, Software, etc.
have you specified charset of that string according to
manpage?
With ten users, the processing overhead probably isn't going
to be too bad, so as long as it's well under the memory limit, I
guess you'd be OK. Might not be great if you start needing to
support more users, though -- you might then have to look at using
shared memory to store the sessions or similar.
does somebody uses ADOdb Active Record to manipulate the
database? is it nice?
whenever I put a """ in my PHP code, it comes out as a
"ý". how can i make it appear in the source as the character
""", not "ý"?
and this is nothing to do with ™
and when i say source i mean generated page source
LawnGnome if I use a custom session handler that points to
mysql - will that change anything?
bLawnGnome if I use a custom session handler that points to
mysql - will that change anything?/b
so echo """, causes "ý" to appear in the source
Depends on the nature of your data, but my gut feeling is
probably not.
k tnks
Maybe try echoing the appropriate numeric character entity
instead?
I don't have that symbol in my font, whatever it is, but it
should be rather trivial to lookup
so what do you 'do' with all this data if you want to pass it
around, or to have it persist between requests? it's processed data
from a database, which I like to keep handy rather than re-query
the database for a different report on the same time
period?
shm, files
Then use the normal file-based session store
I don't think SHM is a terribly good idea, myself, but YMMV
kewl, thanks for that
I haven't used shm, what don't you like about it?
Most of the opcode caches I've used provide session handlers
as well, although you're still subject to the usual limits on
shared memory size and the like, since that's what they'll be using
internally.
How do you break out of a loop? break?
I've had PHP leave things laying around, so I have to write cron
jobs to clean it up. Also, he mentioned it might be about 1MB of
data, which is more than I like to shove into an SHM block
josh[n00b]: yes
thanks TML
josh[n00b]: php.net/break
thanks
doesn't all the data get freed when the shm is
destroyed?
alma you can store your sessions in database in blob columns
if there is a need for that
all the memory, rather
The 1 MB issue was why I was hesistating a bit to recommend
it too. It's a nice solution in many cases, but a meg of session
data's a little out of the ordinary use case.
eh sorry i didn't scroll down, this is a bit outdated
idea
I doubt that'll be any quicker than the normal files handler,
by the time it's gone over the socket both ways. Probably be quite
a bit slower, in fact.
The SHM's don't always get destroyed
ok, I get it
well 1MB is like about the outer-limits thanks!
so I have to write nasty cron scripts with ipcs
hrm
some days you ask a question and you get real value.
how about files on a ramdisk?
That's better, although you still have the serialisation
overhead.
If it's a real problem, I guess you'd profile the hell out of it
and see what was really happening.
Seen my Python magic?
No
Share
marypoppins = ( superman + starship ) / god;
hahahaha XD
I guess that depends on a kind of data alma wants to store in
session. can you for example store binary data in serialized
arrays, which session data are?
cStringIO *and* BeautifulSoup in the same module? Agh!
What's wrong?
nasty
So it fetches youtube videos and saves them to disk?
YEah. And finally converts them to a given format
i'm currently using saving session into database btw, it's not
any slower i'd say ... I'm playing with an idea to create session
data as a HEAP table, which should be even faster than saving to
files on hard drive
Aren't HEAP tables saved on the HD?
cStringIO is there only because of pycurl
Sounds like pycurl needs to be refactored
no, in RAM
cStringIO is old-school
at least every book/manpage says so, I've never used
them
What is prefered now? StringIO?
The bytes class, probably
how can I get a backtrace from php without it actually
segfaulting or erroring out?
I'll look into it. I have to do comic now...
print_r(debug_backtrace());
err... no a gdb trace
php takes like 10-15 seconds to print time(); and im tring to
figure out wtf it's doing
now I'm interested in seeing a comparison between storing
sessions in a DB, shm, files, and files on ramdisk
what's strace say?
uhh, im asking because I don't know how to use it :p
morning,
strace php5 -r 'echo time();'
it seems to hangup here: write(3, "RESOLVE-HOSTNAME-IPV4
ecolem01.b"..., 43) = 43
read(3, "-15 Timeout reached\n", 1024) = 20
so it's trying to resolve a hostname
how do I stop it :p
What is === used for ?
exact comparison
dunno
is it possible to include another file inside php.ini ?
where 1=='1' but not 1==='1'
Why would you want to do that?
what else are you doing?
nothing.. i just called php -r 'echo time(), "\n";'
I want to configure open_basedir per user
php is running as cgi
I did not got that what does it mean exact comparasion
look up, enygma told you
Thanks
si
Did not saw that
Hi folks - i'm being given the URL of an image file - what's the
best way to download & store it? will file_get_contents()
work?
ghento why you don't just try it first?
thanks man, i added my hostname to my /etc/hosts and it started
to work :p
why would I be getting 4 digit numbers still with this code?
http://pb.theoverclocked.com/61
good point, /ignore last message
1) ignored, 2) yes, it will
depending on your server configuration of course
im having trouble with the logic here....i want to take an array
of say all the letters in the alphabet, and spit out every possible
permutation of a given length. whats the best way to write
that?
so like....aaa, aab, aac, ........jkl, jkm, etc.....
Ummm... Why?
because i want the list.
im just getting lost in all the loops lol
definitely go the recursive route, hmm lemme think about it
for a bit, interesting problem
for some reason when i assign some variables from $_SESSION,
their value seems to change immediately after (http://www.mentalcases.net/~sinthetek/cartprob.txt).
i have been experiencing a lot of problems with this program that
seem illogical and which i have had to code around (using isset()
and other functions rather than == or === mostly)
"all the loops"?
You should only need two
nvm got it
i am not sure if the previous problems this one are related,
but this one (with the variable assignment) can be manifest with
the code i added in lines 151-161
thanks i'll look at it
range('a', 'z')
Oh you can do that?
You can indeed
working here: 1-3how 'bout here: 1-3blah =2bleh = 3
i would prefer $str = 'abcdefghijklmnopqrstuvwxyz'; $letters =
str_split($str);
Uhh...why?
range('a', 'z') is a lot easier to read
range is for sure the best
in case you dont want just a through z
like if you want numbers too
blah should contain the value 1 as it was assigned the var
whose value is 1, however when it's printed 2 lines later, it's
value is now 2
I don't understand
How does your way make that "Better"?
well it isnt better obviously if you're ONLY going to use
a-z
$letters = range('a', 'z'); $letters = array_merge($letters,
range(0, 9);
Except I dropped a )
1-2how 'bout here: 1-2blah =5bleh = 2
but if its a script where you want to easily plugin a range,
i would prefer just typing out all the characters that could be in
it
abcdejk9230@7834|[]()
that would work with my way
jmccaffrey, this is good, but it wont work with a customizable
length...you would need to keep adding foreaches
should i just replace the second foreach with a
for($i=0;$i=$len;$i++) ?
why
because it only works with a length of 3 at the moment
could someone at least acknowledge my existence since this is
like my 3rd time presenting the problem and i have thus far not
even gotten that much? perhaps my login to nickserv wasn't truly
successful or something, heh
ucould someone at least acknowledge my existence since this is
like my 3rd time presenting the problem and i have thus far not
even gotten that much? perhaps my login to nickserv wasn't truly
successful or something, heh/u
I acknowledge your existence
yay! validation!
thanks
yw
Now, if you could condense your question down to something
that is locally reproducible in ~ 10 lines of code, I can probably
help you
uNow, if you could condense your question down to something that
is locally reproducible in ~ 10 lines of code, I can probably help
you/u
What I'm not going to do is read your 230 line masterpiece and
try and tell you what you did wrong.
bWhat I'm not going to do is read your 230 line masterpiece and
try and tell you what you did wrong./b
does anybody have a favorite open source commerce platform?
OSCommerce, ZenCart, CubeCart. Are there others I should be aware
of? Does anyone have specific likes or dislikes of any of these
products?
[fields]: OSCommerce is a steaming pile of bovine
excrement
i understand why you wouldn't want to, but i've tried
replicating the error but it wasn't so successful
actually i could try a few other things...
s/error/problem
Ok... now why?
when i tried to replicate it i didn't use $_SESSION, i will
try replicating with that instead
Which, to me, says you need to start from the simplest
possible script and work your way upwards, checking at every
possible functional addition, until you hit the problem...then
reduce the last addition to locally reproducible code
hi
hey
i'm looking for an "admin page generator" software. but i
couldn't find anything
you wont find one here
i know
"admin page generator" ? wtf?
maybe someone using it
no idea lol
[fields]: Because I've written better code while asleep at my
keyboard
are you just looking for a password protection generator?
I've seen an htaccess one at dynamicdrive.com
it's a software that creates administration pages
looking your database
what are admin pages?
seriously....
forget it..
thanks.
forgotten.
DeliPenguen, check phpmaker
thanks.
TML, hey, you might be interested to know that theGZA has
been evading his ban from ##php by moving to a different IP, he was
in #phpc last night bragging about it
hahahaha he's finally banned from here?
AlexC_, yeah that's what i thought too
bless him
s/him/it =D
jmccaffrey, thats awesome...thanks
np
AlexC_, took a while. only reason i know he's banned is
because he showed up in #vim talking about his ban from ##php and i
thought to myself "damn, i wish i had been there to see
it"
I have some permutation code someone from here gave me that
works very well... let me hunt it down.
does he do it on purpose then?
AlexC_, i was suprised he lasted as long as he did actually,
testament to the patience of some of the ops in here
AlexC_, um, hard to tell actually. i don't think so, which is
what makes him so lame.
I don't know who TheGZA is, nor what addy he's supposed to be
banned under. I suspect Wolfpaws is the one who needs to be
informed.
the permutation generator reminds me of www.projecteuler.net
anyone ever seen that before?
I've got no idea how he does it, he's banned from #html, #web,
#css, #javascript, #js and now ##php
That is impressive
BINGO!
its just a bunch of math challenges you need to solve with
your choice of a programming language
That makes it easy to answer how. A more interesting question
might be "why"?
trolls have been around since the beginning of the web
:P
perhaps he has a third nipple with a mind of it's own, and
that sometimes overpowers him?
at one forum i visit, there is one that has created over 50
accounts, accessed it through many different proxies, just to make
pointless topics
it amazes me...
blah
i could re-write this entire cart to use a doubly-linked list
instead faster than testing it all one var at a time
i would really like to figure out what is causing the problem for
future reference though
And caffinated.
TML, i suppose so too
theGZA is one of those who ask like billion questions and refuse
to even look at the manual once.
You're implementing a linked list in php?
and one of those who hits enter about 50 times while asking
those billion questions... so that's about 50 billion actual
messages
no, but i will be soon most likely
That is the reason why he was banned by caffinated. I just
locked up his secondary IP
Wolfpaws, anyway, might wanna set ban on theGZA!*@*
Why?
how do i take a unix timestamp and get a readable date?
i know there a function and i cant remember it
NAh. The IP ban works fine. He changed the nick,
anyways.
hey all, i'm trying to include() an html file which has a
flash app, and for some reason its all squished vertically, if I
view just the html page its fine
any ideas how to give that more room?
because it seems the next simplest way to implement the
functionality i require
duh date
Wolfpaws, he was in #phpc last night with this "video" of him
opening files. dunno if you're familiar with his little "i'll pay
you to video tape yourself opening files faster than me" epeen
contest. it was pretty sad.
o.O
If you wouldn't mind, could you explain your situation to me?
I believe there are design improvements that could be made to avoid
having to do this
[fields]: Thanks
wow, you learned how to be the fastest at using the most
innefecient method to open files. you go.
when running a LAMP server, with 2 or more httpd does the max
memory get split between the virtual servers or does each recieve
the full amount?
hahahaha
I3ooI3oo, you mean vhosts?
I3ooI3oo, or do you mean like with Apache + otherwebserver +
anotherwebserver
I3ooI3oo, besides that... sounds like a better question for ##linux
or #apache
well it's a php error that is hitting my apache loogs, or i
should say it seems like it is
multiple vhost
the simplest way seemed to be using $_SESSION to store cart
items, quantitites and a count of the items. i use loops to iterate
through the session vars. items and quantities are associated to
each other via their offset from the start of their respective
arrays via the loop: while($count $_SESSION['itemcount']) { ...
$count++; }. $_SESSION['itemqtys'][$count] contains the quantity
for $_SESSION['cartitem'][$count]
jmccaffrey, whats the difference in that funtion you gave me
between echo "$stringbr /";return; and return "$stringbr /"? the
latter doesnt work.
Allowed memory size of 16777216 bytes exhausted ---- but the
max is set for 32Mb
chat where is the return value being echoed?
or even captured?
http://pastebin.ca/610950 line 8
and 9
yet somehow for some reason variables seem to be changing
sponaneously which is manifesting itself in a way i cannot
understand. it is evident when i do: echo "working here:
".$_SESSION['itemqtys'][$count]; echo "-".$_POST['qty']; echo "how
'bout here: ".$_SESSION['itemqtys'][$count]; echo
"-".$_POST['qty']; and the result is: working here: 2-2how 'bout
here: 2-2blah =5bleh = 2
I store that data in a database table, and just store a
cart_id in the session data.
i could do that but it seems sort of superfluous use of
resources to store such a small amount of info for such a finite
period of time
hmm
i guess it would be easier to integrate into existing code
than a doubly-linked list though
jmccaffrey, the problem is that i dont want the function to
echo out the values - if possible, echo out an array
Its not, using the DB to store things is what it was meant to
do, it can handle it. Using this method also streamlines your
system as you can query the DB from anything to view the data for
reports or what not. This method is more conventional so
maintainers can more easily understand it than some rather
complicated data structure in memory. Also the database is more
scalable than session files.
you need a second array passed, called &$results that you push
data into instead of echoing
how would i make a page that will allow only authorized users to
d/l files?
ok
majikman, dynamically create a new file every time a logged in
user requests to download it. once he downloads it, delete
it.
I would just make a download.php file that reads and writes the
desired file
or echo out the contents of the file once the user is
authorized..
how can I change 5-14-2007 into May 14, 2007?
i was more concerned with the overhead to calls to the db and
traffic on the network than actual storage on the db
Does your commerce site not use the database for anything
else?
date("...", mktime()); look in the manual at mktime() for
examples
jmccaffrey; also, i would have to set up some sort of
routines to check the db and purge info leftover from unfinished
purchases etc
yeah, it does
s/purchaces/transactions
Right, this is very typical usage on a database, usually you
have an hourly cron script maintaining the data on
there
step 1 is explode your datestamp and then put those in
individual variables in the right place on mktime
yes, crappy/lazy coding practices are very typical these
days, that doesn't mean i wish to embrace them personally
:P
although i'm not saying i won't
it just seems that my method shouldn't be much if any
harder/complex and would have a lot less overhead
jmccaffrey, im pretty confused, as ive never used references
before. http://pastebin.ca/610998 generates
the error Cannot pass parameter 2 by reference in
Ewamp\www\random\permutation.php on line 15
erm...no offense
Hi, I'm new to PHP, is it true that the Zend engine has poor
multithreading support compared to perl?
Chatmasta, if i do that, the user could stop the d/l in the
middle of d/l, save the url, and pass it on
Chatmasta, the file would never be deleted
hm
it boils down to priority. some people are used to coding to
be more productive and make more money, whereas my priority atm is
making the most of what little i have
jmccaffrey, if i do that, how do i handle large files so that
it doesn't exceed php's memory limit?
and learning to be more offecient
In my opinion the preferable method from a design standpoint
is using the database for this operation. Usually I try to minimize
on processing done in php because honestly it is better done
elsewhere. If you are going for performance over anything else, I
would run some benchmarks for the sake of scientific method,
however if your aim is maintainability I would work on the database
approach.
how can i see what options was my php configured with?
how can I extract the date string from the filename
priority_5-14-2007.rate?
preg_match, google pcre
will all your iles start with priority_ and end with .rate
?
Don't store them in memory, just stream them to the host
php.net/pcre
[fields], yup
Read a block, write a block, etc...
jstarcher dont use preg then
str_replace();
hmm..... ok, i'll try that
Wolfpaws jo dud
$file = "priority_5-14-2007.rate"; $tmp =
str_replace("priority_", "", $file); $tmp = str_replace(".rate",
"", $tmp);
Related Topic:
Hi how can I set variables with the loop count in the variable name in a for loop That is path1 path2 etc where