I have a database table that stores a username and the date when a user loggedin if the user presses the logout

method()
even though it's a static call, $this is available still
it's voodoo
^^ for you

mmk
thanks

np

nham…other question, where i donwload Apache?

http
blah
http://httpd.apache.org
there is again Win32 binaries

thanks xD

Thank you, I should've known that Davey!

Delixe:

any recommendations for a unit testing framework?
phpunit was uhhh, painful.
or is this seriously a lost cause, as i've been told?

What's the most common XMLRPC implementation? (I have full access to the server)

anyone know how to set up curl

hey y'all

server or client?
the extension?

client, I guess. does it matter?

check out the one in Zend Framework, it's pretty good
and the nicest API

i was like here 2 days ago looking for a decent HTML tree parser ( php4 compatible ), still can't find anything have been trying to write one, but its a total bitch :[

PEAR has the HTML_SaxParser IIR
C

weird I thought there were native versions

there is the xmlrpc extension, and the immature xmlrpci extension (client only)

I guess i'll take a look at zend, thanks

http://pear.php.net/package/XML_HTMLSax3

http://us3.php.net/manual/en/ref.curl.php

*reads*

http://pear.php.net/package/XML_HTMLSax for the older stable version
what are you trying to do with CURL?

this i am assuming
nuttin much
play with it\

if you're *making* standard GET requests, the http stream is far superior
if not, maybe HTTP_Client/Request or Zend_Http_Client would be better
finally, there is installation instructions right there in the page

davey….you are talking way over my little head

file_get_contents("http://url") == HTTP stream - automatically just works
if you are wanting to pretend to post forms or whatever, http
blech

yeah !! thats ut
it

http://pear.php.net/package/HTTP_Client or download the Zend Framework http://framework.zend.com and pick out the Zend_Http_Client

me ?

yes, you

oh god….i'm scared

if you want to post forms or perform more than basic requests, use those
well, you're in luck, I wrote the base of the Zend one, heh
http://framework.zend.com/manual/en/zend.http.html#zend.http.client
it's pretty well documented

how ?

how?
I hit the keys on my keyboard

yes, how?

letters were typed

and then

or am I misunderstanding your question

sorry….just amazes me

HTTP is a pretty basic protocol

hold me

are you hot? :P

don't worry i am a girl

I didn't ask that

so its ok if i was a hot guy

Who am I to be picky?

man you men arent picky anymore, are you
whatever walks …grab it

if someone is hot, they're hot. regardless of gender. The fact is I find very men hot :P
very FEW men

but you do find some hot ?

sure

hello
what is PHP

depends who you ask

Personal Home Page.

don't make me stab you.

i am logging stuff to a file…

Yes, everyone on IRC does that [domon].

but it's *most* common answer is, a programming language commonly used for web sites (in fact, the most popular for that job

characters?

are you going to be a little more constructive?
[domon]: str_replace()

yuck lol

[domon]: pass in arrays for both the first two args
it's fast
[domon]: the other option is http://php.net/html_entity_decode

i think that's better
thx davey

[domon]: but it's pretty much the same thing under the hood
[domon]: str_replace() is faster if ALL you want is and

html_entity_decode replaces more than and .
Things like — and & will probably get replaced as well.

it's also character set aware

:P

if I have a mysqldump/phpmyadmin dump.. is there some how to easily excute it again through PHP?

yes and no

Wrong parameter count for fread() in /var/www/vhosts/iptriple.com/httpdocs/API/index.php on line 720
Wrong parameter count for str_replace() in /var/www/vhosts/iptriple.com/httpdocs/API/index.php on line 722
:|

if you have MySQLi then yes, it's reasonably easy

oh whoops
LOL

just use mysqli_multi_query()
otherwise, you need to explode() it into seperate queries, and iterate them through your query function of choice

hi. i am trying to understand the code here: http://pastebin.ca/636773. I know that it relates to the mapping of URLS within the site I am looking at. The main bit I'm unsure about is $GLOBALS['app']-Map-Connect. I am used to OOP syntax like
$this-class-method. Can anyone shed any light on this?

