Re[2]: [PHP] Help!! with array's Please
Hello Tom, Thursday, February 27, 2003, 7:39:52 PM, you wrote: TR> Hi, TR> Friday, February 28, 2003, 12:20:38 PM, you wrote: RK>> I really need somebody to help me with this I am totally lost on what RK>> to do RK>> I need a way to read the following text file and add to or delete from RK>> or change the data. RK>> I have been able to move it all into an array using this code RK>> $groups= file("group"); RK>> for ($i=0; $i<$number_in_group; $i++){ RK>> $groups[0]; RK>> $groups[3]; <-- this is the part of the array that I need to change RK>> } RK>> But I can not figure out how to search the array and delete from or add RK>> to the array at a given point. I would like to say add another user to RK>> the end of site6 or delete a user from site3. RK>> Could somebody give me a hand here. I have read the manual for arrays RK>> and still can't figure it out. RK>> site1:x:503:tester1 RK>> site2:x:504:tester2,tester2a RK>> site3:x:505:tester3,tester3a,tester3b RK>> site4:x:506:tester4 RK>> site5:x:507:tester5,tester5a,tester5b RK>> site6:x:508:tester6 RK>> site7:x:509:tester7,tester7a,tester7b RK>> -- RK>> Best regards, RK>> Richard mailto:[EMAIL PROTECTED] TR> your groups array will look like this TR> groups[0] = site1:x:503:tester1 TR> groups[1] = site2:x:504:tester2,tester2a TR> so loop through the array TR> $x = 0; TR> while(list($key,$val) = each($groups)){ TR> //you need split the array values like this TR> list($name,$pass,$gid,$user_list) = split (":", $groups[$x]); TR> //see if we have the right one TR> if($name = $wanted_name){ //site6 TR> //then split the usernames into a sub array TR> $users = explode(',',$userlist); TR> // to add TR> $users[] = $newuser; TR> // to delete TR> unset($users[3]) TR> // now add it back TR> $userlist = implode(',',$users) TR> $list = $name.':'.$pass.':'.$gid.':'.$userlist; TR> $groups[$x] = $list; TR> } TR> $x++; TR> //here you could fputs to a temp file then copy to the original TR> // after finished TR> } TR> Then write groups back to disk TR> -- TR> regards, TR> Tom Thanks for the help!! I still can't seam to get it to add a new user at the end of a line of the selected site name. Also how do I use the unset($users[3]) do I first have to determine what number the one I what to delete is. Here is what I have so far $newuser="tester45"; $wanted_name="site7"; $groups= file("group"); $x = 0; while(list($key,$val) = each($groups)){ //you need split the array values like this list($name,$pass,$gid,$user_list) = split (":", $groups[$x]); //see if we have the right one if($name = $wanted_name){ //site6 //then split the usernames into a sub array $users = explode(',',$userlist); // to add $users[] = $newuser; // to delete //unset($users[3]); // now add it back $userlist = implode(',',$users); $list = $name.':'.$pass.':'.$gid.':'.$userlist; $groups[$x] = $list; } $x++; $handle = fopen("group2", 'a'); fputs($handle, $groups[$x]); //here you could fputs to a temp file then copy to the original // after finished } //Then write groups back to disk -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysqldump
Hi, Thursday, February 27, 2003, 2:55:48 PM, you wrote: JTJ> Thanks! >> exec("mysqldump -c -q database -u user -ppassword", $sql); JTJ> Why is there no space between the -p and password? >>-ppassword JTJ> Am I wrong? JTJ> Thanks, JTJ> John Probably because a space is a valid char in password -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function returns an array of objects...
Hi, Friday, February 28, 2003, 4:24:54 PM, you wrote: AS> so i have a function that creates objects (with member variables) and AS> pushes those objects onto the array. after adding all of the objects, AS> the function then returns the array... AS> i'm having trouble accessing the members of each object in the AS> array...i'm trying to do something like this: AS> class Object { AS> var $id; AS> function Object($param) { AS> $this->id = $param; AS> } AS> } AS> function getArrayOfObjects() { AS> $theArray = array(); AS> for ($i = 0; $i < 10; $i++) { AS> $theArray[] = new Objects($i); AS> } AS> return $theArray; AS> } AS> $temp = getArrayOfObjects(); echo $temp[0]->>id; // this should display "0" AS> do i have to do something with references or dereference the id AS> variable some other way? i'm coming from java where something like this AS> is extremely easy... AS> thanks AS> amit Try like this (note the 2 & symbols) function &getArrayOfObjects() { $theArray = array(); for ($i = 0; $i < 10; $i++) { $theArray[] =& new Objects($i); } return $theArray; } $temp = getArrayOfObjects(); echo $temp[0]->id; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing url?variables
http://www.php.net/manual/en/security.registerglobals.php Mike wrote: Hi, I'm running Apache 2.0 and PHP 4.2.2 on a RedHat 8.0 Machine. I'm unable to pass variables through a URL like index.php?test=something. Can anyone help here? I've looked through both my httpd.conf and php.ini files and didn't see anything... -Michael -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php install help
Hey guys, Im having problems getting my helloworld.php file to Work on the apache server. My phpinfo.php works perfect. I know the code is write The error message I get is # Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. How can I correct this The linked I used is. Localhost/phpinfo.php And the one that is not working is Localhost/helloworld.php ultimatefootballleague.com/index.php [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing url?variables
Hi, I'm running Apache 2.0 and PHP 4.2.2 on a RedHat 8.0 Machine. I'm unable to pass variables through a URL like index.php?test=something. Can anyone help here? I've looked through both my httpd.conf and php.ini files and didn't see anything... -Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Function returns an array of objects...
so i have a function that creates objects (with member variables) and pushes those objects onto the array. after adding all of the objects, the function then returns the array... i'm having trouble accessing the members of each object in the array...i'm trying to do something like this: class Object { var $id; function Object($param) { $this->id = $param; } } function getArrayOfObjects() { $theArray = array(); for ($i = 0; $i < 10; $i++) { $theArray[] = new Objects($i); } return $theArray; } $temp = getArrayOfObjects(); echo $temp[0]->id; // this should display "0" do i have to do something with references or dereference the id variable some other way? i'm coming from java where something like this is extremely easy... thanks amit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: mysqldump
snip from manual for -p option: |- -p[password], --password[=...] Password to use when connecting to server. If a password is not given on the command line, you will be prompted for it. Note that if you use the short form -p you can't have a space between the option and the password. -| regds, -Original Message- From: Niels Andersen [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 16:09 To: [EMAIL PROTECTED] Subject: Re: mysqldump There mey, but need not be a space. As far as I know, the option scanner in mysqldump ignores spaces between short options and their values. "John Taylor-Johnston" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks! > > > exec("mysqldump -c -q database -u user -ppassword", $sql); > > Why is there no space between the -p and password? > > >-ppassword > > Am I wrong? > > Thanks, > John > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with getting php going(2)
G'day Karl > Hey guys I finally got my phpinfo file to show on apache server > But when I try to do a hello world or browser check I get a 500 error > message FWIW, I've seen this error when I've had mac line endings instead of unix. cheers kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with getting php going(2)
Title: Message Hey guys I finally got my phpinfo file to show on apache server But when I try to do a hello world or browser check I get a 500 error message Can anyone help me out, and educate me what I’m doing wrong. This is my scriptPHP Test php if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) { echo "You are using Internet Explorer
"; } ?> Thanks ultimatefootballleague.com/index.php [EMAIL PROTECTED] ultimatefootballleague.com/index.php [EMAIL PROTECTED]
Re: [PHP] Help with getting php going!
Please don't send MS Word content in your email. It crashed Mozilla before I was able to reply. Karl James wrote: Hey guys I finally got my phpinfo file to show on apache server But when I try to do a hello world or browser check I get a 500 error message Can anyone help me out, and educate me what I’m doing wrong. This is my scriptPHP Test php if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) { echo "You are using Internet Explorer
"; } ?> Thanks ultimatefootballleague.com/index.php [EMAIL PROTECTED] -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP] Help with getting php going!
Hey guys I finally got my phpinfo file to show on apache server But when I try to do a hello world or browser check I get a 500 error message Can anyone help me out, and educate me what I’m doing wrong. This is my scriptPHP Test php if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) { echo "You are using Internet Explorer
"; } ?> Thanks ultimatefootballleague.com/index.php [EMAIL PROTECTED]
[PHP] PHP SORT_NUMERIC
Hi, I've got to sort the $numeric_arry This doesn't seem to work: sort ($numeric_array, SORT_NUMERIC); I think its sorting $key asort ($numeric_array, SORT_NUMERIC); sorts as a string THANKS AGAIN IN ADVANCE, Jim Long JanetVal Wrote: > Well, as long as you know exactly what you are looking for, you can use > > > if ($value != "n/a")) { > > Janet Jason Lange Wrote: > Try this code (tested): > > <-- Begin Code --> > foreach ($list as $key => $value) { > // If elements value is a numeral add to numeric_array > if (is_numeric($value)) { > $numeric_array[$key] = $value; > // If value is not a numeral (presumably 'n/a') add to na_array > } else { > $na_array [$key] = $value; > } > } > > // Re-combine arrays placing all "other" values at the end > $final_array = array_merge($numeric_array, $na_array); > <-- End Code --> Original Question: >>>I have an array with an html link as key and different $vars as val: >>> >>>$list = array ( >>>'http://someplace.com/";>some place' => $vendor1_total, >>>'http://anotherplace.com/";>another place' => > > $vendor2__total, > >>>[snip] etc.. >>> >>>some vals are numeric and some vals are "n/a" >>>asort works to sort the array as a string, however, I need to sort the >>>numeric vals numeric, then have the n/a's go away or be output at the >>>bottom of the sort. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] make problem with PHP4.3.1
Hi Everyone, OK I have looked through the archives and all over the net. I apologise if this has been seen before but here goes : No matter what switches I use I get the same error when I "make" ./configure goes fine. RedHat 8.1 beta PHP 4.3.1 the error is : ext/mysql/libmysql/my_lib.lo(.text+0x3d1): In function `my_dir': /root/php-4.3.1/ext/mysql/libmysql/my_lib.c:169: undefined reference to `errno' ext/mysql/libmysql/my_lib.lo(.text+0x5ef): In function `my_stat': /root/php-4.3.1/ext/mysql/libmysql/my_lib.c:588: undefined reference to `errno' ext/mysql/libmysql/my_malloc.lo(.text+0xde): In function `my_malloc': /root/php-4.3.1/ext/mysql/libmysql/my_malloc.c:24: undefined reference to `errno' ext/mysql/libmysql/my_realloc.lo(.text+0xd5): In function `my_realloc': /root/php-4.3.1/ext/mysql/libmysql/my_realloc.c:44: undefined reference to `errno' ext/mysql/libmysql/my_delete.lo(.text+0x86): In function `my_delete': /root/php-4.3.1/ext/mysql/libmysql/my_delete.c:16: undefined reference to `errno' ext/mysql/libmysql/my_tempnam.lo(.text+0x89):/root/php-4.3.1/ext/mysql/libmys ql/my_tempnam.c:108: more undefined references to `errno' follow collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1 Thanx for any help Darrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] =at wit's end with GD Libraries=
I want to thank those who tried to help with my questions about using the GD libraries. I still have not gotten them to function using PHP. I've put two screenhots of the phpinfo() page at: www.gonefishingguideservice.com/php_page.htm If you care to take a look at those images, you'll see that I've got php and Apache working with MS Win 98. It also says that directories are enabled. I've searced for the following files that I believe I need for GD Libraries and PHP in Explorer and found: php_gd.dll -> C:\PHP\extensions php.ini -> C:\WINDOWS php4ts.dll -> C:\WINDOWS\System msvcrt.dll -> C:\WINDOWS\System When I load the phpinfo() page, it comes up like you see in the screenshots. However, when I _take out_ the semi-colon as in the line: ... extension=php_gd.dll //semi-colon taken out .. the page - or any page with a file extension.php will _not_load at all using Apache. However, when I _reinsert_ the semi-colon in the php.ini file, the .php page then loads. Any advice on how I can get the GD libaries to work will be greatly appreciated. At wit's end... Thank you. Tony Ritter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't run PHP cli script from Cron
I am trying to run a PHP CLI script from cron using PHP 4.3 and FreeBSD 5.0 This is what I have verified: My clock is set right I can run bash scripts from cron I have tried running the script as root and as other users If I run the PHP CLI script by had it works fine I set cron to run the script every minute just to make sure I am doing my cron tab right Here is my crontab entry: * * * * * /path/to/file/file_name.php I also have * * * * * /path/to/file/bash_test_script which contains the following information ls -l >> /path/to/file/holder/file_results.txt With every passing minute the bash script gets run and file file_results.txt get another ls appendied to it On the other hand, Nothing happens with the PHP script. Inside the php script I have it emailing me using the php mail() funtction. If I run this script by hand I get an email from the script. If I run the script by cron everyminute I get nothing when I should be getting a email every minute. I hope someone can help me with this.
[PHP] JP Graph
Hi all, I'm using JPGraph on a localhost for a website opened via a host redirect. My problem is that nobody can see the graphs but me ('cause I'm on localhost). Any clues? Thx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read
Hey does anyone know if you can use PHP and ASP 3.0 or I.I.S on the same hard drive on XP pro? I need to know for school, because I’m taking classes for both languages. ultimatefootballleague.com/index.php [EMAIL PROTECTED]
[PHP] 404 and parsing templates
Ok I created an engine, an extremely simple engine that parses a template file and then according to whatever page and language it is on it calls that template. Now the problem is that, well let me give you an example: I have a page called index.php which only has an include_once function in it, which includes the engine. This engine checks the name of the file, then checks a cookie and/or the browser prefs for the language then parses the template with the main table cell of the template as the included file /en/index.inc. So if you went to products.php it would parse it and grab /en/products.inc.. the way I see it is that I really do not need those .php files and could let my 404 page parse the files as needed, but there should be a better way of doing this... Each one of my .php files are the exact same thing... Cheers! Rick "Only a life lived for others is worth living." - Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] separating value="n/a" from array
Hi, Thanks to those who have helped me. Jason Lange Wrote: > Try this code (tested): > > <-- Begin Code --> > foreach ($list as $key => $value) { > // If elements value is a numeral add to numeric_array > if (is_numeric($value)) { > $numeric_array[$key] = $value; > // If value is not a numeral (presumably 'n/a') add to na_array > } else { > $na_array [$key] = $value; > } > } > > // Re-combine arrays placing all "other" values at the end > $final_array = array_merge($numeric_array, $na_array); > <-- End Code --> This works.. THANKS! HOWEVER: I think PHP is seeing a comma, in a large number and think that it IS NOT NUMERIC, because when I test a large number it put it in the $na_array Do I need to add something to this code to stip the commas? THANKS IN ADAVANCE AGAIN, Jim Long Kevin Stone wrote: > To append my own answer. In order to sort the non "n/a" values you're going > to have to build a separate array and perhaps this will simplfy the problem. > So instead of what I suggested below.. loop the array and start TWO new > arrays within the loop. One array for "n/a" values and one for non-"n/a" > values. After the values are sorted to their separate arrays do > asort($nonnavals); then concatonate the two arrays together using > array_merge(), putting the "n/a" array second. > > - Kevin > > - Original Message - > From: "Kevin Stone" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, February 27, 2003 12:04 PM > Subject: Re: [PHP] restating plea for help with sort > > > >>Hmm well upon first glance looks like all you need to do is loop that > > array > >>and start a new array within the loop. An If/Else construct checks If the >>value is "n/a" then append to the back of the new array Else prepend to > > the > >>front of the new array.You append the values manually or use >>array_push() and array_unshift(). Search the manual for more information. >>Hope that helps. >>- Kevin >> >>- Original Message - >>From: "Jim Long" <[EMAIL PROTECTED]> >>To: <[EMAIL PROTECTED]> >>Sent: Thursday, February 27, 2003 11:35 AM >>Subject: [PHP] restating plea for help with sort >> >> >> >>>Hi, >>> >>>I have an array with an html link as key and different $vars as val: >>> >>>$list = array ( >>>'http://someplace.com/";>some place' => $vendor1_total, >>>'http://anotherplace.com/";>another place' => > > $vendor2__total, > >>>[snip] etc.. >>> >>>some vals are numeric and some vals are "n/a" >>>asort works to sort the array as a string, however, I need to sort the >>>numeric vals numeric, then have the n/a's go away or be output at the >>>bottom of the sort. >>> >>>Please be clear and gentle.. I'm not schooled in php, just a tinkerer >>>trying to make this mess work. >>> >>>Thanks In Advance, >>> >>>Jim Long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie look for some content specific tutorials
In a message dated 2/27/2003 12:47:25 PM Pacific Standard Time, [EMAIL PROTECTED] writes: >First time poster here and a 1 week old PHP/Mysql programmer > >I have bought several books and scoured the net for any and all PHP/MySQL >tutorials. Here is the problem I am running into: > >1. The docs tell how to access MySql through the MySql monitor >2. any docs that tutor how to make PHP interact with MySql has you doing all >the functions directly on the page >3. All the rest are written like VCR instructions (Mine still blinks >"12:00") > >What I am looking for is a tutorial that talks specifically about the >interaction of PHP forms with MySql > >I have figured out how to add records using PHP, and have even figured out a >crude search function, but being able to update or delete records are >eluding me. Here's a mini-tutorial. This is how it basically works. These are the steps: 1. connect to the database 2. send an SQL query to the database 3. If the query sends back some data, it stores it in a temporary table and you need to get it from that table and do whatever you want to do with it. Here's code: For step 1. $connection = mysql_connect("host","user","password") or die("can't connect"); $db = mysql_select_db("dbname") or die("can't connect to db"); For step 2. $sql = "UPDATE tablename SET custname='$custname'"; {or whatever SQL query you want to execute. If you have books about MySQL, they will describe the SQL queries you can use.) $result = mysql_query($sql) or die("couldn't execute query"); For step 3. If your query returns data that you want to use, such as a SELECT query, the data is stored in a temporary table and you can use $result to get data from the temp table. And then you do whatever you want with it. To get one row of data, you can use this code: $row = mysql_fetch_array($result); Row is now an array with all the fields you selected. You can get any particular field using $row['fieldname']. You can break it apart using extract: extract($row); Which turns the array into separate variables, given the field names, such as $fieldname = valuefromdb. If you have more than one row in your results, you can get all the rows using a while loop, for example: while($row = mysql_fetch_array($result)) { extract($row); echo $custname,$custaddress; } This will go through all the rows, echoing the values from the fields, custname and custaddress. That's basically it. There are other ways to do these things. But you can do the basic things you need to do using these PHP statements. You can also look up the mysql functions in the PHP online manual (http://www.php.net/manual/en/ref.mysql.php) to see other possibilities for interacting with MySQL databases from PHP scripts. The MySQL online manual has a tutorial chapter that you can use. It describes SQL using the mysql client, but you can read it just to see how to use the SQL queries. Just put any of the queries described into the $sql variable below, and that will work. In summary: $connection = mysql_connect("host","user","password") or die("Can't connect to MySQL"); $db = mysql_select_db("dbname") or die("Can't select db"); $sql = "SQL query here"; $result = mysql_query($sql) or die("Couldn't execute query"); And the following only if the query was a SELECT $row = mysql_fetch_array($result); extract($row); Good luck, Janet __ Janet Valade Author, PHP & MySQL for Dummies janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help!! with array's Please
Hi, Friday, February 28, 2003, 12:20:38 PM, you wrote: RK> I really need somebody to help me with this I am totally lost on what RK> to do RK> I need a way to read the following text file and add to or delete from RK> or change the data. RK> I have been able to move it all into an array using this code RK> $groups= file("group"); RK> for ($i=0; $i<$number_in_group; $i++){ RK> $groups[0]; RK> $groups[3]; <-- this is the part of the array that I need to change RK> } RK> But I can not figure out how to search the array and delete from or add RK> to the array at a given point. I would like to say add another user to RK> the end of site6 or delete a user from site3. RK> Could somebody give me a hand here. I have read the manual for arrays RK> and still can't figure it out. RK> site1:x:503:tester1 RK> site2:x:504:tester2,tester2a RK> site3:x:505:tester3,tester3a,tester3b RK> site4:x:506:tester4 RK> site5:x:507:tester5,tester5a,tester5b RK> site6:x:508:tester6 RK> site7:x:509:tester7,tester7a,tester7b RK> -- RK> Best regards, RK> Richard mailto:[EMAIL PROTECTED] your groups array will look like this groups[0] = site1:x:503:tester1 groups[1] = site2:x:504:tester2,tester2a so loop through the array $x = 0; while(list($key,$val) = each($groups)){ //you need split the array values like this list($name,$pass,$gid,$user_list) = split (":", $groups[$x]); //see if we have the right one if($name = $wanted_name){ //site6 //then split the usernames into a sub array $users = explode(',',$userlist); // to add $users[] = $newuser; // to delete unset($users[3]) // now add it back $userlist = implode(',',$users) $list = $name.':'.$pass.':'.$gid.':'.$userlist; $groups[$x] = $list; } $x++; //here you could fputs to a temp file then copy to the original // after finished } Then write groups back to disk -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] output buffering
You can't display an image like that in HTML. You need to make a second PHP script that displays just the image, and call it with a tag. Kevin Waterson wrote: >I am having some problems with ob_* > >My goals is basically this > >Stuff goes here > >More stuff here > >The code below works until the showImage method is called, it does show the image >however, it does not output the 'Stuff goes here!' line. > >any guidance greatfully recieved. >Code is below.. > >Kevin > > > >class thumbs { > >function thumbs(){ > >} > > >function showThumbs(){ >return 'Thumbs'; >} > > >function select(){ >if(isset($_GET['show'])) >{ >return $this->showImage($_GET['show']); >} > else >{ >return $buffer.$this->showThumbs(); >} >} > > >function showImage(){ > $size = getimagesize ('./australia.jpg'); > if ($size) >{ >header("Content-type: {$size['mime']}"); >return file_get_contents('australia.jpg'); >} > else >{ >return ' was not found on this server'; >} >} >} // end class > >$thumbs = new thumbs; > >ob_start(array($thumbs,'select')); > >?> > >Stuff goes here! > >ob_end_flush(); >?> > > > > > > -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] virtual() test
Hi, Friday, February 28, 2003, 1:16:56 PM, you wrote: TR> Hi, TR> Friday, February 28, 2003, 12:09:30 PM, you wrote: JWH>> Can anyone with Apache verify that you can pass arguments inside of a JWH>> virtual() call? Something like: JWH>> Virtual("script.pl?id=1") JWH>> And have $id available within script.pl. JWH>> I don't have access to an Apache server right now to test, so thank you JWH>> very much. JWH>> ---John W. Holmes... JWH>> PHP Architect - A monthly magazine for PHP Professionals. Get your copy JWH>> today. http://www.phparch.com/ TR> it shows up under TR> _SERVER["QUERY_STRING"] => id=1 TR> I ran the following script (virt) in cgi-bin TR> #!/usr/bin/php TR> header('Content-type: text/plain'); TR> echo "\n"; TR> echo 'Test script report'; TR> phpinfo(32); ?>> TR> Then virtual('/cgi-bin/virt?id=1'); TR> -- TR> regards, TR> Tom That would be echo QUERY_STRING = "$QUERY_STRING" in perl -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] virtual() test
Hi, Friday, February 28, 2003, 12:09:30 PM, you wrote: JWH> Can anyone with Apache verify that you can pass arguments inside of a JWH> virtual() call? Something like: JWH> Virtual("script.pl?id=1") JWH> And have $id available within script.pl. JWH> I don't have access to an Apache server right now to test, so thank you JWH> very much. JWH> ---John W. Holmes... JWH> PHP Architect - A monthly magazine for PHP Professionals. Get your copy JWH> today. http://www.phparch.com/ it shows up under _SERVER["QUERY_STRING"] => id=1 I ran the following script (virt) in cgi-bin #!/usr/bin/php Then virtual('/cgi-bin/virt?id=1'); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] non transmitted cookie
That is why I suggested passing all that over SSL which would make it very difficult to get the data even if you were able to get the packets. If you are operating with data that you care about you probably need SSL. There is not much point in creating some type of applet combination that your user's client will need to support when you can use SSL which is widely supported already. Jason On Wed, 2003-02-26 at 23:44, Dennis Gearon wrote: > Unless of course, you are listening into the network connection :-) > > Jason Sheets wrote: > > > > Not that I am aware of, it seems you would be better off using SSL, if > > you are concerned about someone hijacking the sessions you could > > generate your own session id (I generate random 80 character session ids > > instead of 32) and also limit the life of the session, you could write > > logic to change the session ID every n minutes which would make brute > > forcing the session id even harder. > > > > Jason > > On Wed, 2003-02-26 at 11:34, Dennis Gearon wrote: > > > Is there anyway for a page to save information on a user's computer which is > > > accessible via java or > > > javascript, but doesn't get sent with each HTML request the way a cookie is? > > > > > > I had this idea, patterned after kerberos: > > > > > > 1/ A user logs into a site via a secure link. > > > 2/ A hash salt is stored on their computer and an > > >initial hash is generated for the user as a Password > > >to their session key. > > > 3/ The user is redirected to the non secure part of the site > > >and they have both the hash-pw plus session key in their document. > > > 4/ Each time they access a page on our site, a javascript fires > > >which generates the next sequence in the hash-pw. > > > 5/ the server also generates the same new sequence and compares > > >it. If the session key and the new password agree, then > > >it is the user attached to the session. > > > > > > So, this salt needs to NOT be transmitted via the cookie so > > > that it does not appear 'in the clear', which would invalidate > > > it's use. > > > > > > Please CC me when you reply to the list, I am on digest. > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > > Carpe Dancem ;-) > - > Remember your friends while they are alive > - >Sincerely, Dennis Gearon > > -- > 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] Help!! with array's Please
I really need somebody to help me with this I am totally lost on what to do I need a way to read the following text file and add to or delete from or change the data. I have been able to move it all into an array using this code $groups= file("group"); for ($i=0; $i<$number_in_group; $i++){ $groups[0]; $groups[3]; <-- this is the part of the array that I need to change } But I can not figure out how to search the array and delete from or add to the array at a given point. I would like to say add another user to the end of site6 or delete a user from site3. Could somebody give me a hand here. I have read the manual for arrays and still can't figure it out. site1:x:503:tester1 site2:x:504:tester2,tester2a site3:x:505:tester3,tester3a,tester3b site4:x:506:tester4 site5:x:507:tester5,tester5a,tester5b site6:x:508:tester6 site7:x:509:tester7,tester7a,tester7b -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP to read MS-SQL (solution)
On Thu, 27 Feb 2003 14:31:45 -0800 (PST), you wrote: >Basically, it runs on the >MS-SQL server and allows requests in XML format on a certain port. That's actually pretty cool, from a tech standpoint, but why not access the MS-SQL database directly? From Windows it's easy, you just need the SQL .dll's installed on the server, and from Linux/Unix you can build PHP with FreeTDS support (--with-sybase=/usr/local/freetds). There is an article detailing the second approach here: http://www.phpbuilder.com/columns/alberto2919.php3 It's rather old, but still has useful information. My company is using PHP on Linux and accessing a MS SQL 7 server for all it's data. We've had it in production for nearly a year now and it's worked nearly flawlessly. Sorry if I misunderstood your message... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] virtual() test
Can anyone with Apache verify that you can pass arguments inside of a virtual() call? Something like: Virtual("script.pl?id=1") And have $id available within script.pl. I don't have access to an Apache server right now to test, so thank you very much. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] output buffering
I am having some problems with ob_* My goals is basically this Stuff goes here More stuff here The code below works until the showImage method is called, it does show the image however, it does not output the 'Stuff goes here!' line. any guidance greatfully recieved. Code is below.. Kevin showImage($_GET['show']); } else { return $buffer.$this->showThumbs(); } } function showImage(){ $size = getimagesize ('./australia.jpg'); if ($size) { header("Content-type: {$size['mime']}"); return file_get_contents('australia.jpg'); } else { return ' was not found on this server'; } } } // end class $thumbs = new thumbs; ob_start(array($thumbs,'select')); ?> Stuff goes here! -- __ (_ \ _) ) | / / _ ) / _ | / ___) / _ ) | | ( (/ / ( ( | |( (___ ( (/ / |_| \) \_||_| \) \) Kevin Waterson Port Macquarie, Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restating plea for help with sort
Try this code (tested): <-- Begin Code --> foreach ($list as $key => $value) { // If elements value is a numeral add to numeric_array if (is_numeric($value)) { $numeric_array[$key] = $value; // If value is not a numeral (presumably 'n/a') add to na_array } else { $na_array [$key] = $value; } } // Re-combine arrays placing all "other" values at the end $final_array = array_merge($numeric_array, $na_array); <-- End Code --> Hope that helps, Jason Kevin Stone wrote: To append my own answer. In order to sort the non "n/a" values you're going to have to build a separate array and perhaps this will simplfy the problem. So instead of what I suggested below.. loop the array and start TWO new arrays within the loop. One array for "n/a" values and one for non-"n/a" values. After the values are sorted to their separate arrays do asort($nonnavals); then concatonate the two arrays together using array_merge(), putting the "n/a" array second. - Kevin - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, February 27, 2003 12:04 PM Subject: Re: [PHP] restating plea for help with sort Hmm well upon first glance looks like all you need to do is loop that array and start a new array within the loop. An If/Else construct checks If the value is "n/a" then append to the back of the new array Else prepend to the front of the new array.You append the values manually or use array_push() and array_unshift(). Search the manual for more information. Hope that helps. - Kevin - Original Message - From: "Jim Long" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 27, 2003 11:35 AM Subject: [PHP] restating plea for help with sort Hi, I have an array with an html link as key and different $vars as val: $list = array ( 'http://someplace.com/";>some place' => $vendor1_total, 'http://anotherplace.com/";>another place' => $vendor2__total, [snip] etc.. some vals are numeric and some vals are "n/a" asort works to sort the array as a string, however, I need to sort the numeric vals numeric, then have the n/a's go away or be output at the bottom of the sort. Please be clear and gentle.. I'm not schooled in php, just a tinkerer trying to make this mess work. Thanks In Advance, Jim Long -- 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
RE: [PHP] Preventing the "hijacking" of pictures
> What about using a MySQL database? Insert the picture into a field in > a table, then use a php script to call the data. I've been working on > something like this. Is it practical, or am I barking up the wrong > tree? Too much overhead, in my opinion. Same result if you just stored the files outside of the web root. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] Help with Arrays
Begin forwarded message: From: Pushpinder Singh Garcha <[EMAIL PROTECTED]> Date: Thu Feb 27, 2003 7:57:38 PM US/Eastern To: olinux <[EMAIL PROTECTED]> Subject: Re: [PHP] Help with Arrays Thanks My question was that each line of the file should be stored as one element of the array. This is because, I need to compare each line of the text file against some user values. TIA --Pushpinder On Thursday, February 27, 2003, at 04:33 PM, olinux wrote: and what problem is that?> how about just using the example? http://www.php.net/manual/en/function.file.php $lines = file ('http://www.example.com/'); // Loop through our array, show html source as html source; and line numbers too. foreach ($lines as $line_num => $line) { echo "Line #{$line_num} : " . htmlspecialchars($line) . "\n"; } --- Pushpinder Singh Garcha <[EMAIL PROTECTED]> wrote: Hello all I am having some problem with arrays THIS IS THE PHP CODE $temp = file("file.txt"); if(!$temp) { echo "File could not be read by array !! "; exit; } else echo "Array was opened !!"; $x = count($temp); echo "Array Count is: $x"; echo "$temp[0]"; //$P = str_replace("\r\n", "\n" , $temp); echo "First: $temp[0]"; $P_new = explode(" ",$temp); echo "Next: $P_new[0]"; THIS IS THE TEXT FILE CALLLED ''file.txt'' abc111 asd123 aqw234 www234 edr234 vfr456 When I echo "$temp[0]" ... I get abc111 asd123 aqw234 www234 edr234 vfr456 on one straight line, which is weird. I should get it on separate lines.. Also I am unable to separate the lines of the file using the explode(). Any help will be highly appreciated --Pushpinder Pushpinder Singh Garcha _ Web Architect __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Pushpinder Singh Garcha _ Web Architect Pushpinder Singh Garcha _ Web Architect
Re: [PHP] HELP PLEASE ! Need PHP Advice !!!
Right, well there's a few issues here. 1. You're asking if there's a way to parse a QXD file so retrieve the text from it. I doubt this can be done. I had a quick google for it, to no luck. I also bothered to open up a Quark 3.32 file in my text editor, to check out the source. It looks pretty complex. However, there MAY be some light at the end of the tunnel. a) PHP *IS* able to read and write PDF format. Prerhaps if your newspaper designers export a PDF of the newspaper (relatively easy). you can pick up the pieces you need through the PDF, rather than the QXD file. b) What you're really talking about is using one set of data in multiple ways (web & print, then maybe email, WAP, PDA, etc). What I'd be aiming to do is have all the text/content stored in a shared database or easy-to-parse file format (like XML), so that the writers write to this format, then the designers copy + paste to Quark, the editors can edit directly in the XML file or via database GUIs, and people in charge of other content formats (like web_ can either copy + paste from the central content, or parse it with a program like PHP. c) Perhaps your company should look at Adobe InDesign 2 -- I read an article which briefly discussed it's ability to parse or read from XML files -- so you could have a simple XML doc: --- 28 Learning about XML I wish I had time to explore this properly! Justin French [EMAIL PROTECTED] XML,Justin,Foo,Bah,PHP In this article, I'll attempt to show you some blah blah. Paragraph 1 Paragraph 2 Paragraph 3 This is my footer --- I *think* InDesign 2 can take this data, and with the designer's help, format it to a "designed" article. At the very least, you could export some nice clean plain text for the designer to copy+paste, which is probably what they already do (copy+paste from Word to Quark. 2. Image files in Quark need to be either TIFF or EPS format. So, what you need is a way of copying these files, converting them to JPEGs, GIFs or PNGs, and resizing them to suit the web. I don't really know if the image functions in PHP can do this... best left to others. You *could* batch convert everything to a RGB JPEG using photoshops batch processing and actions, THEN get PHP or Photoshop to do the resizing etc. However, "cropping and whatnot" of a file is often something that can ONLY be done by eye... You may never be able to achieve this with automated computer programs. Think about the real issue. Is it "taking stuff from quark and messing with it", or is it "having a good clean source of data which can be used many ways"? Justin French on 28/02/03 12:24 AM, justin brenton ([EMAIL PROTECTED]) wrote: > can anyone give me some good advise on how abouts I should go about > maintaining a newspaper website. > > here is what is currently in place and how i want it to be managed > > right now the newspapers are published in a quark file from that file > pictures have to be placed in photoshop and resized , croped and what not > and then inserted into a html page, the content i.e text is in this quark > file as well and is copied and pasted into a html file, what i want to do is > have the site automated to some extent so i do not have to be doing all this > copying and pasteing it's a total waste valueable time. what i would like to > have it some way to have a php script to take this info from the quark file > and the pictures and have them either transfered to a html page or to a > database from there i could call from the php script. > > > > ANYONE HAVE ANY IDEAS ON A GOOD WAY TO GO ABOUT THIS ... PLEASE CONTACT ME > > [EMAIL PROTECTED] > > remove the NOSPAM from address > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with arrays
Hi, Origninal Post: > I have an array with an html link as key and different $vars as val: > > $list = array ( > 'http://someplace.com/";>some place' => $vendor1_total, > 'http://anotherplace.com/";>another place' => $vendor2__total, > [snip] etc.. > > some vals are numeric and some vals are "n/a" > asort works to sort the array as a string, however, I need to sort the > numeric vals numeric, then have the n/a's go away or be output at the > bottom of the sort. Kevin Stone wrote: (THANKS) > In order to sort the non "n/a" values you're going > to have to build a separate array and perhaps this will simplfy the problem. > So instead of what I suggested earlier.. loop the array and start TWO new > arrays within the loop. One array for "n/a" values and one for non-"n/a" > values. After the values are sorted to their separate arrays do > asort($nonnavals); then concatonate the two arrays together using > array_merge(), putting the "n/a" array second. I can't fiqure out how to set up arrays inside the while loop. Using this: while (list ($key, $val) = each ($orderd_list)) { if ($val == 'n/a'){ $no_plan_list = array ($key => $val);// need an array here for "n/a" }else{ $plan_list = array ($key => $val);// need an array here for numeric vals } } Thanks In Advance, Jim Long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need PHP programmer
Don't know if this is appropriate or not but here we go. I need help with a project. requires a PHP developer. The two programs we're using are php and MySQL. Anyone interested or anyone who can help guide me to a place to find help please reply to me directly or to the list as you feel appropriate. I'd like to find someone in Los Angeles area if possible but not essential. Thanks in advance, Jeff [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pdf
hey guys, just a quick question re: creating pdf files on the fly. i was wondering if anyone knew if it is possible to fully justify text? thanks in anticipation, john -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem in writing into an html text file
thanks it's working now - Original Message - From: "Matt Honeycutt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 28, 2003 7:23 AM Subject: RE: [PHP] problem in writing into an html text file > Check stripslashes(), I think that will help you. > > ---Matt > > -Original Message- > From: Michael P. Carel [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 27, 2003 4:53 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] problem in writing into an html text file > > > this code add a backslashes in all doubleqoutes in the html file. > > sample: > before editing my.html file > > > > after editing my.html file > > > > any idea why and how can i avoid this? > > > > sorry here's the sample code: > > > > > if(!$submit){ > > ?> > > > > > $filename="my.html"; > > $fd=fopen($filename,"r+") or die("Can't open file $filename"); > > $message = fread($fd, filesize($filename)); > > fclose($fd); > > ?> > $message;?>/textarea> > > > > > > > }else{ > > > > $filename="my.html"; > > $fd=fopen($filename,"w") or die("Can't open file $filename"); > > $fstring=$message; > > $fout = fwrite($fd, $fstring); > > fclose($fd); > > > > } > > ?> > > > > the html file upon modify multiplies all the backslashes. > > > > any idea why? thanks in advance. > > > > > > > > - Original Message - > > From: "Jason Sheets" <[EMAIL PROTECTED]> > > To: "Michael P. Carel" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Thursday, February 27, 2003 12:04 PM > > Subject: Re: [PHP] problem in writing into an html text file > > > > > > > Hello Mike, > > > > > > You will need to better describe your problem and preferably show some > > > source code. > > > > > > What characters are being added to it? You could use str_replace or the > > > regular expression replacement functions but you should not get added > > > characters in general. > > > > > > Jason > > > On Wed, 2003-02-26 at 19:07, Michael P. Carel wrote: > > > > hi to all, > > > > > > > > Im having a problem writing an HTML code in a text file which comes > from > > the > > > > html text area as an editor. There's an added characters inserted to > it. > > How > > > > could i write to it perfectly? > > > > > > > > mike > > > > > > > > > > > > -- > > > > 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 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
RE: [PHP] Destroying COM objects
> When using the COM functions in PHP what is the equivalent of > ASPs "set object=nothing"? > I am using the Crystal Report objects and I cannot seem to > destroy my Report object. Have you tried setting it to NULL? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session.use_trans_sid on php 4.3.1
Hi guys , Seams like ini_set('session.use_trans_sid',0) does not work right on PHP 4.3.1 on Linux. //-- PHP config is: './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-swf=/usr/local/flash' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt' '--with-ming=../ming-0.2a' '--enable-magic-quotes' '--with-mysql' '--with-pear' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--enable-versioning' '--with-zlib' //-- Anyone encountered this problem before? Thanks, Radu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Destroying COM objects
When using the COM functions in PHP what is the equivalent of ASPs "set object=nothing"? I am using the Crystal Report objects and I cannot seem to destroy my Report object. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem in writing into an html text file
Check stripslashes(), I think that will help you. ---Matt -Original Message- From: Michael P. Carel [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 4:53 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] problem in writing into an html text file this code add a backslashes in all doubleqoutes in the html file. sample: before editing my.html file after editing my.html file any idea why and how can i avoid this? > sorry here's the sample code: > > if(!$submit){ > ?> > > $filename="my.html"; > $fd=fopen($filename,"r+") or die("Can't open file $filename"); > $message = fread($fd, filesize($filename)); > fclose($fd); > ?> $message;?>/textarea> > > > }else{ > > $filename="my.html"; > $fd=fopen($filename,"w") or die("Can't open file $filename"); > $fstring=$message; > $fout = fwrite($fd, $fstring); > fclose($fd); > > } > ?> > > the html file upon modify multiplies all the backslashes. > > any idea why? thanks in advance. > > > > - Original Message - > From: "Jason Sheets" <[EMAIL PROTECTED]> > To: "Michael P. Carel" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Thursday, February 27, 2003 12:04 PM > Subject: Re: [PHP] problem in writing into an html text file > > > > Hello Mike, > > > > You will need to better describe your problem and preferably show some > > source code. > > > > What characters are being added to it? You could use str_replace or the > > regular expression replacement functions but you should not get added > > characters in general. > > > > Jason > > On Wed, 2003-02-26 at 19:07, Michael P. Carel wrote: > > > hi to all, > > > > > > Im having a problem writing an HTML code in a text file which comes from > the > > > html text area as an editor. There's an added characters inserted to it. > How > > > could i write to it perfectly? > > > > > > mike > > > > > > > > > -- > > > 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 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] problem in writing into an html text file
this code add a backslashes in all doubleqoutes in the html file. sample: before editing my.html file after editing my.html file any idea why and how can i avoid this? > sorry here's the sample code: > > if(!$submit){ > ?> > > $filename="my.html"; > $fd=fopen($filename,"r+") or die("Can't open file $filename"); > $message = fread($fd, filesize($filename)); > fclose($fd); > ?> $message;?>/textarea> > > > }else{ > > $filename="my.html"; > $fd=fopen($filename,"w") or die("Can't open file $filename"); > $fstring=$message; > $fout = fwrite($fd, $fstring); > fclose($fd); > > } > ?> > > the html file upon modify multiplies all the backslashes. > > any idea why? thanks in advance. > > > > - Original Message - > From: "Jason Sheets" <[EMAIL PROTECTED]> > To: "Michael P. Carel" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Thursday, February 27, 2003 12:04 PM > Subject: Re: [PHP] problem in writing into an html text file > > > > Hello Mike, > > > > You will need to better describe your problem and preferably show some > > source code. > > > > What characters are being added to it? You could use str_replace or the > > regular expression replacement functions but you should not get added > > characters in general. > > > > Jason > > On Wed, 2003-02-26 at 19:07, Michael P. Carel wrote: > > > hi to all, > > > > > > Im having a problem writing an HTML code in a text file which comes from > the > > > html text area as an editor. There's an added characters inserted to it. > How > > > could i write to it perfectly? > > > > > > mike > > > > > > > > > -- > > > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Automatically included file?
> New to PHP, I was wondering if PHP, running as a module under Apache 2, > had an automatically included script that would run prior to any/each > PHP script served by Apache? > > Tks, > Dwayne Dwayne Look into the auto_prepend_file directive that you can specify in php.ini - this may suit your needs. Cheers Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: using php to rotate ad banners
Hello, On 02/27/2003 04:27 PM, Joseph Bannon wrote: Why don't you just use phpAdsNew? Because I prefer to write it myself so I can learn more. You can learn more studying the solutions provided by those that already attempted to implement the same problem. Just study phpAdsNew and you will learn more than you will possible learn from this list as this is not a trivial issue as you may imagine. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Automatically included file?
New to PHP, I was wondering if PHP, running as a module under Apache 2, had an automatically included script that would run prior to any/each PHP script served by Apache? Tks, Dwayne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP to read MS-SQL (solution)
Thought I would throw this out if anyone is interested. We have some proprietary accounting software that uses MS-SLQ as it's backend. Not my choice, trust me. Anyhow, I hassled the guy who made the software long enough that he created a solution until we can swith to MySQL. Basically, it runs on the MS-SQL server and allows requests in XML format on a certain port. Those requests contain different information including the SQL query, whether it returns in XML or deliminated, and how you wanted it delimated (comma, whatever character). My PHP script does a very simple fsockopen, fput, fget, then explode to get the data. He is planning on releasing it for free (maybe GPL with source if he can) so if anyone is interested let me know. Thanks, Bryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date, "first of next month"?
On Wed, 26 Feb 2003, Philip Hallstrom wrote: | |Use the w option of date() and loop through adding 86400 to $t until you |get to a number between 1 and 5. | | w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) I may of gotten ahead of myself, but I tried it using if/else. Looks like this: $t = mktime(0,0,0,date('m')+1,1,date('Y')); $expdate = date("l, F jS Y", $t); $expdatenum = date("w", $t); if ($expdatenum == "6") { $rendate = date("l, F jS Y", strtotime("$expdate +2 days")); } else { $rendate = date("l, F jS Y", strtotime("$expdate +1 day")); } I'm not sure if it would be more inefficient or what, but it seems to work (so far). I'm not too worried about efficiency because it will only run once a month. Thanks to everyone who replied! I appreciate all the help! Bryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date problem
> From: "Alexander Tsonev" <[EMAIL PROTECTED]> > > Hello, > I would ask you a question about date type > if I have a variable from date type ($newdate) such as 2003-02-17 > how can I separate $newdate into 3 different variables? I want to create > such variables: > $day=17 > $month=2 > $year=2003 > I searched a lot, but I didn't find how to do this. > I'll be very happy if someone helps! > list($year, $month, $day) = explode("-", $newdate); -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with Extending PHP
This might help: http://www.tutorbuddy.com/software/phpcpp/phpcpp/ J Michel M. Dos Santos wrote: > > > Hi, > > I have a doubt about extending functions in PHP. I want to use C++ > language rather than C pure. I saw that dotnet module has cpp file. Is it > possible ? > > Thanks a lot, > > Michel M. dos Santos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date problem
$date_array=explode("-",$newdate); $day = $date_array[2]; $month = $date_array[1]; $year = $date_array[0]; Or, $timestamp - strtotime($newdate); $today = getdate($timestamp); $month = $today['month']; $mday = $today['mday']; $year = $today['year']; "Alexander Tsonev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > I would ask you a question about date type > if I have a variable from date type ($newdate) such as 2003-02-17 > how can I separate $newdate into 3 different variables? I want to create > such variables: > $day=17 > $month=2 > $year=2003 > I searched a lot, but I didn't find how to do this. > I'll be very happy if someone helps! > > Thanks in advance, Alexander Tsonev > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic XUL?
I'm considering making a dynamic application for Mozilla/Netscape using PHP and XUL. Has anyone here done this? Anything I should be aware of? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date problem
Hello, I would ask you a question about date type if I have a variable from date type ($newdate) such as 2003-02-17 how can I separate $newdate into 3 different variables? I want to create such variables: $day=17 $month=2 $year=2003 I searched a lot, but I didn't find how to do this. I'll be very happy if someone helps! Thanks in advance, Alexander Tsonev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with Arrays
and what problem is that?> how about just using the example? http://www.php.net/manual/en/function.file.php $lines = file ('http://www.example.com/'); // Loop through our array, show html source as html source; and line numbers too. foreach ($lines as $line_num => $line) { echo "Line #{$line_num} : " . htmlspecialchars($line) . "\n"; } --- Pushpinder Singh Garcha <[EMAIL PROTECTED]> wrote: > Hello all > > I am having some problem with arrays > > THIS IS THE PHP CODE > > $temp = file("file.txt"); > > if(!$temp) > { > echo "File could not be read by array !! > "; > exit; > } > else > echo "Array was opened !!"; > > $x = count($temp); > echo "Array Count is: $x"; > echo "$temp[0]"; > > //$P = str_replace("\r\n", "\n" , $temp); > > echo "First: $temp[0]"; > $P_new = explode(" ",$temp); > echo "Next: $P_new[0]"; > > > THIS IS THE TEXT FILE CALLLED ''file.txt'' > > abc111 > asd123 > aqw234 > www234 > edr234 > vfr456 > > > > When I echo "$temp[0]" ... I get abc111 asd123 > aqw234 www234 edr234 > vfr456 on one straight line, which is weird. I > should get it on > separate lines.. Also I am unable to separate the > lines of the file > using the explode(). > > Any help will be highly appreciated > > --Pushpinder > > > > Pushpinder Singh Garcha > _ > Web Architect > __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with Arrays
Hello all I am having some problem with arrays THIS IS THE PHP CODE $temp = file("file.txt"); if(!$temp) { echo "File could not be read by array !! "; exit; } else echo "Array was opened !!"; $x = count($temp); echo "Array Count is: $x"; echo "$temp[0]"; //$P = str_replace("\r\n", "\n" , $temp); echo "First: $temp[0]"; $P_new = explode(" ",$temp); echo "Next: $P_new[0]"; THIS IS THE TEXT FILE CALLLED ''file.txt'' abc111 asd123 aqw234 www234 edr234 vfr456 When I echo "$temp[0]" ... I get abc111 asd123 aqw234 www234 edr234 vfr456 on one straight line, which is weird. I should get it on separate lines.. Also I am unable to separate the lines of the file using the explode(). Any help will be highly appreciated --Pushpinder Pushpinder Singh Garcha _ Web Architect
RE: [PHP] Newbie look for some content specific tutorials
take a look at the database abstraction layer ADODB at php.weblog.com Even if you are like me and never use more than just MySQL, it makes like a lot easier. =C= * Cal Evans * Stay Plugged Into Your Audience * http://www.christianperformer.com -Original Message- From: Hunter, Jess [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 2:38 PM To: [EMAIL PROTECTED] Subject: [PHP] Newbie look for some content specific tutorials Greets all, First time poster here and a 1 week old PHP/Mysql programmer I have bought several books and scoured the net for any and all PHP/MySQL tutorials. Here is the problem I am running into: 1. The docs tell how to access MySql through the MySql monitor 2. any docs that tutor how to make PHP interact with MySql has you doing all the functions directly on the page 3. All the rest are written like VCR instructions (Mine still blinks "12:00") What I am looking for is a tutorial that talks specifically about the interaction of PHP forms with MySql I have figured out how to add records using PHP, and have even figured out a crude search function, but being able to update or delete records are eluding me. Does anyone know of a site that has this type of information with some extremely well commented samples? Thanks Jester -- 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] Re: Re: Re: Editors
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey Jim, - From the WINE Faq (http://www.winehq.org/). "3.8. Do I need to have a DOS partition on my system to use Wine? You do not need a licensed and installed copy of DOS or MS Windows to install, configure and run Wine. However, Wine has to be able to 'see' an MS Windows binary (i.e. application) if it is to run it." You *might* need to download some of the common windows type dlls but thats about all. :) ~Paul On Thursday 27 February 2003 01:12 pm, James Hatridge wrote: [snip] > I stopped using Windows at 3.1 . If I understand correctly you have to > have a copy of W$ 9X (or whatever). If this is true then I can't use wine > because I don't have a usable copy of W$. Has this changed in the past few > years? > > Thanks > JIM > PS Been useing SuSE since version 4.4.1 :) - -- ~Paul Nicholson Design Specialist @ WebPower Design [EMAIL PROTECTED] www.webpowerdesign.net "The webthe way you want it!" "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE+XnYXDyXNIUN3+UQRAoUuAKCeN+6ejYXcaBeW2xA2c6PawFY3YgCfWNiA 75QGnpM/751hqcXECTst/t4= =snUY -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with Extending PHP
Hi, I have a doubt about extending functions in PHP. I want to use C++ language rather than C pure. I saw that dotnet module has cpp file. Is it possible ? Thanks a lot, Michel M. dos Santos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie look for some content specific tutorials
Greets all, First time poster here and a 1 week old PHP/Mysql programmer I have bought several books and scoured the net for any and all PHP/MySQL tutorials. Here is the problem I am running into: 1. The docs tell how to access MySql through the MySql monitor 2. any docs that tutor how to make PHP interact with MySql has you doing all the functions directly on the page 3. All the rest are written like VCR instructions (Mine still blinks "12:00") What I am looking for is a tutorial that talks specifically about the interaction of PHP forms with MySql I have figured out how to add records using PHP, and have even figured out a crude search function, but being able to update or delete records are eluding me. Does anyone know of a site that has this type of information with some extremely well commented samples? Thanks Jester -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Automatic .htaccess Authentication?
I'm looking for a way to have php automatically log a user into an htaccess protected directory. My problem is as follows. I currently have a large number of php scripts which use a database authentication system. Unfortunately, there are also a number of old CGI scripts which need to be protected by an .htaccess file. What I'm looking for is a way to allow php to perform the .htaccess authentication in the background when the user first logs into the DB based authentication so that when they go to access the cgi scripts they are not prompted for another login. Any Ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HELP!! with array's
Hello , I need a way to read the following text file and add to or delete from or change the data. I have been able to move it all into an array using this code $groups= file("group"); for ($i=0; $i<$number_in_group; $i++){ } But I can not figure out how to search the array and delete from or add to the array at a given point. I would like to say add another user to the end of site6 or delete a user from site3. Could sombody give me a hand here. I have read the manual for arrays and still can't figure it out. site1:x:503:tester1 site2:x:504:tester2,tester2a site3:x:505:tester3,tester3a,tester3b site4:x:506:tester4 site5:x:507:tester5,tester5a,tester5b site6:x:508:tester6 site7:x:509:tester7,tester7a,tester7b -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restate: using php to rotate ad banners
Have you seen phpAdsNew ? It really kicks ass. High quality development going on with that project. Plus, they've already worked out all the issues you are having with cookies and what not by using sessions. It's really fast too, and they have some caching options to make performance even better. It's always nice to write your own stuff to learn, but seriously, if you are planning to do anything that other people need to rely on for a banner management system and server, use phpAdsNew. You can find it on SourceForge. Regards, Jason k Larson Joseph Bannon wrote: Anyone? Reply? I recently created some scripts to rotate ad banners on my site. One script is called show.php, which serves the banner. The other is called click.php, which redirects the people to the proper site for the banner they clicked on. Some people have noticed that when they click on the banner, they go to another site. Others have noticed that they just get returned back to the page that they just were at. I test it without any problems. I have been doing the redirecting using cookies. The script show.php puts the cookie on their computer. The script click.php gets the cookie and redirects them to the proper place when clicked. Should I be using cookies or sessions to do this? I think the problem is that some people have their browser set to not accept cookies which is why they get directed to other places. __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Does PHP supports threads?
Actually, there's a threads extension in PECL: http://cvs.php.net/cvs.php/pear/PECL/threads J Justin Garrett wrote: > PHP does not support threading. Depending on what you're trying to do you > may find the process control functions useful > http://www.php.net/manual/en/ref.pcntl.php > > Justin Garrett > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restate: using php to rotate ad banners
Don't reinvent the wheel :) http://www.phpadsnew.com/one/ --- Joseph Bannon <[EMAIL PROTECTED]> wrote: > Anyone? Reply? > > > I recently created some scripts to rotate ad banners > on my site. One script is called show.php, which > serves the banner. The other is called click.php, > which redirects the people to the proper site for > the banner they clicked on. > > Some people have noticed that when they click on the > banner, they go to another site. Others have noticed > that they just get returned back to the page that > they just were at. I test it without any problems. > > I have been doing the redirecting using cookies. The > script show.php puts the cookie on their computer. > The script click.php gets the cookie and redirects > them > to the proper place when clicked. Should I be using > cookies or sessions to do this? I think the problem > is that some people have their browser set to not > accept cookies which is why they get directed to > other > places. > > > __ > Do you Yahoo!? > Yahoo! Tax Center - forms, calculators, tips, more > http://taxes.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: Re: Editors
HI Paul,,, On Wednesday 26 February 2003 22:10, Paul Nicholson wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Wednesday 26 February 2003 02:19 pm, James Hatridge wrote: > [snip] > > > Thanks for the address. I looked into it closer and I find that it is > > only for Windows. Pity. > > It will run on linux using wine. Yes, I've tried it...it works! > ~Paul I stopped using Windows at 3.1 . If I understand correctly you have to have a copy of W$ 9X (or whatever). If this is true then I can't use wine because I don't have a usable copy of W$. Has this changed in the past few years? Thanks JIM PS Been useing SuSE since version 4.4.1 :) -- Jim Hatridge Linux User #88484 -- BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: using php to rotate ad banners
> Why don't you just use phpAdsNew? Because I prefer to write it myself so I can learn more. J. = RisingMusic.com 450,000 registered users. 14,000 registered bands and artists. __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Restate: using php to rotate ad banners
Anyone? Reply? I recently created some scripts to rotate ad banners on my site. One script is called show.php, which serves the banner. The other is called click.php, which redirects the people to the proper site for the banner they clicked on. Some people have noticed that when they click on the banner, they go to another site. Others have noticed that they just get returned back to the page that they just were at. I test it without any problems. I have been doing the redirecting using cookies. The script show.php puts the cookie on their computer. The script click.php gets the cookie and redirects them to the proper place when clicked. Should I be using cookies or sessions to do this? I think the problem is that some people have their browser set to not accept cookies which is why they get directed to other places. __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restating plea for help with sort
To append my own answer. In order to sort the non "n/a" values you're going to have to build a separate array and perhaps this will simplfy the problem. So instead of what I suggested below.. loop the array and start TWO new arrays within the loop. One array for "n/a" values and one for non-"n/a" values. After the values are sorted to their separate arrays do asort($nonnavals); then concatonate the two arrays together using array_merge(), putting the "n/a" array second. - Kevin - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, February 27, 2003 12:04 PM Subject: Re: [PHP] restating plea for help with sort > Hmm well upon first glance looks like all you need to do is loop that array > and start a new array within the loop. An If/Else construct checks If the > value is "n/a" then append to the back of the new array Else prepend to the > front of the new array.You append the values manually or use > array_push() and array_unshift(). Search the manual for more information. > Hope that helps. > - Kevin > > - Original Message - > From: "Jim Long" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, February 27, 2003 11:35 AM > Subject: [PHP] restating plea for help with sort > > > > Hi, > > > > I have an array with an html link as key and different $vars as val: > > > > $list = array ( > > 'http://someplace.com/";>some place' => $vendor1_total, > > 'http://anotherplace.com/";>another place' => $vendor2__total, > > [snip] etc.. > > > > some vals are numeric and some vals are "n/a" > > asort works to sort the array as a string, however, I need to sort the > > numeric vals numeric, then have the n/a's go away or be output at the > > bottom of the sort. > > > > Please be clear and gentle.. I'm not schooled in php, just a tinkerer > > trying to make this mess work. > > > > Thanks In Advance, > > > > Jim Long > > > > -- > > 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] php3 and php4
My friends, why this program no function in php4, just in php3? Pessoal, esse algoritmo é conhecido como Dijkstra, ele calcula o melhor caminho entre pontos( num grafo, por exemplo), mas nao consigo rodar ele no php4, so funciona no 3. Alguem sabe me dizer se há algo errado? 2, d => 3); $neighbors[b] = array(a => 2, c => 1, e => 4); $neighbors[c] = array(b => 1, f => 5); $neighbors[d] = array(a => 3, e => 2); $neighbors[e] = array(d => 2, b => 4, f => 1); $neighbors[f] = array(c => 5, e => 1); function dijkstra($neighbors, $start) { $closest = $start; while (isset($closest)) { $marked[$closest] = 1; reset($neighbors[$closest]); while(list($vertex, $distance) = each($neighbors[$closest])) { if ($marked[$vertex]) continue; $dist = $paths[$closest][0] + $distance; if (!isset($paths[$vertex]) || ($dist < $paths[$vertex][0])) { $paths[$vertex] = $paths[$closest]; $paths[$vertex][] = $closest; $paths[$vertex][0] = $dist; } } unset($closest); reset ($paths); while(list($vertex, $path) = each($paths)) { if ($marked[$vertex]) continue; $distance = $path[0]; if (($distance < $min) || !isset($closest)) { $min = $distance; $closest = $vertex; } } } return $paths; } $paths = dijkstra($neighbors, "$start"); while(list($vertex, $path) = each($paths)) echo "$vertex: ", implode(", ", $path), "\n"; ?>
[PHP] htmlentities()
I seem to be having trouble with htmlentities(). Maybe someone has a clue I can borrow. Here's my function: function FitForHTML($string) { $asciitable = get_html_translation_table(HTML_ENTITIES); $string = htmlentities($string, ENT_COMPAT); $string = str_replace($asciitable[chr(255)], "ÿ", $string); return $string; } When calling this function with the following data: é[a club]+ <> I get: é♣+ & (I didn't send this as Unicode. The ♣ was originally a club character.) Maybe I'm not looking in the correct area, but when I do a search in Google Groups, I get one message (well, two: one in English and one in German or some language that uses a lot of z's and c's), but that doesn't solve the problem.
Re: [PHP] restating plea for help with sort
Hmm well upon first glance looks like all you need to do is loop that array and start a new array within the loop. An If/Else construct checks If the value is "n/a" then append to the back of the new array Else prepend to the front of the new array.You append the values manually or use array_push() and array_unshift(). Search the manual for more information. Hope that helps. - Kevin - Original Message - From: "Jim Long" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 27, 2003 11:35 AM Subject: [PHP] restating plea for help with sort > Hi, > > I have an array with an html link as key and different $vars as val: > > $list = array ( > 'http://someplace.com/";>some place' => $vendor1_total, > 'http://anotherplace.com/";>another place' => $vendor2__total, > [snip] etc.. > > some vals are numeric and some vals are "n/a" > asort works to sort the array as a string, however, I need to sort the > numeric vals numeric, then have the n/a's go away or be output at the > bottom of the sort. > > Please be clear and gentle.. I'm not schooled in php, just a tinkerer > trying to make this mess work. > > Thanks In Advance, > > Jim Long > > -- > 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] PHP graphs
> Secondly, I'd like to trace a basic X/Y graph with data provided from a DB, > any PHP help? JPGraph is good. -- Jordan Elver Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] restating plea for help with sort
Hi, I have an array with an html link as key and different $vars as val: $list = array ( 'http://someplace.com/";>some place' => $vendor1_total, 'http://anotherplace.com/";>another place' => $vendor2__total, [snip] etc.. some vals are numeric and some vals are "n/a" asort works to sort the array as a string, however, I need to sort the numeric vals numeric, then have the n/a's go away or be output at the bottom of the sort. Please be clear and gentle.. I'm not schooled in php, just a tinkerer trying to make this mess work. Thanks In Advance, Jim Long -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP graphs
Hi guys, I would like to read the IP address from a PC that connects to my web site. Any function does that in PHP? Secondly, I'd like to trace a basic X/Y graph with data provided from a DB, any PHP help? Thx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] make error on solaris
Hi all, I'm trying to get a vanila installation of php 4.3.1(only the cli version) on a solaris 8 system. This is my first day on a solaris box so I don't know much about it. I'm running into some errors in the final linking stage. Any one experienced this problem and got any idea to fix it? (error and my configuration follows below). Regards R;twick Here's the errors I'm getting Undefined first referenced symbol in file wtcLerr /opt/oracle/app/oracle/product/8.1.7/lib/libclient8.a(kpucc.o) (symbol belongs to implicit dependency /opt/oracle/app/oracle/product/8.1.7/lib/libwtc8.so) wtcMerr /opt/oracle/app/oracle/product/8.1.7/lib/libclient8.a(kpucc.o) (symbol belongs to implicit dependency /opt/oracle/app/oracle/product/8.1.7/lib/libwtc8.so) wtcsrin /opt/oracle/app/oracle/product/8.1.7/lib/libclient8.a(kpuini.o) (symbol belongs to implicit dependency /opt/oracle/app/oracle/product/8.1.7/lib/libwtc8.so) wtcsrfre /opt/oracle/app/oracle/product/8.1.7/lib/libclient8.a(kpuini.o) (symbol belongs to implicit dependency /opt/oracle/app/oracle/product/8.1.7/lib/libwtc8.so) wtcstu /opt/oracle/app/oracle/product/8.1.7/lib/libclient8.a(kpucc.o) (symbol belongs to implicit dependency /opt/oracle/app/oracle/product/8.1.7/lib/libwtc8.so) wtclkm /opt/oracle/app/oracle/product/8.1.7/lib/libclient8.a(kpucc.o) (symbol belongs to implicit dependency /opt/oracle/app/oracle/product/8.1.7/lib/libwtc8.so) ld: fatal: Symbol referencing errors. No output written to sapi/cli/php collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1 And here is my configure line ./configure --prefix=/export/home/hdradmin/php --disable-cgi --with-pear --e nable-ftp --without-mysql --with-oci8 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preventing the "hijacking" of pictures
Hi Merlin, What you are describing is named Hot Linking. A quick search on Google gave me this: http://www.htmlbasix.com/disablehotlinking.shtml Regards, Daniel Kushner Need PHP Training? http://www.nyphp.org/training.php > -Original Message- > From: merlin [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 27, 2003 10:18 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Preventing the "hijacking" of pictures > > > Hi there, > > I recently discovered the reason why the traffic is rising so high on my > server. Some people are "stealing" bandwidth. They include > the link of an image into a forum posting. Now everytime somebody reads this > threat on the other site this image is > served by my server!! No one cares about one image, but they become > dramaticly a lot! > > Is there a reason how to find out that the image is not include into my html > code, but into the other site code? > > A great idea would be showing a kind of a watermark on this images if they > are included inside other websites. > > $_SERVER[HTTP_REFERRER] does not help. But there might be another method I > do not know of. > > Thank you for any help and hints on this topic! > > Merlin > > > > -- > 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] post xml
you can provide only one variable in the array: http_post( '195.57.250.36', 80, '/barceloDS/interface/xml', array( "xml"=>$xml ) ); On some date, Diana Castillo wrote: >thanks a lot I have a question, how would I specifiy the name of the >variable I am sending if I am sending only one? If I send it like this does >it know that what I am sending as $xml is also named the variable xml ? the >example only has an array. >http_post('195.57.250.36',80,'/barceloDS/interface/xml',$xml); -- Mincu Alexandru intelinet.ro Tel:+4 0745 369719 +4 021 3140021 www.intelinet.ro[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HELP PLEASE ! Need PHP Advice !!!
First of all, are they paying you to automate or to repurpose the content for the web? Taking a page designed for print and then "automating" it into a page for the web is the wrong approach, your problem is not technical it is a design problem. Technically it is easy, I think, does Quark not have XML output? Or I think it is able to save document as HTML for the web too, then if you want to "automate" all u have to do is make a script that includes those pages inside a site shell. I actually wrote something like this that one could save an html file from word and upload it and it would be on the site, but again, I think it's a bad idea. You should NOT try to automate this, you should look into hiring a fulltime repurposing designer, at LEAST you should read "designing Web Usability" by Jacob Nielson, then maybe u get a better idea of what you SHOULD do. - Vic -Original Message- From: justin brenton [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 7:24 AM To: [EMAIL PROTECTED] Subject: [PHP] HELP PLEASE ! Need PHP Advice !!! can anyone give me some good advise on how abouts I should go about maintaining a newspaper website. here is what is currently in place and how i want it to be managed right now the newspapers are published in a quark file from that file pictures have to be placed in photoshop and resized , croped and what not and then inserted into a html page, the content i.e text is in this quark file as well and is copied and pasted into a html file, what i want to do is have the site automated to some extent so i do not have to be doing all this copying and pasteing it's a total waste valueable time. what i would like to have it some way to have a php script to take this info from the quark file and the pictures and have them either transfered to a html page or to a database from there i could call from the php script. ANYONE HAVE ANY IDEAS ON A GOOD WAY TO GO ABOUT THIS ... PLEASE CONTACT ME [EMAIL PROTECTED] remove the NOSPAM from address -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create an empty array
Use $category_list = array() instead. When you do $category_list[] = array(), you are creating an array of arrays. $category_list becomes an array with 1 element and this element is an empty array. So use $category_list = array(); "Michael Zornek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I want to create an empty array so I can add elements to it later > > I'm currently using: > $catergory_list[] =array(); > > But when I try to print this list I discover the element zero has the string > "Array" in it. How can I create a truly empty array? > > ~ Mike > -- > MikeZornek.com > New blog, new Q&A column, new content everywhere! > http://www.mikezornek.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preventing the "hijacking" of pictures
What about using a MySQL database? Insert the picture into a field in a table, then use a php script to call the data. I've been working on something like this. Is it practical, or am I barking up the wrong tree? -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 12:20 PM To: 'merlin'; [EMAIL PROTECTED] Subject: RE: [PHP] Preventing the "hijacking" of pictures > I recently discovered the reason why the traffic is rising so high on my > server. Some people are "stealing" bandwidth. They include > the link of an image into a forum posting. Now everytime somebody reads > this > threat on the other site this image is > served by my server!! No one cares about one image, but they become > dramaticly a lot! > > Is there a reason how to find out that the image is not include into my > html > code, but into the other site code? > > A great idea would be showing a kind of a watermark on this images if they > are included inside other websites. > > $_SERVER[HTTP_REFERRER] does not help. But there might be another method I > do not know of. > > Thank you for any help and hints on this topic! The best way to handle this is probably with your web server. There are some rewrite rules that you can apply to the images/ directory that'll redirect a request for an image to another image if the request doesn't come from your site. We used to do this on a site I helped run. If someone tried to hotlink to one of our images, they got an add for some rather queer looking male swimsuits... :) Or, the other option is to implement this in PHP. Store your images outside of the web root. Serve them all up through a PHP page. foo.php will make sure that the request is valid by possibly checking a session value or HTTP_REFERRER. If the request is valid, send the headers and use readfile() to send the image data. If it's not, send the data for another image or nothing. The downside to this is it's harder to manage and all images requests will be running through PHP pages. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- 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] How do I display the script file name?
By including "\n" the html source looks like this, which is fine. I'll RTFM about $_SERVER and post back if in trouble. Thanks for help. Stephen $_SERVER['PHP_SELF']= $_SERVER['SCRIPT_NAME'] (etc)= __FILE__=/path/sfindex03.php $SCRIPT_FILENAME=/path/sfindex03.php Basename=sfindex03.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Mail (), BBC: recipients not receiving my Newsletter
Hello, On 02/27/2003 02:22 PM, Ricardo Fitzgerald wrote: I've dl your class and read some of your test scripts, but it's not working at all I tested using test_personalized_bulk_mail.php And I got :'Error: it was not possible to send email message' You most likely have a PHP configuration problem. It is hard to tell before you describe your system. Is it Windows or Unix/Linux? What do you have configured in the php.ini file. Anyway, if you are using Windows, which is my guess, you need to send the message via an SMTP server. If you have it configured to send via a working SMTP server, you may be having one of many types problems that can only be cleared with the some information about that error. In that case, try using in the script of that class named test_smtp_message.php changing it to use your SMTP server and set the smtp_debug variable to 1 so you can see the dialog with the SMTP server. That should help figuring what is your problem. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I display the script file name?
The Jason k Larson wrote: > I disagree. While I tend to stay away from short tags in general, the > use of the short echo tag has yet to cause any trouble for me. And it > makes code exceptionally easier to read, which proves to be a > valueable asset. Maybe you could provide and example where a short > tag is causing some trouble. I'd like to see that. That is, unless > it's not a PHP behavior problem, but a scripting or logic issue due to > poor development. > > -- > Jason k Larson > > > Leif K-Brooks wrote: > >> I think you mean worse. Short tags cause nothing but trouble. >> >> Jason k Larson wrote: >> >>> or even better: >>> >>> >> > > > -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I display the script file name?
I disagree. While I tend to stay away from short tags in general, the use of the short echo tag has yet to cause any trouble for me. And it makes code exceptionally easier to read, which proves to be a valueable asset. Maybe you could provide and example where a short tag is causing some trouble. I'd like to see that. That is, unless it's not a PHP behavior problem, but a scripting or logic issue due to poor development. -- Jason k Larson Leif K-Brooks wrote: I think you mean worse. Short tags cause nothing but trouble. Jason k Larson wrote: or even better: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I display the script file name?
I've checked up on strings, and it seems like the quoting is like the Korn shell. You can see below that I found basename() which works fine with __FILE__, but $_SERVER['PHP_SELF'] etc print nothing. Any ideas? Stephen =PHP== $_SERVER[\'PHP_SELF\']= '.$_SERVER['PHP_SELF'].""; echo '$_SERVER[\'SCRIPT_NAME\'] (etc)='.$_SERVER['SCRIPT_NAME'].' '. $_SERVER['SCRIPT_FILENAME'].' '. $_SERVER['PHP_SELF'].""; echo '__FILE__='.__FILE__.""; echo '$SCRIPT_FILENAME='.$SCRIPT_FILENAME.""; echo "Basename=".basename(__FILE__).""; ?> ==IE6 Display= $_SERVER['PHP_SELF']= $_SERVER['SCRIPT_NAME'] (etc)= __FILE__=/path/sfindex03.php $SCRIPT_FILENAME=/path/sfindex03.php Basename=sfindex03.php === -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Counting table fields having specific values
Mike Try ... Rich > -Original Message- > From: rentAweek support [mailto:[EMAIL PROTECTED] > Sent: 27 February 2003 17:32 > To: [EMAIL PROTECTED] > Subject: [PHP] Counting table fields having specific values > > > I have a table where the row named "hide" can have a value 0 or 1. > I want to obtain a count of all the rows where "hide" has value 0. > > The following works on mysqladmin: > > SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, - 1 > > Giving > > SUM( hide = 0 ) > 7 > > The PHP script statements generated are: > > $sql = 'SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, -1'; > $result = mysql_query($sql); > > What assignment statement do I need to write now to obtain the SUM value > as shown by mysqladmin please? > > TIA > > Mike > > > > > > > -- > 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] How do I display the script file name?
Actually, echo can handle multiple arguments, which it thinks those are. echo 'foo', "bar", $foobar; //one example //echo x3 echo 'foo'; echo "bar"; echo $foobar; echo 'foo'."bar".$foobar; //yet another echo example There are even more complex ways too and, of course, the use of ()s ... but I think I've made my point. HTH, Jason k Larson M.A.Bond wrote: With the output you are getting you will not see the output from the .' '. As it inserts a space into the ouputted text. There is an error after the $_SERVER['PHP_SELF'] the , should be a . (is this just a typo in the e-mail?) Thanks Mark -Original Message- From: Stephen Ford [mailto:[EMAIL PROTECTED] Sent: 27 February 2003 16:47 To: [EMAIL PROTECTED] Subject: Re: [PHP] How do I display the script file name? Partial success. The code and output are shown below. There are no errors. What does the ".' '." do pls. Have tried a variety of combinations to see the effect. Nothing to see... :-( ===PHP== Line #1 ".' '.$_SERVER['PHP_SELF'], ""; echo "Line #2"; echo "Line #3"; echo "Line #4 ".' '.$_SERVER['SCRIPT_NAME'].' '. $_SERVER['SCRIPT_FILENAME'].' '. $_SERVER['PHP_SELF'].""; echo "Line #5"; echo "Line #6 ", __FILE__,""; ?> ===IE6 display=== Line #1 Line #2 Line #3 Line #4 Line #5 Line #6 == Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem wit doing ldap_add and modify in same script
--On Wednesday, February 26, 2003 06:05:20 PM -0500 Jim Greene <[EMAIL PROTECTED]> wrote: > So you suggest turning the $info into an array... How would I go > about using the: No, I don't suggest "turning the $info into any array". It already is an array. Quoting from the www.php.net documentation: "An array in PHP is actually an ordered map." So, in PHPese $foo['key'] is an array reference. What I suggest is that you need to initialize it before you reuse the $info name in a different context. Bill > $info["objectClass"][0]="posixAccount"; > $info["objectClass"][1]="top"; > In the array ? Thanks :) > > > On Wed, 2003-02-26 at 17:36, Bill MacAllister wrote: >> Looks to me like a judiciously place $info = array(); would do >> wonders. >> >> Bill >> >> --On Wednesday, February 26, 2003 08:23:39 AM -0500 Jim Greene >> <[EMAIL PROTECTED]> wrote: >> >> > Strange problem: Taking the 2 halfs of the scripts (the section to >> > update uidNumber and the one to add the user) and combining them >> > causes an error: >> > Fatal error: ldap_add() [http://www.php.net/function.ldap-add]: >> > Unknown attribute in the data in /home/jwgreene/ldap-add.php on >> > line 68 >> > >> > Yes doing them as 2 seperate scripts works fine. I did read >> > something about not being able to do a modify, and add in the same >> > statment, so I do a ldap_unbind after the completion of the first. >> > Still does the same thing. Any help would be appreciated.. Thanks >> > >> > >> > > > >> > // LDAP variables >> > $ldaphost = "ldap.server"; // your ldap servers >> > $ldapport = 389; // your ldap server's port number >> > $ldaprdn = "cn=Directory Manager"; // ldap rdn or dn >> > $ldappass = "test123"; // associated password >> > $dn2="uid=default, ou=Users, dc=megalink, dc=net"; >> > >> > // Connecting to LDAP >> > $ldapconn = ldap_connect( $ldaphost, $ldapport ) >> > or die("Could not connect to LDAP server."); >> > >> > // connect to ldap server >> > >> > if ($ldapconn) { >> > >> > // binding to ldap server >> > $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); >> > >> > // verify binding >> > if ($ldapbind) { >> > echo "LDAP bind successful...\n"; >> > $result=ldap_search($ldapconn,"ou=Users,dc=megalink,dc=net >> > ", "u id=default"); >> > $info = ldap_get_entries($ldapconn, $result); >> > $defaultUid = $info[0]["uidnumber"][0]; >> > //print $defaultUid; >> > //print $info[0]["uidnumber"][0]; >> > $newUid=$defaultUid+1; >> > print "$newUid\n"; >> > $newinfo["uidNumber"]=$newUid; >> > ldap_modify($ldapconn,$dn2,$newinfo); >> > echo "LDAP Modify successful...\n"; >> > ldap_unbind($ldapconn); >> > >> > } else { >> > echo "LDAP bind failed..."; >> > } >> > >> > } >> > //Second half of script *works by itself* >> > $dn="cn=Directory Manager"; >> > $bindPassword = "test123"; >> > $mySalt = substr( >> > ereg_replace("[^a-zA-Z0-9./]","", >> > crypt(rand(1000,), rand(10,99))), >> > 2, 2); >> > $password = crypt("test123","$mySalt"); >> > >> > $info["loginShell"]="/bin/false"; >> > $info["uidNumber"]="1002"; >> > $info["gidNumber"]="100"; >> > $info["objectClass"][0]="posixAccount"; >> > $info["objectClass"][1]="top"; >> > $info["uid"]="test2"; >> > $info["gecos"]="test"; >> > $info["cn"]="test2"; >> > $info["homeDirectory"]="/home/test1"; >> > $info["userPassword"]="{crypt}test123"; >> > if (($ldap = ldap_connect("ldap.server","389"))) { >> > echo "Bind Good...\n"; >> > } >> > else { >> > echo "Connection Failed...\n"; >> > } >> > if (($res = @ldap_bind($ldap, $dn, $bindPassword))) { >> > ldap_add($ldap, "uid=test2, ou=Users, dc=megalink, dc=net", $info); >> > echo "User Added...\n"; >> > } >> > else { >> > echo "Addition Failed...\n"; >> > } >> > ?> >> > >> > Jim G >> > >> > >> > -- >> > PHP General Mailing List (http://www.php.net/) >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> >> >> >> + >> | Bill MacAllister >> | 14219 Auburn Road >> | Grass Valley, CA 95949 >> | Phone: 530-272-8555 > -- > [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL > PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL > PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@ > Jim Greene > Unix Systems Administrator / Security Engineer > Oxford Networks > www.oxfordnetworks.com > Dial-Up - Colo - Web Hosting - Bandwidth > [EMAIL PROTECTED] > > "Working with UNIX is like wrestling a worthy > opponent. Working with Windows is like attacking > a small whining child who is carrying a .38." > > [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL > PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL > PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@ > > +---
[PHP] how do I strptime?
I currently do this: $raw="Nov 28 18:26:35 2002"; $when=`date -jf '%a %b %e %T %Y' "$raw" '+%s'`; when I'd much rather do this: $raw="Nov 28 18:26:35 2002"; $when=strptime($raw, '%a %b %e %T %Y'); which is of course a non-existent function in PHP. I'd like to stop calling a subshell every time I process a date, but I'd also like to avoid jumping through hoops with mktime. Is there a better way? Tnx. -- Paul Chvostek <[EMAIL PROTECTED]> Operations / Abuse / Whatever it.canada, hosting and development http://www.it.ca/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Counting table fields having specific values
if ($array = mysql_fetcharray($result)) {echo $array["SUM( hide = 0 )"]; } although for readability I'd prefer an " AS sum_hide " in the query and then use $array["sum_hide"] in general for reading from a mysql result ... // for a single return row (or the just the first row) if ($result = mysql_query("...")) {if ($array = mysql_fetch_array($result)) {... } } // for multiple return rows if ($result = mysql_query("...")) {while ($array = mysql_fetch_array($result)) {... } } Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: rentAweek support <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 27, 2003 5:31 PM Subject: [PHP] Counting table fields having specific values > I have a table where the row named "hide" can have a value 0 or 1. > I want to obtain a count of all the rows where "hide" has value 0. > > The following works on mysqladmin: > > SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, - 1 > > Giving > > SUM( hide = 0 ) > 7 > > The PHP script statements generated are: > > $sql = 'SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, -1'; > $result = mysql_query($sql); > > What assignment statement do I need to write now to obtain the SUM value > as shown by mysqladmin please? > > TIA > > Mike > > > > > > > -- > 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] How do I display the script file name?
With the output you are getting you will not see the output from the .' '. As it inserts a space into the ouputted text. There is an error after the $_SERVER['PHP_SELF'] the , should be a . (is this just a typo in the e-mail?) Thanks Mark -Original Message- From: Stephen Ford [mailto:[EMAIL PROTECTED] Sent: 27 February 2003 16:47 To: [EMAIL PROTECTED] Subject: Re: [PHP] How do I display the script file name? Partial success. The code and output are shown below. There are no errors. What does the ".' '." do pls. Have tried a variety of combinations to see the effect. Nothing to see... :-( ===PHP== Line #1 ".' '.$_SERVER['PHP_SELF'], ""; echo "Line #2"; echo "Line #3"; echo "Line #4 ".' '.$_SERVER['SCRIPT_NAME'].' '. $_SERVER['SCRIPT_FILENAME'].' '. $_SERVER['PHP_SELF'].""; echo "Line #5"; echo "Line #6 ", __FILE__,""; ?> ===IE6 display=== Line #1 Line #2 Line #3 Line #4 Line #5 Line #6 == Stephen -- 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] Counting table fields having specific values
I have a table where the row named "hide" can have a value 0 or 1. I want to obtain a count of all the rows where "hide" has value 0. The following works on mysqladmin: SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, - 1 Giving SUM( hide = 0 ) 7 The PHP script statements generated are: $sql = 'SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, -1'; $result = mysql_query($sql); What assignment statement do I need to write now to obtain the SUM value as shown by mysqladmin please? TIA Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Emacs?
I'm fairly certain we decided not to count you anyhow. ;) John > Nope. It's 41 (I don't use Emacs) > > At 15:30 27.02.2003, Larry Brown spoke out and said: > [snip] > >Oops...I stand corrected. > > > >Larry S. Brown > >Dimension Networks, Inc. > >(727) 723-8388 > > > >-Original Message- > >From: Matt Giddings [mailto:[EMAIL PROTECTED] > >Sent: Thursday, February 27, 2003 12:26 AM > >To: 'Larry Brown'; 'PHP List' > >Subject: RE: [PHP] Emacs? > > > >Don't you mean 42? > > > >> -Original Message- > >> From: Larry Brown [mailto:[EMAIL PROTECTED] > >> Sent: Wednesday, February 26, 2003 7:55 PM > >> To: PHP List > >> Subject: RE: [PHP] Emacs? > >> > >> 25 > >> > >> -Original Message- > >> From: Sascha Braun [mailto:[EMAIL PROTECTED] > >> Sent: Tuesday, February 25, 2003 12:00 PM > >> To: PHP General list > >> Subject: [PHP] Emacs? > >> > >> How many Persons in this List are using Emacs as there default Editor? > >> > > > >--- > >Outgoing mail is certified Virus Free. > >Checked by AVG anti-virus system (http://www.grisoft.com). > >Version: 6.0.459 / Virus Database: 258 - Release Date: 2/25/2003 > > > > > > > >-- > >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 > [snip] > > -- >>O Ernest E. Vogelsinger >(\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > > > -- > 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] form with multiple lines to insert
> I'm working on a form that will submit multiple lines of data to a > database. > > The form's style is that of an order form, where there are lines for each > item available, and a single submit button at the foot of the page. > > For example: > > === > Item Quantity > > Apples |__| > Oranges |__| > Bananas |__| > > |SUBMIT| > > === > > I will admit I'm new to php programming, and I'm a bit stumped about how > to > get multiple lines from the form to INSERT into the database. You'll need to do 3 inserts, one after the other. Or, format your insert such as: INSERT INTO table (col) VALUES (val1),(val2),(val3); Which will create 3 rows. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Mail (), BBC: recipients not receiving my Newsletter
Hi Manuel, I've dl your class and read some of your test scripts, but it's not working at all I tested using test_personalized_bulk_mail.php And I got :'Error: it was not possible to send email message' Thank you, Rick Off Price Closeouts 1700 W 8 Ave Miami, FL 33010 (305) 888 2555 FAX (305) 884 1761 -Mensaje original- De: Manuel Lemos [mailto:[EMAIL PROTECTED] Enviado el: Wednesday, February 26, 2003 11:35 PM Para: [EMAIL PROTECTED] Asunto: [PHP] Re: Mail (), BBC: recipients not receiving my Newsletter Hello, On 02/26/2003 07:40 PM, Ricardo Fitzgerald wrote: > I wrote a small form which dumps data to a php script that uses mail () > to send an html newsletter, so far is working except > that it's not sending to BCC: headers, in my form I have a field to > enter a comma delimited email list, after submiting the form this list > is stored under one variable $emaillist, and in my php script I used > $headers .= "Bcc: ".$emaillist."\r\n"; > > then I call > > mail($to, $subject, $message, $headers); > > I don't receive an error message but my email list is not being sent, > what I'm doing wrong ? It sounds like one of those bugs of the mail function but it is hard to tell what can it be with so little information. Anyway, you may want to try this class for composing and sending e-mail messages that comes with workaround for many problems of the mail() function: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- 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] Preventing the "hijacking" of pictures
> I recently discovered the reason why the traffic is rising so high on my > server. Some people are "stealing" bandwidth. They include > the link of an image into a forum posting. Now everytime somebody reads > this > threat on the other site this image is > served by my server!! No one cares about one image, but they become > dramaticly a lot! > > Is there a reason how to find out that the image is not include into my > html > code, but into the other site code? > > A great idea would be showing a kind of a watermark on this images if they > are included inside other websites. > > $_SERVER[HTTP_REFERRER] does not help. But there might be another method I > do not know of. > > Thank you for any help and hints on this topic! The best way to handle this is probably with your web server. There are some rewrite rules that you can apply to the images/ directory that'll redirect a request for an image to another image if the request doesn't come from your site. We used to do this on a site I helped run. If someone tried to hotlink to one of our images, they got an add for some rather queer looking male swimsuits... :) Or, the other option is to implement this in PHP. Store your images outside of the web root. Serve them all up through a PHP page. foo.php will make sure that the request is valid by possibly checking a session value or HTTP_REFERRER. If the request is valid, send the headers and use readfile() to send the image data. If it's not, send the data for another image or nothing. The downside to this is it's harder to manage and all images requests will be running through PHP pages. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to create an empty array
$category_list = array(); On Thu, 2003-02-27 at 12:17, Michael Zornek wrote: I want to create an empty array so I can add elements to it later I'm currently using: $catergory_list[] =array(); But when I try to print this list I discover the element zero has the string "Array" in it. How can I create a truly empty array? ~ Mike -- MikeZornek.com New blog, new Q&A column, new content everywhere! http://www.mikezornek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
[PHP] How to create an empty array
I want to create an empty array so I can add elements to it later I'm currently using: $catergory_list[] =array(); But when I try to print this list I discover the element zero has the string "Array" in it. How can I create a truly empty array? ~ Mike -- MikeZornek.com New blog, new Q&A column, new content everywhere! http://www.mikezornek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] When is garbage collection initiated?
My understanding is: - each time a request causes a *session file to be created or accessed*. -- Jason k Larson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] post xml
> I am sending an xml request as part of the url using urlencode to encode > my > xml. It doesnt work like that so the server that is receiving it doesnt > seem to like the data in the query string. > However, if I send it from a form using the method post then it works > fine. > Is there a way to send it by method post but without having to use a form? > Thank you Make sure you urlencode() the data before you tack it into the URL. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php