Re: [PHP] please help with this simple problem
i tryed it and it ended up having an error that was caused originally by a lack of a $ on the 3rd line variable... after i fixed that it said wrong perameter count for fopen() on the third line, and "Warning: Supplied argument is not a valid File-Handle resource" for the remaining lines below that in that block of code. i'm sorry, i'm kinda new to this : ( "Stewart Taylor" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You need to copy the contents of the current file. Then recreate the file by writing the new message then writing back the original contents. e.g. $fname = basename($PHP_SELF). ".comment"; $fsize = filesize($fname); fp = fopen(basename($fname)); $data = fread($fp,fsize); fwrite($fp,$message); fwrite($fp,$data); fclose($fp); -Stewart -Original Message- From: adam [mailto:[EMAIL PROTECTED]] Sent: 22 March 2001 11:17 To: [EMAIL PROTECTED] Subject: [PHP] please help with this simple problem i am coding a simple script to post a text area into a file. it works, but it posts it at the bottom and i wanted to have it post to the top of the text already there.. here's a snip of the important part of the script: $fp = fopen (basename($PHP_SELF) . ".comment", "a"); fwrite ($fp, $message); fclose ($fp); } any help would be much appreciated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] please help with this simple problem
it works now, only it's earasing everything and then writing to the file. i think we have almost got this figured out. here's what the code looks like for the entire tag... --- ? if ($message) { /* uncomment the next two lines to strip out html from input */ $name = strip_tags($name); /* $message = strip_tags($message); */ $message = ereg_replace("\r\n\r\n", "\nP", $message); $date = date("l, F j Y, h:i a"); $message = "font size=2 face=verdanaba href=mailto:$email$name/a /bfont size=1 -- $date/font\n blockquote\n $message\n /blockquote/font\nhr noshade color=white size=1 width=100%\n"; $fname = basename($PHP_SELF) . ".comment"; $fsize = filesize($fname); $fp = fopen(basename($fname),"w+"); $data = fread($fp,$fsize); fwrite($fp,$message); fwrite($fp,$data); fclose($fp); } @readfile(basename(($PHP_SELF . ".comment"))); ? ""adam"" [EMAIL PROTECTED] wrote in message 99cmfj$mai$[EMAIL PROTECTED]">news:99cmfj$mai$[EMAIL PROTECTED]... i am coding a simple script to post a text area into a file. it works, but it posts it at the bottom and i wanted to have it post to the top of the text already there.. here's a snip of the important part of the script: $fp = fopen (basename($PHP_SELF) . ".comment", "a"); fwrite ($fp, $message); fclose ($fp); } any help would be much appreciated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] please help with this simple problem
it works now, only it's earasing everything and then writing to the file. i think we have almost got this figured out. here's what the code looks like for the entire tag... --- ? if ($message) { /* uncomment the next two lines to strip out html from input */ $name = strip_tags($name); /* $message = strip_tags($message); */ $message = ereg_replace("\r\n\r\n", "\nP", $message); $date = date("l, F j Y, h:i a"); $message = "font size=2 face=verdanaba href=mailto:$email$name/a /bfont size=1 -- $date/font\n blockquote\n $message\n /blockquote/font\nhr noshade color=white size=1 width=100%\n"; $fname = basename($PHP_SELF) . ".comment"; $fsize = filesize($fname); $fp = fopen(basename($fname),"w+"); $data = fread($fp,$fsize); fwrite($fp,$message); fwrite($fp,$data); fclose($fp); } @readfile(basename(($PHP_SELF . ".comment"))); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] writing to a file
how might i write to a file called "comment.php.comment" and only write the text specified to the top of the file, instead of writing it to the bottom? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] writing to a file
how would that look on a code view? i plan to write the variable $message on top of the existing data ""hi"" [EMAIL PROTECTED] wrote in message 99ektl$gf0$[EMAIL PROTECTED]">news:99ektl$gf0$[EMAIL PROTECTED]... Don't even bother with that previous answer. You have what you want to write in a string, $new. Read the file and put that into another string, $previous. Then concatenate the strings with the "." operator: $previous=$new . $previous and write $previous to the file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] writing to a file
nevermind ^^ i am jsut going to have posts that go from top to bottom oldest to newest -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] i get this for some reason
everytime i post text to this file, i get the characters " and ' turning up as \" and \' is there anything i can add that would keep them from outputting into this? here is the code i use: ? if ($message) { /* uncomment the next two lines to strip out html from input */ $name = strip_tags($name); /* $message = strip_tags($message); */ $message = ereg_replace("\r\n\r\n", "\nP", $message); $date = date("l, F j Y, h:i a"); if ($email == "") { $message = "hr noshade color=white size=1 width=100%\n table width=100% cellpadding=10trtd\n font size=2 face=verdanab$name /bfont size=1 -- $date/font\n blockquote\n $message\n /blockquote/font\n /td/tr/table\n\n"; } else { $message = "hr noshade color=white size=1 width=100%\n table width=100% cellpadding=10trtd\n font size=2 face=verdanaba href=mailto:$email$name/a /bfont size=1 -- $date/font\n blockquote\n $message\n /blockquote/font\n /td/tr/table\n\n"; } $fp = fopen ("comment.php.comment", "a"); fwrite ($fp, $message); fclose ($fp); } @readfile("comment.php.comment"); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] i get this for some reason
p.s. the submitted text $ message is what is returning the wierd quote marks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] i get this for some reason
but i am not talking about running a server, i am just using php on server space that has php installed. what code would i incluse to get rid of this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] i get this for some reason
thanks a bunch ^^ it works great -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] writing to a file
how do i write to the beginning of a file instead of the end? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Help! (How are sessions intended to work?)
Sukumar S. wrote: Dear Adam, Are you using 'realm' authentication setup? Yes I am.. any ideas? My Setup Specs -- PHP 4.1.1, MySQL 3.23.36, Apache 1.3.19 with mod_auth_mysql on OpenBSD 3.0 (OS). Issue - Scenerio: User provides user_id and password. user_id and password are checked against the database (MySQL). If authentication is true the a session is started based on thier user_id. If autehentication is false Error 403 is displayed to user. How do you destroy a session/user authentication so the user can not use the browser back button? I have session_destroy() which seems to work fine (deletes session files in /tmp) but when you press the browser back button the exact session that was supposidly destroied is created again. I've tried using unset() to reset variables but that doesn't seem to work either. Any ideas... please epxplain this to me. I'm total lost why this isn't working. BTW, I'm using cookies. Another question I would have is.. to kill the cookie do I have to use set_cookie to remove the cookie from the users browser or is this also destroied in the session_destroy process? If it is suppose to be why is it not doing so? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: ucwords added functionality?
i could roll my own, and for now will just use a str_replace after ucwords, but would it be possible to add an optional parameter to ucwords which would be an array of words to skip? i would think this would be useful to many. that sounds like a good idea to me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: PHP Dreamweaver / Fireworks
Sometimes I find it easier to build web tables inside fireworks, but I also need to embed PHP code into the table (ie. to display the date, logged in user, etc). Well, this is a pain because fireworks overwrites the entire PHP file every time I make a change to it. If there's no PHP to embed I just require the HTML file with the fireworks output in it. I am tired of cutting and pasting my PHP code! ;-) How do you guys handle things like this? Thanks. I don't USE a wysiwyg program to edit tables or html. Unless it's made for php (yeah right i'd liek to see that) it's not gonna be able to tell what you want. Maybe get phakt for Ultradev or something. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Form Data
maybe your field is set to INT -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] splitting a string in half
I wish to split my databased string in half to be shown on 2 seperate columns, but also preserve whole words. Is there a function that does this already? Maybe a quick fix? Hopefully something that doesn't include html tags as part of the string to split. If it's not that specific then that's okay. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: word wrap
http://php.net/manual/en/function.wordwrap.php -Adam www.wangallery.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: problem with form values
show us a snippet so we can evaluate the cause -A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: problem with form values
i would say do this urlencode the string (it should use %22 or something for the quote marks) then un encode on the recieving page -- one thing you might try is this $sql = 'SELECT * FROM whatever WHERE'; while ( $quotes = explode('', $Keywords) ) { $q = 0; $s = 0; if ($q *= 2) { }else { if ($q == 0) { $or = ' '; } else { $or=' or' } $sql = $sql . $or . ' Keywords=/'' . $quotes[$q] . '/ ' ; $q++; } }else{ if ($s == 0) { $or = ''; } else { $or=' or'; $s = 0; while ( $spaces = explode(' ', $quotes[$q] ) { $sql = $sql . ' Keyword=/''. $spaces[$s] . '/'; $s++ } } this is most defnitly wrong in many ways, but i'm not gonna spend another hour thinking up what's wrong with it and bug hunt. this gives an idea. heh, you were probably just woundering about urlencode or stripslashes... oh well just a thought. maybe a pro could step in and say something useful. -A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] I am making a mailing list but....
amen. a database solved my data storage for good and i could never get along without it now. also scripst like these can currupt files that it writes to if a person does certains things while browsing. (ex. refreshing realy fast) get a DB it's way easier to manage. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: limiting rows and pages like google -- again
i spent a good day learning how to do this from scratch. I'll post my code and you can decypher it yourself. ?php $select_all = mysql_query(SELECT id FROM images WHERE directory='original'); $select_result = mysql_result($select_all,0); $select_numrows = mysql_num_rows($select_all); $i=1; if (!isset($page)) { $page = 1; } if ($page != 1 ) { if (($page-1) == 1) { echo 'a href='.$PHP_SELF.'laquo;previous/anbsp;'; }else{ echo 'a href='.$PHP_SELF.'?page='.($page-1).'laquo;previous/anbsp;'; } } else { echo 'font color=#99laquo;previous/fontnbsp;'; } while ($select_numrows 0) { if ($page != $i) { if ($i==1){ echo 'a href='.$PHP_SELF.''.$i.'/anbsp;'; } else{ echo 'a href='.$PHP_SELF.'?page='.$i.''.$i.'/anbsp;'; } } else { echo 'font color=#99'.$i.'/fontnbsp;'; } $i = $i+1; $select_numrows = $select_numrows-20; } if ($page ($i-1)) { echo 'a href='.$PHP_SELF.'?page='.($page+1).'nextraquo;/anbsp;nbsp;'; } else { echo 'font color=#99nextraquo;/fontnbsp;nbsp;'; } ? hope this helps. it took 2 days straight to debug and develope. obviously you would use different database values though. -Adam god bless amarica -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] phpMyAdmin problem that might have you fustered
I found that if you were trying to back up a database in this application, and you had a # mark anywhere on an entry, this would cause a fault when you tried to reload the script back into the sql statememnt. you will have to make a find and replace script on page to convert it to a different character combination and then have it pull back the value by replacing all uccurences of that combination into the # again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Thank you Rebecca
actually i've had that problem... i converted all # signs to numsym before entering it into the db and then converted back to # on the page after retrieving the values. -A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] input type=image name=done value=done doesnt work as expected
an input tag of the type image cannot pass a name and value. therefore you will have to use a script to detect if both the button and hidden are passed or jsut the hidden. applying a hidden is helpful for this. ?php if ($done1 $done2) { $done2 = ''; } echo $done1 . 'br'. $done2 . 'br form action=' . $PHP_SELF . ' method=post input type=hidden name=done2 value=done2 input type=submit name=done1 value=done1 input type=image src=image/done.gif /form '; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] while statements output to variables
i need to write a while statement to a variable that will later be echoed again on another page after including this file to it. i need to repeat a statement over and over in it and i do not know how. ?php $variable = 'table tr td' . do { 'fontdata to be outputted/font' }while ($something = mysql_fetch_array($query)); .'/td /tr /table'; ? any help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Announcement: DEF CON 9 PHP Talk
Hello, everyone. I've been reading the list for a few years now and wanted to let you know that I'll be giving a talk on Data Mining and Web Security With PHP this year. I'll be speaking on Friday afternoon so anyone in Las Vegas the weekend of July 13th who's interested please attend! For more info, see www.defcon.org Thank you, Adam Bresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] multiple outputs to mysql_query()
i want my mysql query result to output 2 mysql output rows for every tr set. I'm used to just doing a do/while statement for a single mysql output per row. example: //the code i have essentially does this - ?php echo 'table'; $result = mysql_query(SELECT * from table WHERE type='default'); do { echo 'trtd ' . $myresult[column] . '/td/tr'; } while ($myresult == mysql_fetch_array($result)); echo '/table'; ? //outputs: table tr tddata for row 1/td /tr tr tddata for row 2/td /tr ...etc... /table --- i want it to output like this: table tr tddata for row 1/td tddata for row 2/td /tr tr tddata for row 3/td tddata for row 4/td /tr ...etc... /table -- if anyone can help me with alternating like this or knows where i can find a resource tutorial on it please tell me.. thanks -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] multiple outputs to mysql_query()
I'd do this: ?php echo 'table'; $result = mysql_query(SELECT * from table WHERE type='default'); $numrows = mysql_num_rows ($result); while ($numrows) { $row = mysql_fetch_row ($result); echo tr\ntd$row[0]/td\n; $row = mysql_fetch_row ($result); echo td$row[0]/td\n/tr; $numrows = ($numrows - 2); } echo '/table'; ? thanks so much for the help, that'll be a great reference for any other similar types of output i need. some things i had to fix for others viewing this thread: while ($numrows) had to be changed to while ($numrows = 1) or the while statement would loop forever. (server hangup) i had to accomidate and if statement to check if the amount of $numrows left was = 1 -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: poor HTML syntax crashing (!) netscape
I completely agree, Dave... I use IE 6 for browsing, but when I develop sites, I always test them for backwards compatibility all the way down to Netscape 3.0. If your site renders properly in NS 3.0, then you can rest assured it will render correctly for the majority of web users out there. I also test my page for netscape compatibility, but only down to 4.7 and to make sure it looks good in version 6 as well. Personally i perfer IEbeta6 for personal browsing. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Store uploaded files in MySQL-BLOB
I would suggest setting the database column to LONGTEXT instead of BLOB since it can accomidate far more characters per entry. As for the entry to the database through php, I'm not entirely sure what method you're using to add these. Are they uploading their file and then it reads it as it exists on the server? Is it supposed to read a file they specify with a browse but never actually upload it anywhere? It might be better to just include a text field for them to cut+paste to in a form if it's nothing but text. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: PHP] Re: Store uploaded files in MySQL-BLOB
The project is a kind of knowledge base. For each entry a user creates, he should be able to give additional information, such as every kind of file (i.e. not only code files but also images etc). There is an input type=file ... where he selects the file to be uploaded. The php-script is simply supposed to receive the file and put it into the proper database-column (which is a MEDIUMBLOB by the way, should be enough space, or what's your opinion?). in my opinion you'd save yourself some major hassle by allowing them to ftp files like this directly to a server's directory via form based ftp. then perhaps add a column that adds filenames to itself with the UPDATE sql query type. this should be enough info for you to write php that could handle a listing of these dynamicly. I'm still not entirely sure the details but this is what I would do in the same situation. A db engine is for text, a server is for storing files. IMHO -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: IE cookies don't expire!
define a variable to be set on refresh along with the URL that erases the cookie by setting it's expire to time() minus a month or so. If you don't want the url varibale passer to show then have it set the cookie then to a header redirect to $PHP_SELF. ?php if ($refresh) { setcookie('cookiename', '',(time()-25920),'/',$HTTP_HOST,0); } if ($refresh) { header(location: . $PHP_SELF); exit; } ? use that in the beginning of your page and be sure to add a ?refresh= to your refreshing url. hope this helps with what i know about the subject. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Variables
try this little form example out: --example.php-- ?php if ( (isset($t1))(isset($t2)) ) { if ($t1==$t2) { echo they are equal; } else { echo they are not equal; } } ? html body br br form name=form1 method=post action=?=$PHP_SELF? input type=text name=t1 t1br input type=text name=t2 t2 br input type=submit name=Submit value=Submit /form /body /html -/example.php-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: GetImageSize
For some reason, at random and without warning, the function just seems to stop working and does nothing but wait and timeout at 80 seconds. When you go to the page say www.somedomain.com it just waits and does not load anything for 80 seconds, and when it does, the images that use GetImageSize do not load. Example of the code perhaps? I've never had a problem with that function. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] What the heck is this
I've seen this around alot ($a-$z) and i'm woundering what it is and what it does. I'm specifcally talking about the arrow thingy -. I've never seen it before so i was kinda curious. thanks -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What the heck is this
I've done quite a bit of php coding in the past few months but never had the need to use this and therefore never learned anything about it. It's hard to ask about it because i have NO idea what it is at all. Is it to give spanning values? I was woundering if anyone knew specifically what it did. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: MAIL to a Bcc: ???
How do I change the value of the TO: in a mail() function to a value of Bcc: ? Or at least trick the mail to a Bcc:So the recipients emails aren't shown? if you use a database to manage the emails to be sent to, perhaps you could create a repeating statement that sends mail to each person seperatly? ?php $mail = mysql_query(SELECT user_email FROM mailing_list); while ($mailarray = mysql_fetch_array($mail)) { mail($mailarray[user_email], $subject, $content); } ? something like that? -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Strong typing?
why can't you just use plan simple HTML to do it??? rather than make a larger hassle for your self ie strong howdy /strong ??? yes that is valid HTML :) Peter why do i get the idea that's not what they meant... -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Creating a .xxx via PHP
make a .htaccess file and put this in it: Addtype application/x-httpd-php .foo then upload it to your root directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] escape characters
what is a list of all the characters that have to be escaped? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fwrite()
simply add: $conteudo = stripslashes($conteudo) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] escape characters
nevermind, i found them -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Netscape 4.77 and PHP
try sending us the sample code. I use netscape 4 for testing and it seems to work just fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Newbie question: Page Counter
make a file called counter.php and include this text: //-counter.php-- ---// ?php //Simple PHP counter, v0.1. Send comments to [EMAIL PROTECTED] if (file_exists('count.inc')) { $fil = fopen('count.inc', r); $dat = fread($fil, filesize('count.inc')); echo $dat+1; fclose($fil); $fil = fopen('count.inc', w); fwrite($fil, $dat+1); } else { $fil = fopen('count.inc', w); fwrite($fil, 1); echo '1'; fclose($fil); } php? //-- --// then make a file called count.inc and chmod it to 777 so anyone can write to it. insert a number into the file. //--count.inc--- --// some value //-- --// then all u have to do is include the line: ?php include (counter.php) ? into the page you want a counter hope this helps :) i use this script myself -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] passing variables
how could i pass a variable between pages without them seeing the variable stated in the URL? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] redirection to another page function
use the javascript function, but also use as backup plan such as a link at the bottom or even code at the top like this: /// if (conditionals == true) { header(location:home.html); } // that way it will get through for most all browsers if not all browsers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Session variables are not stored when set in implicitly called constructor!??
Hallo everybody, hope I am writing to correct mailinglist(^_^*)... I have troubles with sessions and descructor in php5. Can not set session variable in destructor when it's called implicitly. Do You know solution please? I think problem is that session is stored before imlicit object destruction *doh* example.php: ?php session_start(); session_register(variable); // singleton for request class Request { function __destructor() { $_SESSION[variable] = hallo; } } $req = Request::getInstance(); $req-doSomeThink(); echo This should be hallo 2nd time: . $_SESSION[variable];// unfortunatly this is not set echo a href='example.php'Click and cry;-(/a; // implicit desturctor call ? Thank You very much... BR a3c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session variables are not stored when set in implicitly calledconstructor!??
Hallo again, thank You for Your response. // singleton for request class Request { function __destructor() { $_SESSION[variable] = hallo; The __destructor() method is supposed to be about killing the class (Request). It's probably bad practice to be changing $_SESSION vars inside of there even if that $_SESSION var affects your class. Here, read this page and maybe it will make more sense to you: http://php.net/manual/en/language.oop5.decon.php i agree that in *most* cases destructor should only clean up after object. unfortunatly for request class there are few requirements: 1) must allow immidiate use w/o any explicit initialization or finalizaion. e.g. at any file You can use only Request::getInstance()-isRefresh() /** test if this request was caused by browser refresh */. this should be one and only line (except for inclusion of request.php oc) referencing request class -- no explicit call to Request::saveToSession() or anything ugly and potentialy disastrous like that. 2) must provide mechanism for generating per session uniqe request identiers. now implemented as md5($_SESSION[next_reqest_id]++) not very effective but handy:-P 3) must be serializable (this is why i can not put that session manipulation at __sleep function) these requirements (1,3) cast out __destruct, __sleep and explicit call to some saveToSession function. do You have any other idea when to store this information , please? Heck, look at the user contributed notes since one of them will directly affect this idea of yours. *doh* i don't know how could i coverlooke taht user reaction:-( thank You. If the reference count for $req is greater than 0 (i.e. there is a Singleton) then __destruct won't be called. And why should it be called? Because, again, __destruct is for cleaning up the class while the object is getting destroyed. Isn't __destruct is called even if reference count is gr then zero as a part of script finalization? imo yes -- i tried this with echoing something within singletons destructor (no invoke with explicit delete:-) and it worked. BR a3c - Original Messages - Hallo everybody, hope I am writing to correct mailinglist(^_^*)... Absolutely! I have troubles with sessions and descructor in php5. Can not set session variable in destructor when it's called implicitly. Do You know solution please? I think problem is that session is stored before imlicit object destruction *doh* example.php: ?php session_start(); session_register(variable); *Note* You don't need to use session_register() if you use $_SESSION. In fact this probably isn't even doing what you think it is. Using $_SESSION indexes is the preferred way to go about using sessions. // singleton for request class Request { function __destructor() { $_SESSION[variable] = hallo; The __destructor() method is supposed to be about killing the class (Request). It's probably bad practice to be changing $_SESSION vars inside of there even if that $_SESSION var affects your class. Here, read this page and maybe it will make more sense to you: http://php.net/manual/en/language.oop5.decon.php Heck, look at the user contributed notes since one of them will directly affect this idea of yours. } } $req = Request::getInstance(); $req-doSomeThink(); echo This should be hallo 2nd time: . $_SESSION[variable];// unfortunatly this is not set echo a href='example.php'Click and cry;-(/a; // implicit desturctor call If the reference count for $req is greater than 0 (i.e. there is a Singleton) then __destruct won't be called. And why should it be called? Because, again, __destruct is for cleaning up the class while the object is getting destroyed. ? smime.p7s Description: S/MIME cryptographic signature
[PHP] test
tst -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] call function as variable
Hi! I have folowing function which they are a member in a class. function foo(){ something } function zoo(){ something else } and i have a array such: $test = array(1=foo,2=zoo); and i want to call the fuction foo() and zoo something like; $object-$test[1](); I have tried this this, it will not working. But is there any other way to do something like this!! cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I call a function in a Class from another function inthe same class
typically problem! have you used $this-tehotherfunction(); or just use therotherfunction();??? if you call from your class to a members method , you have use $this!!! And read more about oo-method! cheers Donpro wrote: Hi, I have two functions in a class where one calls the other. When creating my object I get an error: Call to undefined function I dont understand why the function can't be seen? Thanks, Don --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call function as variable
I got this error: Parse error: parse error, unexpected '{' in ... Cheers John W. Holmes wrote: adam wrote: Hi! I have folowing function which they are a member in a class. function foo(){ something } function zoo(){ something else } and i have a array such: $test = array(1=foo,2=zoo); and i want to call the fuction foo() and zoo something like; $object-$test[1](); Try: {$object-$test[1]}(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call function as variable
Tanks a lot! this is exactly that i want!! Cheers Michael Sims wrote: On Sat, 16 Aug 2003 07:58:27 +0200, you wrote: $test = array(1=foo,2=zoo); and i want to call the fuction foo() and zoo something like; $object-$test[1](); I've never used this myself, but this should work: call_user_func($object, $test[1]); See: http://www.php.net/manual/en/function.call-user-func.php HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call function as variable
Tanks a lot! This was exactly that i wanted! Cheers David Otton wrote: On Sat, 16 Aug 2003 07:58:27 +0200, you wrote: I have folowing function which they are a member in a class. function foo(){ something } function zoo(){ something else } and i have a array such: $test = array(1=foo,2=zoo); and i want to call the fuction foo() and zoo something like; $object-$test[1](); The fact that you say $object-$test suggests that foo() and zoo() are methods of a class? The following code snippet contains just about every mechanism for calling a method of a class that there is. The one you'll probably want is call_user_func (array ($C, 'B'), 'call 4'); ? /* Class A has method B */ class A { function B ($s = None) { echo (pinput : $s/p); } } /* $C is an instance of A */ $C = new A (); /* $D is an array of strings */ $D = array ('item 1', 'item 2', 'item 3', 'item 4'); /* invoke A::B */ A::B ('call 1'); /* invoke $C-B */ $C-B ('call 2'); /* invoke A::B via call_user_func() */ call_user_func (array ('A', 'B'), 'call 3'); /* invoke $C-B via call_user_func() */ call_user_func (array ($C, 'B'), 'call 4'); /* invoke A::B via call_user_func_array() */ call_user_func_array (array ('A', 'B'), array('call 5')); /* invoke $C-B via call_user_func_array() */ call_user_func_array (array ($C, 'B'), array('call 6')); /* apply A::B to $D via array_walk() */ array_walk ($D, array ('A', 'B')); /* apply $C-B to $D via array_walk() */ array_walk ($D, array ($C, 'B')); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions
Hi, Just a thought about sessions, they still rely on cookies working, unless you pass the session id with every link on the page. If you set your php.ini file to automatically put the session id in ever link on your page, that's great, but what if you don't have access to the php.ini file which is common with shared hosting. I'v read somewhere that you can put a php.ini file with those settings in the current working directory and it will read in the settings from it. Is that true and would you have to put a copy of the ini file in every folder that you used in order for it to work?? :) hu Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions
Hi, So with the .htaccess you could enable trans sid. That's interesting to know. I guess you could just use the session and have a session check to require the person to have cookies. Most sites these days seem to require it.. mail.yahoo.com does, if you try and login without cookies you'll get a message. A lot of sites use the trans sid, because it makes it work if the user doesn't have cookies. Thanks for the info Adam At 03:00 PM 3/22/2003 +1100, Justin French wrote: on 22/03/03 4:39 AM, Adam - ([EMAIL PROTECTED]) wrote: Just a thought about sessions, they still rely on cookies working, unless you pass the session id with every link on the page. If you set your php.ini file to automatically put the session id in ever link on your page, that's great, but what if you don't have access to the php.ini file which is common with shared hosting. I'v read somewhere that you can put a php.ini file with those settings in the current working directory and it will read in the settings from it. Is that true and would you have to put a copy of the ini file in every folder that you used in order for it to work?? That's sort-of right. 1. PHP would need to be compiled with enable trans sid first 2. You can override SOME php.ini values with a .htaccess file (placed in a directory), but this is NOT a copy of the php.ini, it's a method of overriding values. You'd also need your ISP to grant you permission to run such files. They work from a certain directory down, so if you placed the file in your doc root, it would apply recursivly down to each folder bewlow it. example: IfModule mod_php4.c php_flag register_globals off php_flag magic_quotes_runtime on php_flag magic_quotes_gpc on /IfModule 3. You can also override some php.ini values by using things like PHP's ini_set() function in your scripts. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session's length.
Hi, As I belive, the sessions (session cookies) will expire after the browser has been restarted. So even if you put the session id in a cookie, after ten days you might have your old session id, but it would be delete from the server long ago. The server doesn't keep session for that log periods of time due to the fact it would take up a lot of hard disk... Session data, is stored on the server, cookies on the browser.. If you wish to use the cookies and keep them for 10 days on the user's computer you would just want to user normal cookies.. You would want to put this at the top of your page - before any output has been sent... ? setcookie(nameofcookie, value of cookie, time()+600, /); ? the time()+600 is in seconds 600 = ten mins, so if you wanted in to expire in ten days do the math.. :) as for the / means that it will be sent to all your files.. hope this helps in some way... I'm no expert... Adam At 07:10 PM 3/22/2003 +0300, you wrote: - php-general. I used such code: $exp = 60*60*24*10; # for ten days. session_set_cookie_params($exp); But it works wrong - cookies were removed right after i have rebooted. The other way is to put session id into the cookies, but... Isn't it the same? Thank you. Yours, L0vCh1Y [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Diff
Greetings all, A while ago I was using asp and when I started using php the harder thing to learn was Dealing with dates. There isn't a datediff function like asp.. Instead you have timestamps. Powerful it may be but a little hard to learn about and use. Other wise I find php to be very nice and simple as well powerful. So what happens if you have two timestamps and you want to find out what the difference is? There has to be some function that I don't know about.. I have to be missing somethig! Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String Expression for aplpahnumeric password
I need a string expression to verify an alpha numeric password. This is what i've come up with , however it does not work: elseif ( (!ereg (^[a-zA-Z]+$, $password)) || (!ereg (^[0-9]+$, $password))) can anybody help? Thanks in advance ADAM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with 4.2.3?
output buffering = off This is already set to off Any other suggestions? -Adam Jason Wong [EMAIL PROTECTED] wrote in message news:200211021451.44280.php-general;gremlins.com.hk... On Saturday 02 November 2002 06:16, Adam Humphrey wrote: I just upgraded my PHP from 4.2.2 to 4.2.3 and now I have a problem. Right now I have some HTML with included PHP. When the client opens a page with PHP and HTML it used to (under 4.2.2) display all the HTML before the PHP and then process the PHP and finally (when processing completed) finish the rest of the HTML. This allowed my to do some DHTML to let the user know that the PHP was processing. Now with the new version of PHP (4.2.3) when I hit these pages it will process the PHP before it sends any HTML to the client. This is really frustrating. Is there some setting in php.ini that I can modify to allow the browser to get the HTML before the PHP code? Or any other way to get the old behavior? Try disabling output buffering (php.ini). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* You can fool some of the people some of the time, and some of the people all of the time, and that is sufficient. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] #color problems
Below is a snip of my script. Can't get it to use $test as a color variable!! Can anyone help?? I have tried everything i can think of (bar just using a color value instead of variable). The context is :: for formatting an XML doc. $test='#FF'; echo td width=\33%\ bgcolor=\.$test.\; Any help much appreciated, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] #color problems
Re: below, i put in global $test; Thanks for the advice... I am new to PHP, but have done a lot of C in the past so some things are familiar. Anyway, I tried your suggestion but no joy... color does not show, as if i had written bgcolor=. Any ideas??? Cheers, Adam. - Original Message - From: Marco Tabini [EMAIL PROTECTED] To: Adam [EMAIL PROTECTED] Sent: Friday, November 15, 2002 2:47 PM Subject: Re: [PHP] #color problems Since you're not substituting anything in your string, you can use single quotes and make it a bit more readable: $test='#FF'; echo 'td width=33% bgcolor=' . $test . ''; is $test defined in the same context as your echo statement (e.g. is the echo in a function and $test outside of it)? In that case, you need to add $test to your function's context by means of global $test; Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! On Fri, 2002-11-15 at 10:13, Adam wrote: Below is a snip of my script. Can't get it to use $test as a color variable!! Can anyone help?? I have tried everything i can think of (bar just using a color value instead of variable). The context is :: for formatting an XML doc. $test='#FF'; echo td width=\33%\ bgcolor=\.$test.\; Any help much appreciated, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: [PHP] #color problems
OK, color code is not present in HTML output. Very strange! echo $test; produces hte correct output though. Adam. - Original Message - From: Marco Tabini [EMAIL PROTECTED] To: Adam [EMAIL PROTECTED] Cc: PHP [EMAIL PROTECTED] Sent: Friday, November 15, 2002 3:14 PM Subject: Re: Fw: [PHP] #color problems Does your color code show in the HTML source code? If so, then it's an HTML problem! Marco On Fri, 2002-11-15 at 10:46, Adam wrote: Re: below, i put in global $test; Thanks for the advice... I am new to PHP, but have done a lot of C in the past so some things are familiar. Anyway, I tried your suggestion but no joy... color does not show, as if i had written bgcolor=. Any ideas??? Cheers, Adam. - Original Message - From: Marco Tabini [EMAIL PROTECTED] To: Adam [EMAIL PROTECTED] Sent: Friday, November 15, 2002 2:47 PM Subject: Re: [PHP] #color problems Since you're not substituting anything in your string, you can use single quotes and make it a bit more readable: $test='#FF'; echo 'td width=33% bgcolor=' . $test . ''; is $test defined in the same context as your echo statement (e.g. is the echo in a function and $test outside of it)? In that case, you need to add $test to your function's context by means of global $test; Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers Come visit us at http://www.phparch.com! On Fri, 2002-11-15 at 10:13, Adam wrote: Below is a snip of my script. Can't get it to use $test as a color variable!! Can anyone help?? I have tried everything i can think of (bar just using a color value instead of variable). The context is :: for formatting an XML doc. $test='#FF'; echo td width=\33%\ bgcolor=\.$test.\; Any help much appreciated, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sunrise/sunset programs?
Does anyone know if PHP has the capabilities of being able to calculate sunrise/sunset times by entering longitude/latitude values if someone was smart enough to write code for it? If not, is there any programs/applications around that allow for times to be entered into php after values have been worked out by the program/app? Thanks for any help. Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sunrise/sunset programs?
yes, have tried googling around... i came across one but the link no longer works: http://www.hotscripts.com/Detailed/4984.html if anyone knows of any, could they post the links here? thanks, adam. - Original Message - From: Jason Wong [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Tuesday, November 19, 2002 1:11 AM Subject: Re: [PHP] sunrise/sunset programs? On Monday 18 November 2002 15:45, Adam wrote: Does anyone know if PHP has the capabilities of being able to calculate sunrise/sunset times by entering longitude/latitude values if someone was smart enough to write code for it? I should think so. If not, is there any programs/applications around that allow for times to be entered into php after values have been worked out by the program/app? Have you tried googling around? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The Lord prefers common-looking people. That is the reason that He makes so many of them. -- Abraham Lincoln */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] templates
I am developing a site, using XML and PHP for formatting. I want to have one HTML template and call up the different XML files from a Javascript menu. Ideally i want to be able to call files from a link, such as: 'index.php?action=loadfile=file.xml' Not sure if this is the right format, but hopefully you get the idea. Cheers, Adam.
Re: [PHP] templates
Cheers for replying. I have the menu in place already, it is the PHP end i'm not sure about. Currently I have many php files which only differ in one line: $filename=file.xml; I want to be able to pass this value to the script through a link. A. - Original Message - From: Jonathan Sharp [EMAIL PROTECTED] To: Adam [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, November 19, 2002 4:33 PM Subject: Re: [PHP] templates I'm assuming you're trying to have a select list. Try this: select name=foo onChange=window.location='?=$PHP_SELF??action=loadfile=' + this.value option value=file.xmlFile XML1/option option value=file2.xmlFile foo/option /select Just make sure you test the value you get for file, so that someone doesn't pass you /etc/passwd (just an example). -js Adam wrote: I am developing a site, using XML and PHP for formatting. I want to have one HTML template and call up the different XML files from a Javascript menu. Ideally i want to be able to call files from a link, such as: 'index.php?action=loadfile=file.xml' Not sure if this is the right format, but hopefully you get the idea. Cheers, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templates
Thanks, but not sure if this is what i'm looking for I just want to setup the PHP script so that the variable $filename can be changed via a link such as 'index.php?filename=file.xml', causing the script to parse the appropriate file. Adam. - Original Message - From: Ernest E Vogelsinger To: Adam Cc: Jonathan Sharp ; [EMAIL PROTECTED] Sent: Tuesday, November 19, 2002 5:17 PM Subject: Re: [PHP] templates At 18:04 19.11.2002, Adam spoke out and said: [snip] Cheers for replying. I have the menu in place already, it is the PHP end i'm not sure about. Currently I have many php files which only differ in one line: $filename=file.xml; I want to be able to pass this value to the script through a link. [snip] How about $files = array('file1.xml' = 'Go to file 1', 'file2.xml' = 'Go to file 2', 'file3.xml' = 'Go to file 3', 'file4.xml' = 'Go to file 4'); foreach ($files as $filename = $text) { // you should put your actual menu code here echo 'a href=', $_SERVER['PHP_SELF'], '?filename=', urlencode($filename), '', htmlentities($text), '/abr'; } -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
[PHP] grabbing data from a site
I have the following website that i want to grab info from: http://www.bom.gov.au/products/IDV60034.shtml Say I wanted the current temperature for Melbourne from this table, what line of code would I need to tell it to get that info - ie, an ereg() expression... i'm wondering whether there are ways of saying i want the third column of a particular row - in this instance, Melbourne? Thanks for any help. Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] grabbing data from a site
someone gave me the following expression which uses another program and it works fine for them... is there something similar with php? wget --timeout=90 -q -O- http://www.BoM.GOV.AU/products/IDO30V01.shtml | sed '1,/Melbourne sup/d' | sed '1d;3,$d;s/.*//;s/.*//' thanks, adam. Evan Nemerson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 If the target is in well-formed XML (XHTML is an example), you could use XSLT to say 'i want the third column of a particular row - in this instance, Melbourne'. However, since few people actually adhere to standards, you're probably going to need a regex... if you're not comfortable with them, explode() could be useful (although it is slower) Somebody posted an extremely helpfull little quick reference at php.net/ereg, i think... that might help you. On Friday 22 November 2002 01:40 pm, Adam wrote: I have the following website that i want to grab info from: http://www.bom.gov.au/products/IDV60034.shtml Say I wanted the current temperature for Melbourne from this table, what line of code would I need to tell it to get that info - ie, an ereg() expression... i'm wondering whether there are ways of saying i want the third column of a particular row - in this instance, Melbourne? Thanks for any help. Adam. - -- I pledge allegiance to the flag, of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty, and justice for all. - -Pledge of Allegiance -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE93qVm/rncFku1MdIRAshSAJ9phj0DqR3seanlzKXhdnKj8cvI8QCfW7kM tfUfUEF4yVJSRnm0GCkIeaM= =AyI1 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] does //commenting reduce performance?
I have always had the opinion that the more comments you put into php scripts, the slower they will run because there is more data to be read... Can someone tell me if there is any truth in this or whether commenting has absolutely 'no' impact on the performance of a script? Thanks, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP within Frames
This is really an browser interpretation of HTML issue than a straight PHP issue. A little more information would be helpful - such as browser, page content, etc. Regards, Adam On Sunday, October 19, 2003, at 05:45 PM, KB wrote: Hi, Does anyone know why my PHP pages won't work in Frames? I have 5 frames, each of which are displaying PHP pages.and none of the PHP code works. If I run the code outside of Frames it works fine! I've can't find any decent references for PHP in Frames. Your help would be appreciated. Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] On OS X (10.2) where is php installed?
All, Forgive me for the simplistic question, I'm not much of a Unix, Apache, or PHP wiz. I'm running Mac OS X 10.2 on a 12 PB. I've installed PHP 4.3.0 from Marc Lynric's site (http://www.entropy.ch). However, I cannot actually find the installation files on my laptop. My web server works. It serves PHP pages quite well, but I want to know where the binaries are located. I've tried using some sources I thought might tell me where the files are located, but they have not. Can anyone shed some light? Regards, Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Q] Development Best Practices
All, I'm not new to programing or web development but I am new to creating dynamic pages. I've read through a couple books. I've worked through problems and exercises. Installed and configured the software a few different times in Win32 and OS X. At this point, I feel I have a good handle on the environment and lexical structure. What I don't have is a grasp on best practices. For real sites I'm a little confused on how to implement all this new knowledge. For example, I've got a site that was static with bits of CGI to PHP. I was going to generate all the HTML from a PHP script, but that turned into a mess. So I tried creating the pages is mostly HTML with little bits of PHP. Placing the logic in another file and linking the two pages. I'm not really sure if that is the best approach. My question, how do you guys build your pages? Do your scripts generate all the HTML? I'm looking for tips and resources. Remember for my first site I've embarked on a fairly large site. Code maintenance will be an issue for me as I need to enhance and fix it later on. Thanks guys! Regards, Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexplained Issue Using Regex
would this not work? : ?php $string = http://www.zshare.net/video/541070871c7a8d9c;; $replaceWithThis = 'HELLYES-'; echo $string.\n; echo preg_replace('/\S+video\//',$replaceWithThis,$string).\n; echo $replaceWithThis.substr($string, strripos($string, '/')+1, strlen($string)).\n; echo $replaceWithThis.substr(strrchr($string, '/'), 1, strlen(strrchr($string, '/'))); ? OUTPUT: C:\php test.php http://www.zshare.net/video/541070871c7a8d9c HELLYES-541070871c7a8d9c HELLYES-541070871c7a8d9c HELLYES-541070871c7a8d9c C:\ On Fri, Mar 6, 2009 at 2:32 PM, Nitsan Bin-Nun nit...@binnun.co.il wrote: Hi lista, I have been trying to figure this out for the last couple of hours but I'm lack of luck. Take a look at these regex's, the string that was inputed into the preg_replace (using Uis modificators) and the results: (the lists have correspondence to each other) ORIGINAL STRING http://www.zshare.net/video/541070871c7a8d9c http://www.guba.com/watch/2000821351 http://www.veoh.com/videos/v4609719YfsCFpf REGEX USED (with Uis modificators) http:\/\/(www\.|)zshare\.net\/video\/([^\/]+) Â Â Â Â Â Â Â $3 http:\/\/(www\.|)guba\.com\/watch\/([0-9]+) Â Â Â Â Â Â Â $3 http:\/\/(www\.|)veoh\.com\/videos\/([^\/]+) THE RETURNED STRING 41070871c7a8d9c 000821351 4609719YfsCFpf If you will go through this carefully you will notice that the first character of each matching group is being deleted. The regex's and the replacements string are being fetched from the database (mysql) and goes straight to the preg_replace function with the original string. I have no idea why this happens. I'm looking forward for your opinions and suggestions. Regards, Nitsan -- Adi... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax checker? Character replacing
just clean up your code and it will work: ?php $qString = 'http://www.google.ca/search?hl=enq=php+rocks%21%21%21meta='; if (isset($qString)) { $buffer = str_replace(,amp;,$qString); } echo $buffer.\n; ? OUTPUT: C:\php test.php http://www.google.ca/search?hl=enamp;q=php+rocks%21%21%21amp;meta= C:\ On Fri, Mar 6, 2009 at 3:05 PM, Terion Miller webdev.ter...@gmail.com wrote: I have this and think maybe something is off, because if there is an amp () in the location then it only displays a comma , and nothing else: if (isset($_SERVER['QUERY_STRING'])) {$Page .= ($_SERVER['QUERY_STRING']? '?'. str_replace(,amp;,$_SERVER['QUERY_STRING']) : '');} is that wrong? -- Adi... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stripping first comma off and everything after
I'm querying data and have results such as a variable named $entries[$i][dn]: CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92,OU=XXf,OU=XX,OU=X,DC=,DC=xx,DC=xxx Basically I need to strip off the first command everything after, so that I just have it display CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92. I tried echo rtrim($entries[$i][dn],,); but that doesn't do anything. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with sql statement
I was google searching, and the only SQL mailing list I found is currently giving a 503 error, so I hope you don't mind me asking my SQL question here, since there are a lot of SQL gurus here. I am having a syntax problem: Instead of doing a query like this:: select SMS_R_SYSTEM.Name from SMS_R_System where (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/ABC) or (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/XYZ) I'd like to shorten it in the where clause to: select SMS_R_SYSTEM.Name from SMS_R_System where (SMS_R_System.SystemOUName = example.com/COMPUTERS/MAIN CAMPUS/ABC, example.com/COMPUTERS/MAIN CAMPUS/XYZ) But I'm getting a syntax error. Any idea why my SQL syntax isn't valid? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eval() function
Hi, in my application I am making a lot of use of the eval() function, however I was wondering if this is going to cause any extra load. Does it do anything like load in the PHP engine again or anything? We just added it in and the load on our web servers went up... so I was wondering if I should be aware of anything. Thanks, Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] include statement
This is because the PHP include statement is ment to include other blocks of PHP code, rather than bits of HTML. Hence, it includes things from anywhere on the system. To include things from under your current htdocs directory, use... include($DOCUMENT_ROOT . "/includes/metatags.include"); though the more 'correct' method would be readfile($DOCUMENT_ROOT . "/includes/metatags.include"); adamw - Original Message - From: "Michael Zornek" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 5:04 PM Subject: [PHP] include statement I'm a PHP newbie and am looking into using the include statement to put things like the header and footer in so they are always the same. I do this now with SSI. In SSI I'll use the following statement: !--#include virtual="/includes/metatags.include" -- I like this cause it lets me use the same statement all over the site and I don't have to worry about where the document is and how many directories i have to go up an into "../../../../../" I was guessing PHP's version would be: ?PHP include("/includes/metatags.include"); ? However I get an error. If I put the absolute it works: ?PHP include("/home/httpd/includes/metatags.include"); ? which is scary cause this worked too: ?PHP include("/usr/local/apache/conf/httpd.conf"); ? doesn't this seem like a huge security hole? Well what I want is to use something like /inc/footer.html so i can use the same PHP statements in any document and not worry about getting it "../../../" Any suggestions. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] include statement
Pretty much, yes (within the bounds of the permissions of the files. Most webservers run as nobody on unix, and hence can only read those files which nobody can (confusing, huh :)). But, unless you have a mallicious user with upload access to your server, this isnt an issue. If you do, investigate "Safe mode" this instant :) adamw - Original Message - From: "Karl J. Stubsjoen" [EMAIL PROTECTED] To: "Adam Wright" [EMAIL PROTECTED]; [EMAIL PROTECTED]; "Michael Zornek" [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 5:21 PM Subject: Re: [PHP] include statement What about the security issue mentioned? Is it then possible (using the include and/or readfile) to grab anything found on the server? 1 More thing: what if I wanted to place the contents of a file into a variable. How do you achieve that? Karl *also a newbie, and this is a great group* - Original Message - From: "Adam Wright" [EMAIL PROTECTED] To: [EMAIL PROTECTED]; "Michael Zornek" [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 10:18 AM Subject: Re: [PHP] include statement For your things (where you are including HTML), readfile just reads a file and dumps it to the screen. This is fine, because you are just dealing with HTML, so no processing is required. include will actually try and parse the file as if it has PHP inside somewhere, which your HTML (probably) doesnt. So, readfile uses less resources, and is much more like the SSI include statement than PHP's include :) adamw - Original Message - From: "Michael Zornek" [EMAIL PROTECTED] To: "Adam Wright" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 5:14 PM Subject: Re: [PHP] include statement Adam(and everyone else who answers in 5 minutes, god i love this list), thanks for the help. Why is readfile more 'correct'? Just wondering? Mike At 5:07 PM + 1/17/01, Adam Wright wrote: This is because the PHP include statement is ment to include other blocks of PHP code, rather than bits of HTML. Hence, it includes things from anywhere on the system. To include things from under your current htdocs directory, use... include($DOCUMENT_ROOT . "/includes/metatags.include"); though the more 'correct' method would be readfile($DOCUMENT_ROOT . "/includes/metatags.include"); adamw - Original Message - From: "Michael Zornek" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 5:04 PM Subject: [PHP] include statement I'm a PHP newbie and am looking into using the include statement to put things like the header and footer in so they are always the same. I do this now with SSI. In SSI I'll use the following statement: !--#include virtual="/includes/metatags.include" -- I like this cause it lets me use the same statement all over the site and I don't have to worry about where the document is and how many directories i have to go up an into "../../../../../" I was guessing PHP's version would be: ?PHP include("/includes/metatags.include"); ? However I get an error. If I put the absolute it works: ?PHP include("/home/httpd/includes/metatags.include"); ? which is scary cause this worked too: ?PHP include("/usr/local/apache/conf/httpd.conf"); ? doesn't this seem like a huge security hole? Well what I want is to use something like /inc/footer.html so i can use the same PHP statements in any document and not worry about getting it "../../../" Any suggestions. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Encoder price too high (was: Zend hit)
We are working on extending the APC cache (http://apc.communityconnect.com) with an encoder, and already have a pretty much functioning version (though its a bit of hack job at the moment :). I think the patches we made were sent to the dev list, but I can send them around at request. adamw - Original Message - From: "Adrian Teasdale" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: "Uioreanu Calin" [EMAIL PROTECTED] Sent: Thursday, January 25, 2001 10:54 AM Subject: [PHP] Encoder price too high (was: Zend hit) "Uioreanu Calin" [EMAIL PROTECTED] wrote in message Hello, What do you think about Zend position? I thought I would reply to the list on this one, basically to see if I am in the minority (and if so, I will shut up!)... Firstly, many people who use PHP do so to make money - I know I do! Therefore, I don't see anything wrong with the guys at Zend developing products that make my life easier, make PHP a better product and they can get paid for doing so. However, although I have said the above, I do feel that the price points that have been chosen are very disapointing, especially for the Encoder Unlimited which is priced at $6000. The guys at Zend have raised expectations for their products since they launched their site and I have been looking forward to the Encoder (as it is now called) for most of that time. I can only think that it is the much larger companies that can afford this kind of price and I now feel that I cannot have a "feature" that I had been waiting to use for some time. Cold Fusion has a method of encryting it's code, and it comes like that out of the box (and at a much cheaper price). What the guys at Zend are basically saying is that if you want to use the better product (ie PHP) and want the encryption functionality found in products like Cold Fusion, then you are going to have to pay handsomely for it! I would definitely have paid $1000 for the Unlimited Encoder, but no more than that. What does everyone else think? Am I being unfair here in my assessment? I know that there has been an argument on the Zend site that "until 2 days ago, you were happy using PHP", but I disagree with that because I've been waiting so long for the Encoder knowing I needed it, and delaying on releasing a couple of low-cost ($20 each) apps until it was ready Finally, is there anything else out there either a) in the open source community or b) commercially available at a more sensible price? If not, are there people on this list who could band together to develop something that competes against it? Any replies always appreciated :) Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Compiler? (Was Re: [PHP] PHP site on CD-ROM)
The compiler has become the encoder, because it's rather hard to meet the expectations of a 'compiler' (many would expect it to produce binaries and heavily optimised code). Encoder makes more sense, based on what the product does. adamw - Original Message - From: "Angus Mann" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 25, 2001 11:41 AM Subject: [PHP] Compiler? (Was Re: [PHP] PHP site on CD-ROM) At 22:35 18/01/01 -0800, Rasmus Lerdorf wrote: You would need to go through a web server for it to work. I seem to recall seeing something on the Zend site a while back about a "compiler" for PHP that was in the pipeline. After the store was launched I can't find anything. Am I imagining things, or does it look like Zend pulled the plug? Did anyone else in here see it? :) Thanks, Angus. On Fri, 19 Jan 2001, Philip Apostol wrote: Can I run a PHP/Apache/MySQL services on a CD-ROM. We have PHP scripts that handle queries on a large database. We would like to distribute it on a CD-ROM so they could access the database offline. Is it possible? Or are there any similar solutions for this? Im thinking of a text-file database and access it via javascript but have no much time to study on this. If php can be run on the cd-rom, that would be a better solution. But any solution you posted here will be highly appreciated. Thanks in advance. Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/yaz README php_yaz.c
dickmeiss Tue Jan 30 05:09:27 2001 EDT Modified files: /php4/ext/yaz README php_yaz.c Log: Fixed problem with looping present requests for Isite targets. Index: php4/ext/yaz/README diff -u php4/ext/yaz/README:1.1 php4/ext/yaz/README:1.2 --- php4/ext/yaz/README:1.1 Thu May 25 15:24:42 2000 +++ php4/ext/yaz/README Tue Jan 30 05:09:24 2001 @@ -1,7 +1,4 @@ -What is PHP extension YAZ? - -This extension implements a Z39.50 client and is build on top of -the YAZ toolkit. +This extension implements a Z39.50 client for PHP using the YAZ toolkit. Find more information at: http://www.indexdata.dk/phpyaz/ Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.7 php4/ext/yaz/php_yaz.c:1.8 --- php4/ext/yaz/php_yaz.c:1.7 Wed Nov 1 14:10:54 2000 +++ php4/ext/yaz/php_yaz.c Tue Jan 30 05:09:24 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.7 2000/11/01 22:10:54 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.8 2001/01/30 13:09:24 dickmeiss Exp $ */ #include "php.h" @@ -321,7 +321,8 @@ static int send_present (Yaz_Association t); -static void handle_records (Yaz_Association t, Z_Records *sr) +static void handle_records (Yaz_Association t, Z_Records *sr, + int present_phase) { if (sr sr-which == Z_Records_NSD) { @@ -338,7 +339,7 @@ else if (sr sr-which == Z_Records_multipleNSD) { if (sr-u.multipleNonSurDiagnostics-num_diagRecs = 1) - response_diag(t, sr-u.multipleNonSurDiagnostics-diagRecs[0]); + response_diag(t, sr-u.multipleNonSurDiagnostics-diagRecs[0]); else t-error = PHP_YAZ_ERROR_DECODE; } @@ -366,6 +367,7 @@ if (sr sr-which == Z_Records_DBOSD) { int j, i; + NMEM nmem = odr_extract_mem (t-odr_in); Z_NamePlusRecordList *p = sr-u.databaseOrSurDiagnostics; for (j = 0; j t-resultSets-recordList-num_records; j++) @@ -374,20 +376,33 @@ for (i = 0; ip-num_records; i++) t-resultSets-recordList-records[i+j] = p-records[i]; /* transfer our response to search_nmem .. we need it later */ - nmem_transfer (t-resultSets-odr-mem, odr_extract_mem (t-odr_in)); + nmem_transfer (t-resultSets-odr-mem, nmem); + nmem_destroy (nmem); + if (present_phase p-num_records == 0) + { + /* present response and we didn't get any records! */ + t-error = PHP_YAZ_ERROR_DECODE; + t-resultSets-recordList = 0; + } } + else if (present_phase) + { + /* present response and we didn't get any records! */ + t-error = PHP_YAZ_ERROR_DECODE; + t-resultSets-recordList = 0; + } } } static void search_response (Yaz_Association t, Z_SearchResponse *sr) { t-resultSets-resultCount = *sr-resultCount; - handle_records (t, sr-records); + handle_records (t, sr-records, 0); } static void present_response (Yaz_Association t, Z_PresentResponse *pr) { - handle_records (t, pr-records); + handle_records (t, pr-records, 1); } static void handle_apdu (Yaz_Association t, Z_APDU *apdu) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GTK-PHP install doubt?
Make sure you're building against a 4.0.5 build of PHP. I tried this afternoon with the latest PHP from snaps.php.net and the GTK bindings, and it worked flawlessly. adamw - Original Message - From: "Celestino Roberto Alejandro" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 08, 2001 2:22 PM Subject: [PHP] GTK-PHP install doubt? Friends, i get the source of the GTK-PHP module, or library, as you want to say, but, when i going to do, the steps that describe in their ebpage( http://gtk.php.net/), i do phpize ./configure make (This failed) make install (obviously failed) When i do the make, this say that the function php_if_gdk_window_new_dc in php_gtk_types.c have too many arguments to function zend_hash_get_current_key_ex (316line) and all-recursive Error. Why could be this? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Generate Random Letters?
I use something like... function randString($sequence_length = 7) $possible_letters = "abcdefghijklmnopqrstuvwxzy"; $sequence = "" while ($sequence_length--) { $sequence .= $possible_letters[rand(0, strlen($possible_letters) - 1)]; } return $sequence; } To create random strings. Just fill in $possible_letters with anything you like adamw - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 09, 2001 3:12 PM Subject: [PHP] Generate Random Letters? I know it is possible to generate a random number using rand() I don`t suppose there is anyway to generate a random letter sequence that anyone knows of? Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/yaz php_yaz.c php_yaz.h
dickmeiss Tue Mar 13 09:04:05 2001 EDT Modified files: /php4/ext/yaz php_yaz.c php_yaz.h Log: Added yaz_database. Option bit ExtendedServices set for InitRequest. Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.13 php4/ext/yaz/php_yaz.c:1.14 --- php4/ext/yaz/php_yaz.c:1.13 Sun Feb 25 22:07:26 2001 +++ php4/ext/yaz/php_yaz.c Tue Mar 13 09:04:05 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.13 2001/02/26 06:07:26 andi Exp $ */ +/* $Id: php_yaz.c,v 1.14 2001/03/13 17:04:05 dickmeiss Exp $ */ #include "php.h" @@ -72,6 +72,7 @@ char *host_port; int num_databaseNames; char **databaseNames; + char *local_databases; COMSTACK cs; char *cookie; char *auth_open; @@ -110,6 +111,7 @@ p-host_port = 0; p-num_databaseNames = 0; p-databaseNames = 0; + p-local_databases = 0; p-cs = 0; p-cookie = 0; p-auth_open = 0; @@ -149,6 +151,7 @@ if (!p) return ; xfree (p-host_port); + xfree (p-local_databases); for (i = 0; ip-num_databaseNames; i++) xfree (p-databaseNames[i]); xfree (p-databaseNames); @@ -221,6 +224,7 @@ PHP_FE(yaz_present, NULL) PHP_FE(yaz_ccl_conf, NULL) PHP_FE(yaz_ccl_parse, NULL) + PHP_FE(yaz_database, NULL) {NULL, NULL, NULL} }; @@ -656,12 +660,21 @@ return 0; } +/* set database names. Take local databases (if set); otherwise + take databases given in ZURL (if set); otherwise use Default */ static char **set_DatabaseNames (Yaz_Association t, int *num) { char **databaseNames; - char *c, *cp = strchr (t-host_port, '/'); + char *c; int no = 2; + char *cp = t-local_databases; + if (!cp || !*cp) + { + cp = strchr (t-host_port, '/'); + if (cp) + cp++; + } if (cp) { c = cp; @@ -672,23 +685,26 @@ } } else - cp = "/Default"; + cp = "Default"; databaseNames = odr_malloc (t-odr_out, no * sizeof(*databaseNames)); no = 0; while (*cp) { - c = ++cp; - c = strchr (c, '+'); + c = strchr (cp, '+'); if (!c) c = cp + strlen(cp); else if (c == cp) + { + cp++; continue; + } /* cp ptr to first char of db name, c is char following db name */ databaseNames[no] = odr_malloc (t-odr_out, 1+c-cp); memcpy (databaseNames[no], cp, c-cp); - databaseNames[no][c-cp] = '\0'; - no++; + databaseNames[no++][c-cp] = '\0'; cp = c; + if (*cp) + cp++; } databaseNames[no] = NULL; *num = no; @@ -822,6 +838,7 @@ ODR_MASK_SET(ireq-options, Z_Options_present); ODR_MASK_SET(ireq-options, Z_Options_namedResultSets); ODR_MASK_SET(ireq-options, Z_Options_scan); + ODR_MASK_SET(ireq-options, Z_Options_extendedServices); ODR_MASK_SET(ireq-protocolVersion, Z_ProtocolVersion_1); ODR_MASK_SET(ireq-protocolVersion, Z_ProtocolVersion_2); @@ -1062,6 +1079,8 @@ shared_associations[i]-group = xstrdup (group_str); shared_associations[i]-pass = xstrdup (pass_str); } + xfree (shared_associations[i]-local_databases); + shared_associations[i]-local_databases = 0; #ifdef ZTS tsrm_mutex_unlock (yaz_mutex); #endif @@ -2245,6 +2264,33 @@ RETVAL_TRUE; } ccl_rpn_delete(rpn); + } + else + RETVAL_FALSE; + release_assoc (p); +} +/* }}} */ + +/* {{{ proto int yaz_ccl_parse(int id, string query, array res) + Parse a CCL query */ + +PHP_FUNCTION(yaz_database) +{ + pval **pval_id, **pval_database; + Yaz_Association p; + if (ZEND_NUM_ARGS() != 2 || + zend_get_parameters_ex(2, pval_id, pval_database) == + FAILURE) + { + WRONG_PARAM_COUNT; + } + convert_to_string_ex (pval_database); + p = get_assoc (pval_id); + if (p) + { + xfree (p-local_databases); + p-local_databases = xstrdup ((*pval_database)-value.str.val); + RETVAL_TRUE; } else RETVAL_FALSE; Index: php4/ext/yaz/php_yaz.h diff -u php4/ext/yaz/php_yaz.h:1.4 php4/ext/yaz/php_yaz.h:1.5 --- php4/ext/yaz/php_yaz.h:1.4 Sun Feb 25 22:07:26 2001 +++ php4/ext/yaz/php_yaz.h Tue Mar 13 09:04:05 2001 @@ -16,7 +16,7 @@
[PHP-CVS] cvs: php4 /pear/HTML Common.php
adaniel Thu Mar 22 17:11:59 2001 EDT Modified files: /php4/pear/HTML Common.php Log: removed the pass by reference on the second parameter of _updateAttrArray Index: php4/pear/HTML/Common.php diff -u php4/pear/HTML/Common.php:1.3 php4/pear/HTML/Common.php:1.4 --- php4/pear/HTML/Common.php:1.3 Thu Mar 22 07:27:07 2001 +++ php4/pear/HTML/Common.php Thu Mar 22 17:11:59 2001 @@ -16,7 +16,7 @@ // | Authors: Adam Daniel [EMAIL PROTECTED]| // +--+ // -// $Id: Common.php,v 1.3 2001/03/22 15:27:07 mj Exp $ +// $Id: Common.php,v 1.4 2001/03/23 01:11:59 adaniel Exp $ /** * Base class for all HTML classes @@ -129,11 +129,11 @@ /** * Updates the attributes in $attr1 with the values in $attr2 without changing the other existing attributes * @paramarray $attr1 Original attributes array -* @paramarray $attr2 New attrbiutes array +* @paramarray $attr2 New attributes array * @access private * @return array */ -function _updateAttrArray($attr1, $attr2) +function _updateAttrArray($attr1, $attr2) { while (list($key, $value) = each($attr2)) { if (!is_int($key)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/HTML Common.php
adaniel Thu Mar 22 18:13:19 2001 EDT Modified files: /php4/pear/HTML Common.php Log: updated some comments, added display method, and added the toHtml abstract method Index: php4/pear/HTML/Common.php diff -u php4/pear/HTML/Common.php:1.4 php4/pear/HTML/Common.php:1.5 --- php4/pear/HTML/Common.php:1.4 Thu Mar 22 17:11:59 2001 +++ php4/pear/HTML/Common.php Thu Mar 22 18:13:18 2001 @@ -16,37 +16,38 @@ // | Authors: Adam Daniel [EMAIL PROTECTED]| // +--+ // -// $Id: Common.php,v 1.4 2001/03/23 01:11:59 adaniel Exp $ +// $Id: Common.php,v 1.5 2001/03/23 02:13:18 adaniel Exp $ /** -* Base class for all HTML classes -* -* @author Adam Daniel [EMAIL PROTECTED] -* @version 1.3 -* @since PHP 4.0.3pl1 -*/ + * Base class for all HTML classes + * + * @author Adam Daniel [EMAIL PROTECTED] + * @version 1.3 + * @since PHP 4.0.3pl1 + * @abstract + */ class HTML_Common { /** -* Associative array of table attributes -* @var array -* @access private -*/ + * Associative array of table attributes + * @var array + * @access private + */ var $_attributes = array(); /** -* Tab offset of the table -* @var int -* @access private -*/ + * Tab offset of the table + * @var int + * @access private + */ var $_tabOffset = 0; /** -* Class constructor -* @parammixed $attributes Associative array of table tag attributes -* or HTML attributes name="value" pairs -* @access public -*/ + * Class constructor + * @parammixed $attributes Associative array of table tag attributes + * or HTML attributes name="value" pairs + * @access public + */ function HTML_Common($attributes=null, $tabOffset=0) { $this-setTabOffset($tabOffset); @@ -54,30 +55,30 @@ } // end constructor /** -* Returns the current API version -* @access public -* @returns double -*/ + * Returns the current API version + * @access public + * @returns double + */ function apiVersion() { return 1.3; } // end func apiVersion /** -* Returns a string of \t for the tabOffset property -* @access private -*/ + * Returns a string of \t for the tabOffset property + * @access private + */ function _getTabs() { return $this-_tabOffset 0 ? str_repeat("\t", $this-_tabOffset) : ""; } // end func _getTabs /** -* Returns an HTML formatted attribute string -* @paramarray $attributes -* @return string -* @access private -*/ + * Returns an HTML formatted attribute string + * @paramarray $attributes + * @return string + * @access private + */ function _getAttrString($attributes) { $strAttr = ""; @@ -94,10 +95,10 @@ } // end func _getAttrString /** -* Returns a valid atrributes array from either a string or array -* @parammixed $attributes Either a typical HTML attribute string or an associative array -* @access private -*/ + * Returns a valid atrributes array from either a string or array + * @parammixed $attributes Either a typical HTML attribute string or an +associative array + * @access private + */ function _parseAttributes($attributes) { if (is_array($attributes)) { @@ -127,12 +128,12 @@ } // end func _parseAttributes /** -* Updates the attributes in $attr1 with the values in $attr2 without changing the other existing attributes -* @paramarray $attr1 Original attributes array -* @paramarray $attr2 New attributes array -* @access private -* @return array -*/ + * Updates the attributes in $attr1 with the values in $attr2 without changing +the other existing attributes + * @paramarray $attr1 Original attributes array + * @paramarray $attr2 New attributes array + * @access private + * @return array + */ function _updateAttrArray($attr1, $attr2) { while (list($key, $value) = each($attr2)) { @@ -162,20 +163,20 @@ } // end func _updateAtrrArray /** -* Sets the HTML attributes -* @parammixed $attributes Either a typical HTML attribute string or an associative array -* @access public -*/ + * Sets the HTML attributes + * @parammixed $attributes Either a typical HTML attribute string or an +associative array + * @access public + */ function setAttributes($attributes) { $this-_attributes = $this-_parseAttribut
[PHP-CVS] cvs: php4 /pear/HTML Table.php
adaniel Thu Mar 22 18:14:05 2001 EDT Modified files: /php4/pear/HTML Table.php Log: moved the display method to HTML_Common and updated some comments Index: php4/pear/HTML/Table.php diff -u php4/pear/HTML/Table.php:1.3 php4/pear/HTML/Table.php:1.4 --- php4/pear/HTML/Table.php:1.3Thu Mar 22 06:32:51 2001 +++ php4/pear/HTML/Table.phpThu Mar 22 18:14:05 2001 @@ -17,184 +17,184 @@ // | Bertrand Mansion [EMAIL PROTECTED] | // +--+ // -// $Id: Table.php,v 1.3 2001/03/22 14:32:51 mj Exp $ +// $Id: Table.php,v 1.4 2001/03/23 02:14:05 adaniel Exp $ require_once "PEAR.php"; require_once "HTML/Common.php"; /** -* Builds an HTML table -* -* @author Adam Daniel [EMAIL PROTECTED] -* @author Bertrand Mansion [EMAIL PROTECTED] -* @version 1.5 -* @since PHP 4.0.3pl1 -* -* Example: -* $table = new HTML_Table; -* ... -*/ + * Builds an HTML table + * + * @authorAdam Daniel [EMAIL PROTECTED] + * @authorBertrand Mansion [EMAIL PROTECTED] + * @version 1.5 + * @since PHP 4.0.3pl1 + * + * Example: + * $table = new HTML_Table; + * ... + */ class HTML_Table extends HTML_Common { - /** - * Automatically adds a new row or column if a given row or column index does not exist - * @var bool - * @access private - */ - var $_autoGrow = true; - - /** - * Value to insert into empty cells - * @var string - * @access private - */ - var $_autoFill = "nbsp;"; - - /** - * Array containing the table structure - * @var array - * @access private - */ - var $_structure = array(); - - /** - * Number of rows composing in the table - * @var int - * @access private - */ - var $_rows = 0; - - /** - * Number of column composing the table - * @var int - * @access private - */ - var $_cols = 0; - - /** - * Class constructor - * @paramarray $attributes Associative array of table tag attributes -* @paramint $tabOffset - * @access public - */ - function HTML_Table($attributes=null, $tabOffset=0) - { +/** + * Automatically adds a new row or column if a given row or column index does not +exist + * @varbool + * @accessprivate + */ +var $_autoGrow = true; + +/** + * Value to insert into empty cells + * @varstring + * @accessprivate + */ +var $_autoFill = "nbsp;"; + +/** + * Array containing the table structure + * @vararray + * @accessprivate + */ +var $_structure = array(); + +/** + * Number of rows composing in the table + * @varint + * @accessprivate + */ +var $_rows = 0; + +/** + * Number of column composing the table + * @varint + * @accessprivate + */ +var $_cols = 0; + +/** + * Class constructor + * @paramarray$attributesAssociative array of table tag attributes + * @paramint $tabOffset + * @accesspublic + */ +function HTML_Table($attributes=null, $tabOffset=0) +{ $commonVersion = 1.3; if (HTML_Common::apiVersion() $commonVersion) { return new PEAR_Error("HTML_Table version " . $this-apiVersion() . " requires " . "HTML_Common version $commonVersion or greater.", 0, PEAR_ERROR_TRIGGER); } - HTML_Common::HTML_Common($attributes, $tabOffset); - } // end constructor +HTML_Common::HTML_Common($attributes, $tabOffset); +} // end constructor - /** - * Returns the API version - * @access public -* @returns double - */ - function apiVersion() - { - return 1.5; - } // end func apiVersion - - /** - * Sets the table caption - * @paramstring $caption - * @parammixed $attributes Associative array or string of table row attributes - * @access public - */ - function setCaption($caption, $attributes=null) - { - $attributes = $this-_parseAttributes($attributes); - $this-_structure["caption"] = array("attr"=$attributes, "contents"=$caption); - } // end func setCaption - -/** -* Sets the autoFill value -* @parammixed $fill -* @access public -*/ +/** + * Returns the API version + * @access public + * @returns double + */ +function apiVersion() +{ +return 1.5; +}
[PHP-CVS] cvs: php4 /pear/HTML Select.php
adaniel Thu Mar 22 22:18:12 2001 EDT Added files: /php4/pear/HTML Select.php Log: original commit. Basic html select loaded manually, from a DB result, or an array Index: php4/pear/HTML/Select.php +++ php4/pear/HTML/Select.php ?php require_once "DB.php"; require_once "PEAR.php"; require_once "HTML/Common.php"; /** * Class to dynamically create an HTML SELECT * * @author Adam Daniel [EMAIL PROTECTED] * @version 1.0 * @sincePHP4.04pl1 * @access public */ class HTML_Select extends HTML_Common { /** * Contains the select options * * @var array * @since 1.0 * @accessprivate */ var $_options = array(); /** * Default values of the SELECT * * @var string * @since 1.0 * @accessprivate */ var $_values = array(); /** * Class constructor * * @param string$name Name attribute of the SELECT * @param int $size Size attribute of the SELECT * @param bool $multiple Whether the select will allow multiple * selections or not * @param mixed $attributes Either a typical HTML attribute string * or an associative array * @param int $tabOffset Number of tabs to offset HTML source * @since 1.0 * @accesspublic * @returnvoid * @throws */ function HTML_Select($name="", $size=1, $multiple=false, $attributes=null, $tabOffset=0) { HTML_Common::HTML_Common($attributes, $tabOffset); $attr = array("name"=$name, "size"=$size); if ($multiple) { $attr[] = "MULTIPLE"; } $this-updateAttributes($attr); } // end constructor /** * Returns the current API version * * @since 1.0 * @accesspublic * @returndouble * @throws */ function apiVersion() { return 1.0; } //end func apiVersion /** * Sets the default values of the select box * * @param mixed$values Array or comma delimited string of selected values * @since 1.0 * @accesspublic * @returnvoid * @throws */ function setSelectedValues($values) { if (is_string($values)) { $values = split("[ ]?,[ ]?", $values); } $this-_values = $values; } //end func setSelectedValues /** * Returns an array of the selected values * * @since 1.0 * @accesspublic * @returnarray of selected values * @throws */ function getSelectedValues() { return $this-_values; } // end func getSelectedValues /** * Adds a new OPTION to the SELECT * * @param string$text Display text for the OPTION * @param string$value Value for the OPTION * @param bool $selected Whether the option is selected or not * @param mixed $attributes Either a typical HTML attribute string * or an associative array * @since 1.0 * @accesspublic * @returnvoid * @throws */ function addOption($text, $value, $selected=false, $attributes=null) { if ($selected !in_array($value, $this-_values)) { $this-_values[] = $value; array_unique($this-_values); } $attributes = $this-_parseAttributes($attributes); $attr = array("value"=$value); if (in_array($value, $this-_values)) { $attr[] = "SELECTED"; } $this-_updateAttrArray($attributes, $attr); $this-_options[] = array("text"=$text, "attr"=$attributes); } // end func addOption /** * Loads the options from an associative array * * @param array$arr Associative array of options * @param mixed$values (optional) Array or comma delimited string of selected values * @since 1.0 * @accesspublic * @returnPEAR_Error on error or true * @throwsPEAR_Error */ function loadArray($arr, $values=null) { if (!is_array($arr)) { return new PEAR_ERROR("First argument to HTML_Select::loadArray is not a valid array"); } if (isset($values)) { $this-setSelectedValues($values); } while (list($key, $value) = each($arr)) { if (in_array($value, $this-_values)) { $this-addOption($key, $value, true); } else { $this-addOption($key, $value); } } return true; } // end f
[PHP-CVS] cvs: php4 /pear/HTML Select.php
adaniel Thu Mar 22 22:24:07 2001 EDT Modified files: /php4/pear/HTML Select.php Log: forgot the license header Index: php4/pear/HTML/Select.php diff -u php4/pear/HTML/Select.php:1.1 php4/pear/HTML/Select.php:1.2 --- php4/pear/HTML/Select.php:1.1 Thu Mar 22 22:18:12 2001 +++ php4/pear/HTML/Select.php Thu Mar 22 22:24:07 2001 @@ -1,7 +1,27 @@ ?php +/* vim: set expandtab tabstop=4 shiftwidth=4: */ +// +--+ +// | PHP version 4.0 | +// +--+ +// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | +// +--+ +// | This source file is subject to version 2.0 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is| +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | [EMAIL PROTECTED] so we can mail you a copy immediately. | +// +--+ +// | Authors: Adam Daniel [EMAIL PROTECTED]| +// +--+ +// +// $Id: Select.php,v 1.2 2001/03/23 06:24:07 adaniel Exp $ + require_once "DB.php"; require_once "PEAR.php"; require_once "HTML/Common.php"; + /** * Class to dynamically create an HTML SELECT * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Permission denied
Don't forget, PHP (in general) runs as the webserver (normally "nobody" or "apache" for Apache servers). Make sure your webserver has write access to /home/jalmberg/public_html/qiksys/images/ adamw - Original Message - From: "John Almberg" [EMAIL PROTECTED] To: "PHP General List" [EMAIL PROTECTED] Sent: Friday, March 23, 2001 2:50 PM Subject: [PHP] Permission denied Hi all, I'm trying to upload a file from a client browser to my server. On the client side, I've got: FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST !-- INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000" -- Send this file: INPUT NAME="userfile" TYPE="file" INPUT TYPE="submit" VALUE="Send File" /FORM On the server side, I've got: echo ("$userfilebr"); echo ($HTTP_POST_FILES['userfile']['name'] ."br"); echo ($HTTP_POST_FILES['userfile']['type'] ."br"); echo ($HTTP_POST_FILES['userfile']['size'] ."br"); echo ($HTTP_POST_FILES['userfile']['tmp_name'] ."br"); if (move_uploaded_file($userfile, "/home/jalmberg/public_html/qiksys/images/temp.jpg")) print("moved file"); else print("couldn't move file!"); When I try to use this, I get: = /tmp/phpa21470 test.jpg image/pjpeg 21917 /tmp/phpa21470 Warning: Unable to create '/home/jalmberg/public_html/qiksys/images/temp.jpg': Permission denied in /home/jalmberg/public_html/qiksys/upload.php on line 57 Warning: Unable to move '/tmp/phpa21470' to '/home/jalmberg/public_html/qiksys/images/temp.jpg' in /home/jalmberg/public_html/qiksys/upload.php on line 57 couldn't move file! == I check the php.ini file and safe mode is turned off. I've also tried with a text file, same result. I have permission to access the above directory . . . the php files working this magic are located in /home/jalmberg/public_html/qiksys. Probably there is a simple answer to this question, but I'm out of ideas! Any help??? Thanks in advance. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Permission denied
If you have shell access to the box, you can chgrp some stuff and allow PHP to write to it. Otherwise, you'll have to talk to the ISP directly (get them to setup setuid versions of common shell commands for this sort of requirement). There is no way to make PHP 'login', any as PHP is server side, nothing you change locally can affect it. adamw - Original Message - From: "John Almberg" [EMAIL PROTECTED] To: "PHP General List" [EMAIL PROTECTED] Sent: Friday, March 23, 2001 3:27 PM Subject: RE: [PHP] Permission denied Adam, Just ran phpinfo and you are correct: the Apache User/Group is "nobody". H'. This sounds like a problem. Hope there is an answer! - John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/HTML Common.php
adaniel Fri Mar 23 20:33:11 2001 EDT Modified files: /php4/pear/HTML Common.php Log: added setComment Index: php4/pear/HTML/Common.php diff -u php4/pear/HTML/Common.php:1.5 php4/pear/HTML/Common.php:1.6 --- php4/pear/HTML/Common.php:1.5 Thu Mar 22 18:13:18 2001 +++ php4/pear/HTML/Common.php Fri Mar 23 20:33:10 2001 @@ -16,13 +16,13 @@ // | Authors: Adam Daniel [EMAIL PROTECTED]| // +--+ // -// $Id: Common.php,v 1.5 2001/03/23 02:13:18 adaniel Exp $ +// $Id: Common.php,v 1.6 2001/03/24 04:33:10 adaniel Exp $ /** * Base class for all HTML classes * * @author Adam Daniel [EMAIL PROTECTED] - * @version 1.3 + * @version 1.4 * @since PHP 4.0.3pl1 * @abstract */ @@ -41,6 +41,14 @@ * @access private */ var $_tabOffset = 0; + +/** + * HTML comment on the object + * @var string + * @since 1.4 + * @accessprivate + */ +var $_comment = ""; /** * Class constructor @@ -61,7 +69,7 @@ */ function apiVersion() { -return 1.3; +return 1.4; } // end func apiVersion /** @@ -136,6 +144,9 @@ */ function _updateAttrArray($attr1, $attr2) { +if (!is_array($attr2)) { +return false; +} while (list($key, $value) = each($attr2)) { if (!is_int($key)) { $attr1[$key] = $value; @@ -194,6 +205,20 @@ } // end func setTabOffset /** + * Sets the HTML comment to be displayed at the beginning of the HTML string + * + * @param string + * @since 1.4 + * @accesspublic + * @returnvoid + * @throws + */ +function setComment($comment) +{ +$this-_comment = $comment; +} // end func setHtmlComment + +/** * Abstract method. Must be extended to return the objects HTML * * @accesspublic @@ -217,3 +242,4 @@ } // end class HTML_Common ? + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/HTML Select.php
adaniel Fri Mar 23 20:34:18 2001 EDT Modified files: /php4/pear/HTML Select.php Log: added comments to the HTML output, added loadQuery, added load Index: php4/pear/HTML/Select.php diff -u php4/pear/HTML/Select.php:1.2 php4/pear/HTML/Select.php:1.3 --- php4/pear/HTML/Select.php:1.2 Thu Mar 22 22:24:07 2001 +++ php4/pear/HTML/Select.php Fri Mar 23 20:34:17 2001 @@ -16,7 +16,7 @@ // | Authors: Adam Daniel [EMAIL PROTECTED]| // +--+ // -// $Id: Select.php,v 1.2 2001/03/23 06:24:07 adaniel Exp $ +// $Id: Select.php,v 1.3 2001/03/24 04:34:17 adaniel Exp $ require_once "DB.php"; require_once "PEAR.php"; @@ -26,7 +26,7 @@ * Class to dynamically create an HTML SELECT * * @author Adam Daniel [EMAIL PROTECTED] - * @version 1.0 + * @version 1.1 * @sincePHP4.04pl1 * @access public */ @@ -54,13 +54,13 @@ /** * Class constructor * - * @param string$name Name attribute of the SELECT - * @param int $size Size attribute of the SELECT - * @param bool $multiple Whether the select will allow multiple + * @param string$name (optional)Name attribute of the SELECT + * @param int $size (optional) Size attribute of the SELECT + * @param bool $multiple (optional)Whether the select will allow +multiple * selections or not - * @param mixed $attributes Either a typical HTML attribute string + * @param mixed $attributes (optional)Either a typical HTML attribute +string * or an associative array - * @param int $tabOffset Number of tabs to offset HTML source + * @param int $tabOffset (optional)Number of tabs to offset HTML source * @since 1.0 * @accesspublic * @returnvoid @@ -86,7 +86,7 @@ */ function apiVersion() { -return 1.0; +return 1.1; } //end func apiVersion /** @@ -140,9 +140,6 @@ } $attributes = $this-_parseAttributes($attributes); $attr = array("value"=$value); -if (in_array($value, $this-_values)) { -$attr[] = "SELECTED"; -} $this-_updateAttrArray($attributes, $attr); $this-_options[] = array("text"=$text, "attr"=$attributes); } // end func addOption @@ -166,11 +163,7 @@ $this-setSelectedValues($values); } while (list($key, $value) = each($arr)) { -if (in_array($value, $this-_values)) { -$this-addOption($key, $value, true); -} else { -$this-addOption($key, $value); -} +$this-addOption($key, $value); } return true; } // end func loadArray @@ -188,7 +181,7 @@ * @returnPEAR_Error on error or true * @throwsPEAR_Error */ -function loadDbResult($result, $textCol="", $valueCol="", $values=null) +function loadDbResult($result, $textCol=null, $valueCol=null, $values=null) { if (!is_object($result) || (get_class($result) != "db_result" is_subclass_of($result, "db_result"))) { @@ -200,22 +193,77 @@ $fetchMode = ($textCol $valueCol) ? DB_FETCHMODE_ASSOC : DB_FETCHMODE_DEFAULT; while (is_array($row = $result-fetchRow($fetchMode)) ) { if ($fetchMode == DB_FETCHMODE_ASSOC) { -if (in_array($row[$valueCol], $this-_values)) { -$this-addOption($row[$textCol], $row[$valueCol], true); -} else { -$this-addOption($row[$textCol], $row[$valueCol]); -} +$this-addOption($row[$textCol], $row[$valueCol]); } else { -if (in_array($row[0], $this-_values)) { -$this-addOption($row[0], $row[1], true); -} else { -$this-addOption($row[0], $row[1]); -} +$this-addOption($row[0], $row[1]); } } return true; } // end func loadDbResult + +/** + * Queries a database and loads the options from the results + * + * @param mixed $conn Either an existing DB connection or a valid +dsn + * @param string$sqlSQL query string + * @param string$textCol(optional) Name of column to display as the +OPTION text + * @param string$valueCol (optional) Name of column to use as the +OPTION value + * @param mixed $values (optional) Array or comma delimited string of +selected values + * @since 1.1 + * @
[PHP-CVS] cvs: php4 /pear/HTML Table.php
adaniel Fri Mar 23 20:36:06 2001 EDT Modified files: /php4/pear/HTML Table.php Log: added comments to the html output including table nest level, added automatic taboffset for cell contents if a subclass of html_common Index: php4/pear/HTML/Table.php diff -u php4/pear/HTML/Table.php:1.4 php4/pear/HTML/Table.php:1.5 --- php4/pear/HTML/Table.php:1.4Thu Mar 22 18:14:05 2001 +++ php4/pear/HTML/Table.phpFri Mar 23 20:36:06 2001 @@ -17,7 +17,7 @@ // | Bertrand Mansion [EMAIL PROTECTED] | // +--+ // -// $Id: Table.php,v 1.4 2001/03/23 02:14:05 adaniel Exp $ +// $Id: Table.php,v 1.5 2001/03/24 04:36:06 adaniel Exp $ require_once "PEAR.php"; require_once "HTML/Common.php"; @@ -29,10 +29,6 @@ * @authorBertrand Mansion [EMAIL PROTECTED] * @version 1.5 * @since PHP 4.0.3pl1 - * - * Example: - * $table = new HTML_Table; - * ... */ class HTML_Table extends HTML_Common { @@ -70,7 +66,14 @@ * @accessprivate */ var $_cols = 0; - + +/** + * Tracks the level of nested tables + * @var + * @since 1.5 + * @accessprivate + */ +var $_nestLevel = 0; /** * Class constructor * @paramarray$attributesAssociative array of table tag attributes @@ -445,7 +448,13 @@ function toHtml() { $tabs = $this-_getTabs(); -$strHtml .= "\n" . $tabs . "TABLE" . $this-_getAttrString($this-_attributes) . "\n"; +$strHtml = +"\n" . $tabs . "!-- BEGIN TABLE LEVEL: $this-_nestLevel --\n"; +if ($this-_comment) { +$strHtml .= $tabs . "!-- $this-_comment --\n"; +} +$strHtml .= +$tabs . "TABLE" . $this-_getAttrString($this-_attributes) . "\n"; if ($this-_structure["caption"]) { $attr = $this-_structure["caption"]["attr"]; $contents = $this-_structure["caption"]["contents"]; @@ -466,6 +475,12 @@ $contents = $this-_structure[$i][$j]["contents"]; $strHtml .= $tabs . "\t\t$type" . $this-_getAttrString($attr) . ""; if (is_object($contents)) { +if (is_subclass_of($contents, "html_common")) { +$contents-setTabOffset($this-_tabOffset + 3); +if (get_class($contents) == "html_table" || +is_subclass_of($contents, "html_table")) { +$contents-_nestLevel = $this-_nestLevel + 1; +} +} if (method_exists($contents, "toHtml")) { $contents = $contents-toHtml(); } elseif (method_exists($contents, "toString")) { @@ -479,7 +494,8 @@ } $strHtml .= $tabs ."\t/TR\n"; } -$strHtml .= $tabs . "/TABLE"; +$strHtml .= +$tabs . "/TABLE!-- END TABLE LEVEL: $this-_nestLevel --"; return $strHtml; } // end func toHtml @@ -514,3 +530,4 @@ } // end class HTML_Table ? + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/HTML Page.php
adaniel Fri Mar 23 20:36:38 2001 EDT Added files: /php4/pear/HTML Page.php Log: This class handles the details for creating a properly constructed HTML page. Page caching, stylesheets, client side script, and Meta tags can be managed using this class. Index: php4/pear/HTML/Page.php +++ php4/pear/HTML/Page.php ? /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +--+ // | PHP version 4.0 | // +--+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | // +--+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is| // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | [EMAIL PROTECTED] so we can mail you a copy immediately. | // +--+ // | Authors: Adam Daniel [EMAIL PROTECTED]| // +--+ // // $Id: Page.php,v 1.1 2001/03/24 04:36:38 adaniel Exp $ require_once "HTML/Common.php"; /** * Base class for HTML pages * * This class handles the details for creating a properly constructed HTML page. * Page caching, stylesheets, client side script, and Meta tags can be * managed using this class. * @author Adam Daniel [EMAIL PROTECTED] * @version 1.0 * @sincePHP 4.0.3pl1 */ class HTML_Page extends HTML_Common { /** * Controls caching of the page * @var bool * @access private */ var $_cache = False; /** * HTML page title * @var string * @access private */ var $_title = ""; /** * Array of meta tags * @var array * @access private */ var $_metaTags = array("GENERATOR"="PEAR HTML_Page"); /** * Array of linked style sheets * @var array * @access private */ var $_styleSheets = array(); /** * Array of linked scripts * @var array * @access private */ var $_scripts = array(); /** * Contents of HTML lt;BODYgt; tag * @var mixed * @access public */ var $body = ""; /** * Returns the HTML page * @access public * @return string of HTML */ function toHtml() { $strName = ""; $strContent = ""; $intCounter = 0; if ($this-_comment) { $strHtml = "!-- $this-_comment --\n"; } $strHtml .= "HTML\n"; $strHtml .= "HEAD\n"; $strHtml .= "TITLE$this-_title/TITLE\n"; for(reset($this-_metaTags); $strName = key($this-_metaTags); next($this-_metaTags)) { $strContent = pos($this-_metaTags); $strHtml .= "META name=\"$strName\" content=\"$strContent\"\n"; } for($intCounter=0; $intCountercount($this-_styleSheets); $intCounter++) { $strStyleSheet = $this-_styleSheets[$intCounter]; $strHtml .= "LINK rel=\"stylesheet\" href=\"$strStyleSheet\" type=\"text/css\"\n"; } for($intCounter=0; $intCountercount($this-_scripts); $intCounter++) { $strType = $this-_scripts[$intCounter]["TYPE"]; $strSrc = $this-_scripts[$intCounter]["SRC"]; $strHtml .= "SCRIPT language=\"$strType\" src=\"$strSrc\"/SCRIPT\n"; } $strHtml .= "/HEAD\n"; $strAttr = $this-_getAttrString($this-_attributes); $strHtml .= "BODY $strAttr\n"; if (is_object($this-body)) { if (method_exists($this-body, "toHtml")) { $strHtml .= $this-body-toHtml(); } elseif (method_exists($contents, "toString")) { $strHtml .= $contents-toString(); } } else { $strHtml .= $this-body; } $strHtml .= "/BODY\n"; $strHtml .= "/HTML\n"; return $strHtml; } // end func toHtml /** * Displays the HTML page to screen * @accesspublic */ function display() { if(! $this-_cache) { header("Expires: Tue, 1 Jan 1980 12:00:00 GMT");
[PHP-CVS] cvs: php4 /pear/HTML Common.php
adaniel Sat Mar 24 13:09:00 2001 EDT Modified files: /php4/pear/HTML Common.php Log: removed extra whitespace Index: php4/pear/HTML/Common.php diff -u php4/pear/HTML/Common.php:1.6 php4/pear/HTML/Common.php:1.7 --- php4/pear/HTML/Common.php:1.6 Fri Mar 23 20:33:10 2001 +++ php4/pear/HTML/Common.php Sat Mar 24 13:08:59 2001 @@ -16,7 +16,7 @@ // | Authors: Adam Daniel [EMAIL PROTECTED]| // +--+ // -// $Id: Common.php,v 1.6 2001/03/24 04:33:10 adaniel Exp $ +// $Id: Common.php,v 1.7 2001/03/24 21:08:59 adaniel Exp $ /** * Base class for all HTML classes @@ -242,4 +242,3 @@ } // end class HTML_Common ? - -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/HTML Page.php
adaniel Tue Mar 27 19:17:00 2001 EDT Modified files: /php4/pear/HTML Page.php Log: bug fix in toHtml Index: php4/pear/HTML/Page.php diff -u php4/pear/HTML/Page.php:1.1 php4/pear/HTML/Page.php:1.2 --- php4/pear/HTML/Page.php:1.1 Fri Mar 23 20:36:38 2001 +++ php4/pear/HTML/Page.php Tue Mar 27 19:16:59 2001 @@ -16,7 +16,7 @@ // | Authors: Adam Daniel [EMAIL PROTECTED]| // +--+ // -// $Id: Page.php,v 1.1 2001/03/24 04:36:38 adaniel Exp $ +// $Id: Page.php,v 1.2 2001/03/28 03:16:59 adaniel Exp $ require_once "HTML/Common.php"; @@ -99,8 +99,8 @@ $strHtml .= "LINK rel=\"stylesheet\" href=\"$strStyleSheet\" type=\"text/css\"\n"; } for($intCounter=0; $intCountercount($this-_scripts); $intCounter++) { -$strType = $this-_scripts[$intCounter]["TYPE"]; -$strSrc = $this-_scripts[$intCounter]["SRC"]; +$strType = $this-_scripts[$intCounter]["type"]; +$strSrc = $this-_scripts[$intCounter]["src"]; $strHtml .= "SCRIPT language=\"$strType\" src=\"$strSrc\"/SCRIPT\n"; } $strHtml .= "/HEAD\n"; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]