$GLOBALS['app'] is just the $app var in the global scope
$GLOBALS['app'] is an object, which has a property called Map, which is also an object, which has a property called Connect

okay, thanks

Davey, thanks. is this php4? I am used to php5 oop syntax. DO you mean an object as in an instance of a class?

welcome
it's PHP 4 and 5
and yes

I have a requirement to add the ability for users to be able to save a partially filled form, and allow them to resume filling it out later
anyone have any experience developng such a feature?

Davey, is there a general term/phrase for what the developer is doing here so that I can read up on it?

actually, I spotted one the other day, one minute
http://jan.prima.de/LiveSaver/

wow, that is great
thanks @Davey
I was considering using a button, and a table with form id:value in order to save
but, this is more "resilient"

$fp = fopen("iptlogfile.txt", "w+");
$data = fread($fp, "706220");
what's wrong with that? o.O

[domon]: assuming $fp != false, nothing

Davey, i'm guessing that the app object has been instantiated somewhere earlier in the code and is stored in a global variable. I'm not used to working that way but would be interested to find out more

it's nothing special; you understand scopes?

Davey, variable scopes, yes. As in local variables and global variables. I probably don;t understand the intracacies of them across all versions of php, though.

http://pastie.textmate.org/83002
Resource id #16
1

hasn't changed since PHP 4.1.2
well, even then the scopes didn't change, they just added superglobals

that's the output of the script o.O

[domon]: php.net/resources (IIRC)
$GLOBALS is a superglobal that is an array of variables in the global scope

Why does 10%3 give 1, but 3%10 gives 3? Shouldn't they both be 1? Where did the 3 come from?

% = remainder after division using whole numbers

it prints out 1 for is_resource

so 10 / 3 = 3 remainder 1, 3 / 10 = 0 remainder 3
because 3 is not divisible by 10

Oh, I see.
Thanks, Davey.

grr, 3rd blackout

ouch

UPS ftw!
no problem

anyone have any ideas?

Davey, I have heard people say that globals are bad. Why would you not just extend the base App class? Might this be to ensure that the script works on php4 and 5?

well, i didn't say the code was *great*, they should've used a singleton IMO

singleton? :| ?

its a design pattern

[domon]: one of the staples of design patterns

vaguely remembers it being talked about but can't remember exactly what it is
erm..
that was meant to have /me in front of it

http://www.phppatterns.com/docs/design/singleton_pattern

ty
anyone know wtf is going on with my script?

TML?

Davey, the code is from a cms/framework called Jaws. ever heard of it?

ugh, this is *old*
yes, and know people who work on it

TML? davey said you were a moron

Davey, ah cool. what do you think of it?

kidding

http://www.fluffycat.com/PHP-Design-Patterns/Singleton/ - better

Davey, I am interested in getting involved and maybe helping with the documentation (there is none)

never worked with it, but I know the guy I'm thinking is a decent code
a decent coder*
I think you'll find I said TML knew me when *I* was a moron :P

lol
i have to make myself laugh sometimes

Davey, is he a native english speaker. I always seem to get a non-native in #jaws

no, he's icelandic, but his english is great
helgi thormar (where the th is a weird char like |D)

Davey - cool I'll look out for him. THanks for your help and general wisdom!
bDavey - cool I'll look out for him. THanks for your help and general wisdom!/b

makes me worry for the human race, frankl
y

its all relative!

I am by no stretch of the imagination, wise.
I'm just a good actor

does anyone here know a good PHP gallery?

coppermine?

is preg_match a good thing to use for all my validations

http://coppermine-gallery.net/

only if you want to make complex patterns
*always* use native string functions if you can, like ctype_*, is_numeric, etc
regex is *slooow*

Well, i am using is_string to validate a firstname box
But doesnt that mean they can put in whatever they want, spaces, $, %

sup!

I checked out php.net/is_string and they tell you how to use stuff, but never say what it excludes

yes, try using ctype_alpha instead

For example Davey, does ctype_alpha exclude spaces

yes
maybe you want ctype_printable
(IIRC)

Ok, looks like i have a winner, thank you

Then that would still allow spaces, $, %.

How can I see what pear libraries I have installed?

pear list
from the command line

Hm, weird. I installed the progressbar extension, and I don't see it there. Maybe I'm looking for something else.

pecl extension?
pecl list

gah, yeah, it was pecl
Thanks, I'm a tad rusty

Yeah I've been using coppermine
But I don't know crap about php so when I really want to customize
it's near impossible for me

pear list -c pecl or some such would work too

gets frustrating

you're going to run with that with most thing
s

yeah
I should probably learn PHP
on a scale from extremely difficult to impossible
how hard is it

uhh

because it seems real hard

it's relatively easy

any advice on where to start?

get the visual book on php
(PHP published by Visual)

hm, okay, maybe it wasn't pecl. Or maybe it was installed by hand, and that's why it wasn't on the list (eg. from source).
require_once() [a href='function.require'function.require/a]: Failed opening required 'DB.php' (include_path='.:/usr/share/php') - that's the error, hm, I know it's pear, I think. /me googles

ok

php config-show
make sure the php_dir is set to /usr/share/php

does anyone here have any experience with coppermine?

http://pastie.textmate.org/83005 - what's wrong with that?

Hm, php config-show says Could not open input file: config-show. And where is php_dir set? I don't see it in php.ini. hmph

Could PHP be used so that, if I were to choose an item from a drop down box, it writes a table depending on what I selected?
Would I have to write the HTML using PHP?

sorry, pear config-show

why couldn't you do that?

oh, hehe

I'm not sure how I could accomplish it
PHP can't write into an HTML page that's already there, if I am not mistaken?

1) Formulate the problem 2) think hard 3) code solution

print "table$variable/table"; or….

Hm, yup, php_dir is /usr/share/php. I'm moving stuff from one server to another, and I forget what DB.php is.

No, PHP is a server-side language and HTML is static.

print "table" . $variable . "/table";

You can always use EMCAscript.

hey who can put PHP programming into a nutshell for me

you can use AJAX too

[domon]: I would but I don't really know any Javascript. D:

google xajax
you dont need to know a drop of JS
all done in PHP

Hmm. This looks interesting. I'm assuming, since it's PHP, I can use it with MySQL also?

PHP is a programming language, commonly seen with web frameworks. End.

yup

My PHP-based system now uses MySQL, that's where it gets the data for the HTML Table from

If you have mysqld running and PHP is built with MySQL support, yes.

yeah not really what i was looking for
cool though

http://pastie.textmate.org/83005 - what's wrong with that? T_T

hrpmh, what function i need to cleanup text retreived from database, that has " and ' in it that i need to echo thru html
tried addslashes, not work, i forget what's out there

grr, apache creates a directory, then can't delete it, permissions are 0777

why is apache creating a directory?

a directory for an ftp user

what is ownership of directory created?

Apache

what is group?

it has all permissions set
windows doesnt have groups
well, not in the same sense

are you sure its apache creatign the directory?
never knew it too have such a feature, but i never use it on windows either

pretty sure
the owner is apache, and it's created the same time i run the script
hmm, something weird is going on D:

print filesize("/var/www/vhosts/iptriple.com/httpdocs/API/iptlogfile.txt");
returns 0 everytime :|
tho the file does exist…

sounds more like a problem with windows than apache, i'll try afew more things

http://thatvideosite.com/video/4607

this script is php you talk about ?

well this is a php channel

solution, dont run apache on windoze :P

well php is creating the dir?

maybe i'll just go back to running apache as SYSTEM

as user apache

php runs under apache

safe mode?

no safe mode
unlink(CFTP\root\home\test) [function.unlink]: Permission denied in Dwww\dev\admin\ftp\user.php on line 43
i'll try delete it manually as the apache user

can someone help me really quick

tag

PHP has a function for this, $text = nl2br($text) to convert newlines to BR tags
so echo nl2br(file_get_contents($blah)); would work

i did that but now the text do show up

why not just use \n for newlines?

\n is fine for console
if printing to browser, \n !=

well this is what i have

yeah

php $text = nl2br($text);
echo nl2br(file_get_contents($news.txt)); ?

which is the whole point in conversion

permission denied

\n?

tags in where the newlines are, which could change how your site looks

it can write files into it but can't chdir into it

php echo nl2br($text); ?

TehSausage, i think you need to start conversation from scratch, sound like theory… why is script making directories as apache and not as user running script?

it's just a simple script to add/delete ftp users

is there a php-suexec or whatever?
for windows

okay apache user can delete from bash

cuz apache is deleting it, sounds like user is trying to delete which is why denied

have to use file_get_contents or else the content in the file wont disply on screen
have to use file_get_contents or else the content in the file wont disply on screen

file_get_contents = file into string
file = array

php echo nl2br(file_get_contents('somefile.txt')); ?

can someone tell me why print filesize("myfile") returns 0? the file is 777 for permissions, and definitely exists, as i can see it via FTP and shell

is the file bigger than that? rofl :P

because = the result
0 = the result

erm..?

[domon]: Well, what is the actual size of the file?

690 KB
706,220 bytes

oh joy, is_writable('C\FTP\\root\\home\\'.$user) returns true aswell

it worked thanks

anyone?

[domon]: You can try if (file_exists($filename)) print filesize($filename); else print "File doesn't exist?\n";

it exists

that way you can make sure you're referring to the file you think you're referring to… we don't know where this file is (same dir as the script? somewhere else?)

har har
found the problem

i think you have to take out \n

i had fopen(filem, w+) before print filesize(file) XD

hiddenfellon, why would he need to take out \n ?

hi

let's see if I can figure this out

how can i make a string always to be 10 digits? i tried all - $tmp = sprintf("%-' .10s", doesnt work

hello

use substr($string,0,10)
so $string = substr($string,0,10);
that will make it 10 digits

and this retuerns also 10 digits if the string has only 5?

well, no
then it would be 5

thats my problem

strpad

then just add some stuff onto it

I'm trying to figure out how to read data from a database using this

I want useing the javascript source.

strpad(substr($x,0,10),10,'0',STR_PAD_LEFT);

how can i do it?

thx

$row = mysql_fetch_array($query); this array value $row .. how can I using the javascript var i=[]; ?
db query and var a=[]; a==$row?; alert(a);
function Array() { [native code] }

you cannot do that
JavaScript and PHP have nothing to do with each other.
You need to loop through the results in PHP first, and assign them in JS during loop

Artnez, okay.. I know loop .. but it's very long line.. :-)

example - php echo "var results = new Array();\n" for( $i=0; $isizeof( $results ); $i++ ) { $result = $results[$i]; echo "results.push( '$result[name]', '$result[address]', '$result[other_field]' );";

so I will find better skill ^^;

in any case, you can't share variables between PHP and JavaScript, please read the basics of these 2 languages to understand why.

Artnez, thanks.. :-)
good man..

does anybody where i can get fonts fot FPDF?

Yes. Offtopic.

Jafet, can you tell me where?

I don't know.

Jafet, You said Yes!?

what does that have to do with PHP?

You asked if anybody knew. Somebody probably knows, so the answer is yes.

Artnez, yes . the class is written in PHP

Ask an inappropriate question…
If I write a PHP script to serve fetish hardcore gayporn, does that make fetish hardcore gayporn a valid topic of discussion in this channel?

Jafet, do you think you are "cool"? i don't think so

Yes, I think certainly think highly of myself. I don't see how that has anything to do with this, though.

I think he's cool too!

damike, google probably knows

He's convinced me too

stay on topic here please, do some googling

He seems pretty cool to me.

Jafet, here are PHP developers - i don't say the problem to ask such a question - just idioits complain about that!
see

In English please?

lol

Jafet, the last part is enough for you

?

And here he comes, straight into the troll-trap, folks!

damike - ASL?

just to questions about *php code* and you'll be fine

Artnez, …

google search for "fpdf fonts", could you know have done that?
the first result is what you need
you'd have all of your fonts ready by now if you spent that time google searching

Artnez, i still tried to convert manually

whatever, just use google. i believe this channel is to help people learn PHP better, not how to operate proprietary librarys that convert font files to PHP files

"The award-winning Opera Web browser The coolest, fastest, and most secure Web browser available." - those are rather bold claims =/

hello

ShaunOo`: Bold… but true!
Firefox doesn't count because it's an XUL interpreter, not a web browser.

Artnez, no problem so far - but at the moment there a no people here asking PHP questions - so i can't understand why IRC people have problems with that - the "my holy channel" thinking .oO

you are ignored. im not an admin, talk to them :-/

I'm sure there are lots of user in this channel who know where to find fetish gayporn as well. That does not make it appropriate to ask for fetish gayporn in this channel.
s/user/users/

ShaunOo`: Opera is great. Only problem that I have is it doesn't have a lot of community plugins like FF.

which functions can i use to list in a web page the last 5 files that have been modified or added inside a directory ?

ShaunOo`: IE: the web developer plugin sucks, whereas the one for firefox is great

http://xkcd.com/293

Artnez, ahh. IE and Opera - where is the PHP part? …
troll channcel

#phpc

:p
funny pic
anyways

All the functions needed should be neatly categorized in the manual.

do you know them

you were talking about FireFox?

Check under Filesystem and Directory, or something.

k thanks

No, I don't. I do know where to find them.

My Name is Blah My Name is Halb, how do you make it some preg_replace only replaces between the first ocurrence of My Name?
so*

To throw damike off. Nevermind.

use the filemtime() function

is it recursive ?

Generally preg_replace will find the first occurence My and the last occurence of Name
Can you set it to non-recursive?

um, no. you need to specify the filename as a parameter.

No LongBeach. You have to traverse directories yourself.

just loop through the dir and sort

ok, i hope it's fast

If it isn't, don't use PHP.

nah, traversing recursively through a large directory tree is not fast in any way, php or not

PCRE regex isn't recursive by default, if I understand what you're asking that is…

Doesn't preg_replace only replace the first occurence unless you use the global flag…

I want to replace the first My Name not what's in between…

it would help to use special naming conventions for the filenames

I am not sure guys

http://www.the-art-of-web.com/php/dirlist/

tell us the original text and the way you want it to be
can't guess what you want

"My name Chad"

preg_replace('/My name/', ''); ?

"My name is Bob My name Chad", it's already null thankfully.

Artnez, I prefer Opera for PocketPC but not for desktop for some reason *shrug* but regardless, it's THE best mobile browser.
Hell, even IE for mobile is better than Minimo :P

preg_replace doesn't look at the first occurence and stop, it looks at the end of the string and then replaces..

so you want to remove the "is"
is it *always* "is", or can it be something else?

What's your expression?

Well the REAL string is:
"SELECT [….] FROM WHERE ( SELECT FROM […] WHERE [….] )" and I want to replace the FIRST occurence of SELECT FROM and place something like count(*) inbetween it. only the first occurence.

are you trying get total results for DB query?

yes
I have a bunch of union'd statements

there is a better way

So I have make them sub-queries
What's the better way? I haven't see any other way to do it…
heh

SQL_CALC_FOUND_ROWS

Use a non-greedy match.

http://www.arraystudio.com/as-workshop/mysql-get-total-number-of-rows-when-using-limit.html

Or that.

sorry, i had to google it. couldn't remember the exact thing

Interesting, I'll try it.

read the MySQL docs on the topic here: http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows
note what they say about unions
will probably be relevant to your situation

Interesting, thank you so much for that Artnez, that helped me immensely.
No preg_match needed =D

$var, $_POST['var'], $HTTP_POST_VARS['var']

i think im going to buy a hat tomorrow so i can really tip it, thats such a smooth thing to do
use $_POST

ok. just out of curiosity is there a reason why everyone doesn't just use the shortest version?

learn the difference between superglobals, read up here:

http://bin.cakephp.org/view/851322774

http://php.net/manual/en/language.variables.predefined.php#language.variables.superglobals

alright thx

please dont forget to read up on
*register_globals*

well i'm reading a book right now. just haven't gotten to superglobals and stuff yet

how old is the book?

$arr[0][0]['count'] ?

2005. it talks about php5

oh…

but thats the newest

hey
how do you calculate sysdate minus 2 weeks ?

arg the websites talking about php6. i wish technology would pause for a moment sometimes :P

go back to kernel 2.2 then

ha

Thanks Artnez again, that really saved me A LOT of time and actually improved a lot of things

or go back to Rasmus Ledorf's mother womb

cool

Can somebody say 'unbirthing' … ew ..nothing could be more worse

uhh wtf lol

what do you guys think of MVC?

it will save your life
just dont use somebody elses code to do it

what do you mean? not use a lib?
or an MVC framework, rather
im thinking of using CodeIgniter

yeah. Look at how frameworks work, and learn from them, and create your own to suit your needs

well, i did, but it doesnt use MVC
and i'm doing just fine with it

it all depends on what you want your site to do

it actually acts alot like MVC does, except with Models and the file structure is slightly different

if your site has a 'one-look-and-feel' based system, MVCing is going to be a big timesaver
aaah… MVC = Model View Controller
so 'except with models' == wtf?

*without, sorry

oh :P
imo, file structure is unimportant
its how the code is assembled that counts
nasty = include trees

yes, i avoided this well

include("bigincluderfile.php") ?
ive worked on so much code that includes more than nessecary to make a page work, and its hell trying to work out what exactly it does

yes, i dont do that at all. there's only one place where includes come from and that's the main.php file (which is the starting point)

imo, the MVC philosophy basically equates to keeping the problem domain in the one place

i guess i'll stick with my framework, it's been working great for half a year with no problems
was just second guessing myself as i always do to try and better myself :]

yeah, if it works good, and development is fast, i say dont change unless you _know_ something else will work better ^_^

ha, i need to take a week or two break so i can pull my code together and make it rapidly deployable (ie; create an SQL schema and refine it, maybe an installer files)

my biggest task atm is modularisation for easy slap in from one site to the next

i actually just finishe that upgrade

my MVC aint perfect yet,

at the moment the framework comes with MySQL database handler, data objects, session handling, etc
in the config, you set the libraries you want to load
some are dependant on one another, so errors are raised appropriately

why raise errors? why not just be smart and include what you need?

the biggest gotchas i keep having where there are modular interactions, but the interactions are always different depending on the task :/

because there's no overhead by raising the errors. let's say i have a code profiler. instead of including the profiler only when i need it, i can save time by just disabling it
if statement checks of config wants to load the profiler and other dependant classes make sure the profiler is loaded with another simple if statement - no problemo
regarding my page modules, i do a different system than MVC. i have a dir name "modules". my-site.com/my/profile will be modules/my/profile.php

is there a quick way to sort, in a chronological order, an array filled with (value, date) fields ?

usort()

url-php relation is a must, seen too much abuse of mod_rewrite and

thanks

ok so you should use $_POST['var'] instead of $var but what if you are defining a new local variable which obviously wouldn't be in the POST array. $var may not work because the register_globals setting may or may not be on
the book I'm reading just keeps using the $var format for local variables

url-php

Url has at least 1 file that exists in the FS which is an obvious and unique entry point
maybe not for paramters, but use some common sense

my page system doesnt do that, and it works fine. as said: site.com/my/profile accesses /modules/my/profile.php

as it should

nvm got it

i hate dealing with some systems that have doc_root/my_profile.php, which includes like 30 libraries and a 'main.php' file at the top

/my/profile and /my/otherprofile dont both call the same php script, which then does magic

theJackal, well this is how i deal with parameters

yeah, i know exactly waht you mean

lets say you want to view someone's profile
site.com/user/theJackal is /modules/user.php

by parameters, i mean, numbers, names, etc, ie: things youve watned to clean out from the ? part of the equation

what i basically do is traverse the modules directory
using the url
in this case it sees that there is no /modules/user/theJackal.php so it goes up one
and it finds /modules/user.php
then it takes everything that was in front of the found module (in this case "theJackal") and appends into the $_GET method with numeric array
so to access the username, you would access $_GET[0]

thats good :P .. but im saying the problem is when dumbasses do a mod-rewite to site.com/user/thejacakal == index.php?dir=user/theJackal
and then have no file even with user in it

ooooh, i see
when i came up with that idea for numeric keys for $_GET it felt like fate, as all keys for $_GET are strings

you just spend hours looking through code to find somehting as trivial as a html syntax error

the one thing that interested me about MVC is keeping the page module in a class file
so in the constructor i could assign template values each time

and then theres people who combine that stupidty with _NOT_ using MVC, and have about 20 versions of every file

in my case, i need to have seperate files for update/delete/etc
/modules/user/delete and /modules/user/update

and _NOT_ usins svn*

brb

people who dont use an RCS need shot
repeatedly
in the balls
( tennis ) _

i dont, dont shoot only because i do all projects on my own and for some reason every client needs everything "NOW NOW NOW", thus i just skip version control and get coding right away
i've implemented good version control a few times though, when designers and other developers were coming onboard later on
i had one nightmare situation when there was no version control and developers were overwriting updated files with their older ones when they made updates
the amount of times i got the "hey can you update your version of some_file.php because i overwrote it with my old one" phone call was unnerving

is it possiable that the file get command wont let you change the size of your content in your text?

can you rephrase?

ill just tell you my problem
i used this command to get the content of my txt file to display php echo nl2br(file_get_contents('site.txt')); ?
now when i go into txt file to add html it wont work
for example FONT FACE="Times New Roman" SIZE="12"something here/FONT
it displays at size 24 i think
but its not 12 thats for sure

that's an HTML problem, size=12 is not size 12
first of all, start using CSS in external css files. second of all, do "font … style="font-size: 12px;"something here/font

I have a database table that stores, a username and the date when a user loggedin, if the user presses the logout button he gets removed from the table, but if he turns off the browser he stays logged in in the db table, how do i remove him from that table when he turns off the
browser?

http://www.htmlcodetutorial.com/character_famsupp_92.html
there is no reliable way of doing this

i see. Any way that might work?

you need to create an "updated" field, that updates to a new DATETIME (NOW()) whenever they refresh the page
then you could say that if he/she didnt access the website in the last 30 minutes, their session is expired and you automatically remove it

font, what I would do:, add another column, 'lastPageLoad', update it every time they load a page with the unixdate. Add another query that searches the table for any lastPageLoad older than 20 minutes and remove it

you'll need a maintenance function that either runs from cron, or runs on every page load (more overhead) to do this
you can use javascript however

A cron would be more preffered but if you must, just do it on page loads
*cronjob

I think i can manage on page loads, cause the page won't have much traffic.

javascript has an event called onunload(), it is called whenever the page is closed. you can trigger the "logout()" action using this event.

interesting.

Artnez, like you said, not very reliable

Is there a way in php5 to extend more then one class?

unfortunately, some people might have javascript turned off, so it would probably be good to implement both the session timeout and the onunload() methods

I see, thank you for the insight.

you mean like ClassA extends ClassB extends ClassC?
if yes, then no you can't

ShaunO` solution is very good. (with additional column)

-sigh- thanks ;|

http://us3.php.net/manual/en/language.oop5.basic.php
"A class can inherit methods and members of another class by using the extends keyword in the declaration. It is not possible to extend multiple classes, a class can only inherit one base class."

And i get the pageload from js?
Oh no. I get it now.

what you would need to do is use the onunload() to trigger another page via ajax or similar

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.


Blog Tags:

Similar posts: