Re: [PHP] incrementing in a for loop

2005-09-13 Thread Burhan Khalid

Peppy wrote:

I've searched online and am unable to find how to increment by more than one in 
a for loop.

for ($i = 1; $i <= 6; $i++) {

Is it possible to increment $i by 5?


Everyone has responded with the correct answer, but you do realize that 
this loop will only run twice? It will print 1, then 6.


If you change it to $i < 6, then it will print 1.

And just because its Tuesday, and if you happen to be using PHP 5.0.0+:

$numbers = range(1,100,5);
foreach($numbers as $number)
{
   echo $number."\n";
}

And now, back to your regularly scheduled programming

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem w/ reading a txt file.

2005-09-13 Thread Burhan Khalid

[EMAIL PROTECTED] wrote:

 Problem w/ reading a txt file.
 
 The error I get is "Warning: opendir(/home/pudlz/public_html ): failed to

 open dir: No such file or directory "
 
 Here's my code::
 
 $main = file('folders.txt');

 $counter = count($main);
 
 for($i=0;$i<$counter;$i++)

 {
  if ($handle = opendir("$main[$i]"))
  {
 $b=0;
   }
 }
 
 
 It's reading and extra space at the end of all my lines. How do I prevent

 that?


$main = file('folders.txt');
foreach($main as $folder)
{
   if ($handle = opendir(trim($folder))
   {
   $b = 0;
   }
}

I really don't see the point in this loop, but maybe you gave a very 
simple example.


Warmly,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] help me to draw a listview in my website

2005-09-12 Thread Burhan Khalid

Nahalingam N. Kanakavel wrote:

hi all,

If any scripts available to draw a list view.
Plz help me, by giving some links or scripts avilable with you.


What is a list view?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Variables not available

2005-09-12 Thread Burhan Khalid

Dotan Cohen wrote:

I am running php 5.0.4 at home on my Fedora Core 4 box. Post and get
variables are not available in my scripts. For instance, in
file.php?foo=bar the variable $foo is empty. Same thing for variables
passed in forms (get or post), which is how I came across this.

What could cause this? How could I repair it? Thanks.


This is not a 'problem'.

See http://www.php.net/manual/en/security.globals.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Stripping control M character (^M)

2005-09-11 Thread Burhan Khalid

Philip Hallstrom wrote:

Hello All,

I'm having some issues with carriage returns. Specifically the control M
character (^M). I have attempted to clean and validate the file I'm
creating. Here's the code.

while ($row = mysql_fetch_array($result)){

   // assign and clean vars
   $artist = trim($row[artist]);
   $tdDate = trim($row[start_date]);
   $venue = trim($row[venue]);
   $city = trim($row[CITY]);
   $state = trim($row[STATE]);
   $country = trim($row[COUNTRY]);
   $tdId = trim($row[td_id]);

   // create string

   $line = "$artist|||$tdDate||$venue|$city|$state|$country|$tdId\n";

   // validate the string

  if(preg_match("/.*.|||.*.||.*.|.*.|.*.|.*.|.*.n\//", $line)){
  // record is correct so write line to file
  fwrite($handle,$line);
  }
}


So ^M slips right by trim and my preg_match line.



Where is the carriage return appearing in your line of output?  Trim 
will remove these, but only at the beginning/end of a string so if 
$artist = "Paul\rNowosielski" that won't get cleaned up...


Maybe run them through ereg_replace() using "[\n\r]" as a pattern?


Or maybe use the m modifier?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date and time conversion

2005-09-11 Thread Burhan Khalid

babu wrote:

Hi,
 
how to convert DD.MM.YYand HH:MM:SS into mysql date( '-MM-DD' ) and time format. I think the time is same as HH:MM:SS.


[EMAIL PROTECTED] ~ $ php -r 'echo 
date("Y-m-d",strtotime(str_replace(".","/","12.12.05")))."\n";'

2005-12-12

Hope that helps :)

See http://php.net/date
http://php.net/strtotime
http://php.net/mktime

For more information

--
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Date/Time Display for recurring monthly event

2005-09-11 Thread Burhan Khalid

[EMAIL PROTECTED] wrote:

Burhan,

	Thank you for replying, it is very much appreciated. 


Perhaps I did not state what I needed as well as I should have. I'm
looking for the code which displays the date of the second Thursday of each
month on a web page. I have to insert this code at 5 different locations on
that webpage for different meetings. The scenario below describes how it
needs to work.

This month for example, September, the second Thursday is September
8, 2005. Up until midnight of September 8th the date on the webpage should
read September 8, 2005. When midnight arrives on September 8th, the date
displayed should change to October 13, 2005. If you can still help me I
would be grateful.


Oh, so you want to display the next available Thursday.

  $current_month_thursday = strtotime("2nd 
Thursday",mktime(0,0,0,date("m")-1,0,2005));

  if (strtotime("now") > $current_month_thursday)
  {
  //First thursday has passed, show the first thursday
  //of the next month

  echo 'Next Meeting Date : ';
  $next_month = mktime(0,0,0,date("m")+1,0,date("Y"));
  echo date("r",strtotime("2nd Thursday",$next_month));
  } else {
 // This month's second thursday hasn't passed yet
 echo date("r",$current_month_thursday);
  }
?>

This prints :

[EMAIL PROTECTED] ~ $ php -q date2.php

Next Meeting Date : Thu, 13 Oct 2005 00:00:00 +0300

Hope this helps, and please, reply to the list and not directly to me so 
others may contribute and learn.


Regards,
Burhan





[EMAIL PROTECTED]

-Original Message-
From: Burhan Khalid [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 11, 2005 6:55 AM

To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Date/Time Display for recurring monthly event

[EMAIL PROTECTED] wrote:


Having a heck of time getting anything to work, can anyone make a


suggestion


to the following.

I need a webpage that displays 5 recurring meeting dates, i.e. the second
Wednesday, Thursday, and Friday of each month in five different locations.



   echo date("r",strtotime("second Wednesday",strtotime("1st 
October")))."\n";
   echo date("r",strtotime("second Thursday",strtotime("1st 
October")))."\n";
   echo date("r",strtotime("second Friday",strtotime("1st 
October")))."\n\n";


   echo "For all months of the year (for loop way) : \n\n";
   for($x = 1; $x <=12; ++$x)
   {
 $current_month = date("F",mktime(0,0,0,$x,1,date("Y")));
 echo 'For the month of '.$current_month.":\n\n";
 echo date("r",strtotime("second Wednesday",strtotime("1st 
".$current_month)))."\n";
 echo date("r",strtotime("second Thursday",strtotime("1st 
".$current_month)))."\n";
 echo date("r",strtotime("second Friday",strtotime("1st 
".$current_month)))."\n\n";

   }

   echo "For all months of the year (array_map way) : \n\n";

   function findDates($month)
   {
 $current_month = date("F",mktime(0,0,0,$month,1,date("Y")));
 $x[] = date("r",strtotime("second Wednesday",strtotime("1st 
".$current_month)));
 $x[] = date("r",strtotime("second Thursday",strtotime("1st 
".$current_month)));
 $x[] = date("r",strtotime("second Friday",strtotime("1st 
".$current_month)));

 return $x;
   }

   $dates = array_map('findDates',range(1,12));
   echo 'For the month of December : '."\n";
   print_r($dates[11]);

?>

Enjoy :)

--
Burhan






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Date/Time Display for recurring monthly event

2005-09-11 Thread Burhan Khalid

[EMAIL PROTECTED] wrote:

Having a heck of time getting anything to work, can anyone make a suggestion
to the following.

I need a webpage that displays 5 recurring meeting dates, i.e. the second
Wednesday, Thursday, and Friday of each month in five different locations.


  echo date("r",strtotime("second Wednesday",strtotime("1st 
October")))."\n";
  echo date("r",strtotime("second Thursday",strtotime("1st 
October")))."\n";
  echo date("r",strtotime("second Friday",strtotime("1st 
October")))."\n\n";


  echo "For all months of the year (for loop way) : \n\n";
  for($x = 1; $x <=12; ++$x)
  {
$current_month = date("F",mktime(0,0,0,$x,1,date("Y")));
echo 'For the month of '.$current_month.":\n\n";
echo date("r",strtotime("second Wednesday",strtotime("1st 
".$current_month)))."\n";
echo date("r",strtotime("second Thursday",strtotime("1st 
".$current_month)))."\n";
echo date("r",strtotime("second Friday",strtotime("1st 
".$current_month)))."\n\n";

  }

  echo "For all months of the year (array_map way) : \n\n";

  function findDates($month)
  {
$current_month = date("F",mktime(0,0,0,$month,1,date("Y")));
$x[] = date("r",strtotime("second Wednesday",strtotime("1st 
".$current_month)));
$x[] = date("r",strtotime("second Thursday",strtotime("1st 
".$current_month)));
$x[] = date("r",strtotime("second Friday",strtotime("1st 
".$current_month)));

return $x;
  }

  $dates = array_map('findDates',range(1,12));
  echo 'For the month of December : '."\n";
  print_r($dates[11]);

?>

Enjoy :)

--
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] time and timestamp

2005-08-30 Thread Burhan Khalid

Jay Blanchard wrote:

[snip]
Now I am not worried about the time but I would like to know how to

(i) sort the returned rows in order (latest first)


add ORDER BY `yourdatefield` DESC to your SQL


(ii) be able to extract the individual parts of the date and display
them in 
UK format


Have no idea what is 'UK format'. But you can use the DATE_FORMAT MySQL 
function to do the same


DATE_FORMAT(`yourdatefield`, '%m.%d.%Y') as `date_formatted` [...]

Also, http://php.net/date

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Socket functions

2005-08-29 Thread Burhan Khalid

Philippe Reynolds wrote:

Greetings,

When I do an ifconfig in unix, I see the the IP address for the my 
ethernet.  It follows something called inet.


Would anyone know who to manipulate the socket functions to be able to 
extract the inet IP address fromt the eth0 section??




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Easier way to clean GET Variables ?

2005-08-25 Thread Burhan Khalid

Jasper Bryant-Greene wrote:

Burhan Khalid wrote:


Jasper Bryant-Greene wrote:


Robert Cummings wrote:


[snip]
Still need to check isset() status unless you've disabled E_NOTICE 
which

I don't advise since it's sloppy ;)





Yeah, I usually would in a real script. Just slipped my mind when 
writing that example.




I would also in a real script, not use $_MyVar.



Would you care to elaborate with some reasons for this? I find it very 
useful as a naming convention for any sort of "external variable" or 
user input, so when reading my code I can immediately tell what came 
from where.


Prepending the variable name with an underscore happens to be what PHP 
does ($_SERVER, $_GET, $_POST, $_COOKIES, so on...) so it is simpler 
just to carry on that convention.


This is exactly the reason why you shouldn't do it. You don't know when 
PHP might come out with a new 'superglobal' that conflicts with your 
$_Myfunc.


In addition, when PHP prepends $_ to a variable name, it means 
something. Specifically, it means that the variable is a 'superglobal'. 
The only exception to this that I know of is $GLOBALS.


For the reasons above, I avoid creating user variables with $_ -- 
although there is no rule regarding variable names (other than the 
syntax rules).


Sometimes, just because you can do something, doesn't mean you should.

Regards,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Easier way to clean GET Variables ?

2005-08-25 Thread Burhan Khalid

Jasper Bryant-Greene wrote:

Robert Cummings wrote:


On Wed, 2005-08-24 at 23:12, Jasper Bryant-Greene wrote:


Graham Anderson wrote:


Is there a way to loop thru all of these GET requests by:
putting the GET variables into an array
processing  the variable strings with trim/striptags/etc in a loop
exploding the variables back out into separate variables



I just do this:

function process_user_input($value) {
return mysql_real_escape_string(strip_tags(trim($value)));
// Or whatever processing you need
}

$_SAFE_GET = array_map('process_user_input', $_GET);
$_SAFE_POST = array_map('process_user_input', $_POST);

That way you never need to take them out of an array in the first 
place. Then you can do things like:


mysql_query("INSERT INTO table (col) VALUES ('{$_SAFE_POST['val']}')");



Still need to check isset() status unless you've disabled E_NOTICE which
I don't advise since it's sloppy ;)



Yeah, I usually would in a real script. Just slipped my mind when 
writing that example.


I would also in a real script, not use $_MyVar.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] explain to what's going with this piece of code.

2005-08-25 Thread Burhan Khalid

wayne wrote:

When I run a script from a package I download, it always
bombs out on this section. I think that its getting
the wrong parameters when it tries to make the Connection.
I use PostgreSQL as my DB.Moodle is the name of the database and
the user is moodleuser. I do not have a password on this DB.


Please ask on a Moodle support list, or on their official site. This is 
not a moodle mailing list, but a list for general php programming issues.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML manipulation using PHP

2005-08-25 Thread Burhan Khalid

Anas Mughal wrote:

Could someone please share with me sample code for:

- Adding an XML node to an existing XML document.


http://www.php.net/manual/en/function.domnode-append-child.php
http://www.php.net/manual/en/function.dom-domnode-appendchild.php


- Modifying the value for a given XML node in an existing XML document.


http://www.php.net/manual/en/function.dom-domcharacterdata-replacedata.php

Please, RTFM

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP GD and Unicode

2005-08-25 Thread Burhan Khalid

Louie Miranda wrote:
But when i try it on a image, that has been created with GD. It does 
nothing.


I just want to confirm, it what im doing with the fonts possible thru 
GD/Jpeg?


Please help, if this aint possible. I think imight purchase the PDFLib 
instead to test the unicode support.


What version of GD are you using?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] imap_open hangs...

2005-08-22 Thread Burhan Khalid

Michael Baas wrote:

Hi,

I have a script which works fine for many users, but for some it doesn't.
I've been able to narrow it down to the imap_open-Command which just hangs
'forever'. I have verified that the imap-extensions are available, but other
than that I have no ideas what's going on there, why it would not respond
and what I could possibly do to avoid such errors. I assume something must
be missing/wrong in the PHP-setup, i.e. I've had other cases where
imap-extensions were included at compile-time, but not loaded due to an
error with the RAND_seed symbol etc. - but in all those cases there was at
least an error-msg telling you something was wrong. But just silently dying
is not a very helpful :(

Any ideas anyone?


Could be a few things, such as:

1. Connection is timing out, and the time limit expired.
2. Firewall is blocking connections

Other connectivity-related issues (assuming imap_* works correctly)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem between php4.4 and mysql

2005-08-21 Thread Burhan Khalid

Alex Scott wrote:

Hi there,

I discovered that our website was not working properly today (To my  
horror).

Hosted on redhat enterprise 4.

I think that there is a problem with php 4.4 talking to Apache mysql 4.1
as the php pages which do not talk to the DB are working but other  php 
pages are working.


This has been asked before, and answered (even by me).

You need http://php.net/mysqli or change your MySQL configuration so 
that it allows 'old style' passwords.


Google for the rest, or STFA :)

Regards,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hardware Detection

2005-08-20 Thread Burhan Khalid

Saenal M wrote:

Hi,

Can we get information about hardware on client's PC. (e.g. hard disk, 
processor, keyboard, etc).? And How?

anyone knows? please reply back.


No, this is not possible with PHP.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upgrading PHP 4.2.3 to PHP 4.3.2

2005-08-16 Thread Burhan Khalid

Tim Burgan wrote:

Can I extend this..

On a live server I have PHP 4.1. If I upgrade to PHP 5, is something 
likely to stop working?


99% yes. Especially if you really mean 4.1.0 -- that's quite old.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP without php.ini

2005-08-13 Thread Burhan Khalid

Bagus Nugroho wrote:

I was uncomment php_mysql.dll and added php_mysqli.dll, put edited php.ini as 
recommended, also added libmysql.dll on c:\winnt\system32. But it still doesn't work, it 
still generate "cannot load mysql extension, ...".

Previously, I was edit system variables(edit Path variable by add 
;c:\php;c:\php\ext and add PHPRC > value c:\php), also edit Registry as the 
following :
[HKLM\SOFTWARE\PHP]
"IniFilePath"="C:\PHP"

PHP installed on C:\PHP
Apache 2.0 on C:\Program Files\Apache Group\ ...
MySQL on C:\Program Files\MySQL

I hope, someone can help me to solve the problem before I'm return back to PHP4.


Did you add the following line to your Apache configuration?

# configure the path to php.ini
PHPIniDir "C:/php"

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Class / app for reading web pages and storing in a mySQL DB

2005-08-09 Thread Burhan Khalid

Alan Milnes wrote:
I'm interested in extracting a series of web pages from a Yahoo forum 
and storing them in a MySQL database so I can generate things like most 
number of posts etc.  I've searched on Google but most of the links seem 
to be for email harversters!


Anyone have any tips for where to look?


Well, you'd need something like cURL, HTTP_Client or Snoopy to get you 
started at fetching files from the web.


Then its a matter of extracting the information (parsing out the tags). 
Snoopy has this function that returns the plain text version of a page, 
or you can use regular expressions or strip_tags.


From here on out, its just normal PHP tasks of connecting to the 
database, running your queries, etc.


Oh, Snoopy is snoopy.sf.net.  HTTP_Client is in PEAR. cURL is at 
php.net/curl


Regards,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] download snippet

2005-08-09 Thread Burhan Khalid

Roger Thomas wrote:

Am looking for code snippet to download file. It should be able to detect 
mime-types. Thanks.


http://www.php.net/manual/en/function.header.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] dynamically selecting a function

2005-08-08 Thread Burhan Khalid

Thomas wrote:

Hi there,

 

How can I do something like this: 

 


[snip - theoretical code] if( isset($step) ) echo step.$step() ) [/snip]

 


$step would be an int (I would check that before) and then I would have all
sorts of functions like step1(), step2() . etc.


Use call_user_func().  Simple example:

function x1() { print 'x1'; }
function x2() { print 'x2'; }

$x = 1;
call_user_func('x'.$x);
$x = 2;
call_user_func('x'.$x);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Setting up a new box from scratch?

2005-08-08 Thread Burhan Khalid

Brian Dunning wrote:

Hey all -

I have an unused Pentium box here, recent, well loaded with RAM and  HD. 
I want to turn it into a LAMP box. Never done that before; is  there a 
preferred one-stop-shop installer CD or anything (easy -  knock on 
wood)? It would be nice to end up with some kind of decent  web GUI for 
admin.


As others have responded, any linux distribution will come with packages 
to install the different components of LAMP.  The 'easy' part depends on 
which distribution you choose, and how it does the install process.


Most people recommend Madrake (now called Mandriva), Fedora (RedHat) or 
SuSE.  Ubuntu is another one I see mentioned quite often.  I would 
recommend you that you give the 'LiveCD' versions of these distributions 
a try before you decide to install one permanently.  I've heard from 
other users that ubuntu's install process is very easy, but of course, YMMV.


Also note that almost all of the distributions I mentioned here are 
designed for desktop use, which means that unless you customize the 
install, you will get a complete desktop system (including X, and one of 
KDE or Gnome).  This is fine if you want to use the PC as a workstation 
from time to time.  However, if you just want it to be a server (ie, no 
monitor, no keyboard, just plug it into the network) then you will have 
to customize the install process to uncheck those items that you will 
not need (like X, for example).


For your other part -- webmin is a great utility for managing servers if 
you are uncomfortable with the shell.  Your distribution will probably 
have a package (or RPM) for it, so just install it as per your 
distribution's install process.


Hope this helps,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shell_exec("zip.. ?

2005-08-08 Thread Burhan Khalid

Sam Smith wrote:

shell_exec("zip -r ddd ddd"); // don't work

safe_mode off, works from command line php. What could it be?


You need to give the full path to zip.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mkdir, Shared Hosting?

2005-08-06 Thread Burhan Khalid

[EMAIL PROTECTED] wrote:
 
In a message dated 8/6/2005 10:59:44 P.M. Central Standard Time,  
[EMAIL PROTECTED] writes:


As far  as I know, it's not a shared hosting issue, but a permission issue.
The  site admin has not given the user under which your php scripts  run
permission to create directories and most likely files and other file  system
operations.  It's a security  issue.

Robbert


 
I see... I guess I could ask to see if I could get permission to do so  then? 
lol never hurts to ask :)


Open up your FTP client and log into your website, then change the 
permissions on your folder so that the apache process has write access 
to it.  Its really hit and miss depending on your setup.


The sure fire way (but highly insecure) way is to change the permissions 
to the directory in question to 777.


A better solution would be 755, but it may not work.

Try it, and see what you get.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Average time spent on a page

2005-08-06 Thread Burhan Khalid

[EMAIL PROTECTED] wrote:

Hi,

How can i found out the average time users spent on a page. Anyone know a 
tutorial?

Thanks in advance for your help !!!


PLEASE ONLY SEND YOUR MESSAGE ONCE!!!

Also, remember that google is your friend.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can I retrieve a stored php session variable from within a javascript function?

2005-08-06 Thread Burhan Khalid

Mauricio Pellegrini wrote:
Hi , 
I wonder if it's possible to retrieve the value from a php session

variable from within a javascript function.

Does anyone have any ideas about this?


No. You cannot retrieve it, restore it, read it, send it, anything else.

You can write it from PHP :

echo 'var sess = 
'.$_SESSION['somevar'].'';


But that's it.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Date confusion



On Jul 28, 2005, at 9:28 AM, Linda H wrote:


Hi,

I must admit I am surprised at the paucity of date and time  
functions in PHP.


I have a date stored in a MySQL database in field of datatype date.  
PHP doesn't seem to have a function I can use to format it for  
print. I tried the following but regardless of the value in the  
date field, it displays as 'Wednesday December 31, 1969'  (I know  
this is the day before the UNIX epoch.).


echo ''.date('l F j, Y',$start_date).'';

I tried casting the field to datetime, but it didn't pass the  
parser. Finally I did the following, which seems to work, but is  
awfully convoluted:


echo 'Date: '.date('l F j, Y',strtotime($start_date).'';

The other thing I'm concerned about is that strtotime takes the  
locale into consideration. I don't want it adjusting the date - I  
just want it printed out.


Is there a better way to do this?


SELECT DATE_FORMAT(myfield, '%W %M %e, %Y') as 'formatted_date'  
FROM 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar program like on php.net



On Aug 1, 2005, at 5:45 AM, Roger Thomas wrote:


Quoting Jim Moseby <[EMAIL PROTECTED]>:


I'd repost the link for you, but I've already deleted it.  Sorry.  
Look back through the archives.


JM




I searched for 'Jim Moseby calendar' in the general and Dev mailing  
list but no go. Anty clue?


"It was a plane hack of mine from a couple of years ago with a couple of
additions since.  You are welcome to grab it from CVS.  See
http://cvs.php.net/phpweb/ and look at cal.php

-Rasmus
"

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] what is this: dirname(__FILE__)?



On Aug 1, 2005, at 3:18 AM, Robert Cummings wrote:


On Sun, 2005-07-31 at 20:04, Sam Smith wrote:

I don't recognize this something(__SOMETHING__) format. I know  
what it's

doing but I don't know how it's doing it.



Constants of the type __SOMETHING__ are historical constants for
retrieving contextual information about the source code in which the
constant is found. For instance __FILE__ indicates the name of the
source file in which the __FILE__ constant is found. This nomenclature
dates back to at least C and is probably kept for historical reasons
since everyone knows C is da bomb!



Not that C is not 'da bomb' or any less hip, but here is the short  
version : http://www.php.net/manual/en/language.constants.predefined.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sessions Issue



On Jul 29, 2005, at 8:07 PM, Tom Ray [Lists] wrote:

We built a box about 7 months or so ago using the SuSE 9.1 cd's,  
straight install from the CDs. While I've read that sessions are  
turned on by default, when we try to call on the sessions functions  
(like with phpOpenChat or start_session()) we get calls to  
undefined function errors. This is leading me to belive that  
sessions are disabled for some reason. I need to enable the  
sessions so I have a few questions


1) Can I do this without recompiling?
2) If I can't, how do I recompile this since I used the SuSE cds?

It's SuSE 9.1 running Php 4.3.4 with APache 2.0.49


I don't *think* there is a separate module/rpm for sessions, so you  
are off to a recompile job.


While you are it, upgrade your PHP to the latest stable version.  
4.3.4 is quite old.  Maybe there is a new package for SuSE that does  
it? (not really familiar with SuSE).


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help needed in changing row color


suma parakala wrote:

Hi
I am retrieving data from postgresql and displaying it in form of table 
in different rows.
my problem is when check box is clicked i need to change the color of 
the row .agai when the check box is unclicked it should hold the old color.

Can any one please help me


This is a javascript question, not a PHP one.  You will need to google 
for a javascript snippet that changes the background of table cells.


Google 'javascript table dom'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Don't ejecute a sentence if a field is empty


Jasper Bryant-Greene wrote:

Jesús Alain Rodríguez Santos wrote:


Hello I'm new:
I need to know how can I stop a php sentence if my db is empty, for 
example

I have writed a php sentence, if every fields from mmy db are full, there
is no problem, but I delete every values from the all fields in my db 
when

I ejecute my script mysql give me an error, Ej:

$fecha = mysql_query("SELECT event_day, event_month, event_year FROM
$db_table WHERE event_title = $dia_maximo");
$fecha_max = mysql_fetch_array($fecha);
$fecha_maxima = $fecha_max['event_day'];
$diames_maximo = $fecha_max['event_month'];

wehen I ejecute the script the error message is it:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in /home/www/cfg/prueba/calendar_este2/index.php on line
277




$fecha = mysql_query("SELECT event_day, event_month, event_year FROM 
$db_table WHERE event_title = $dia_maximo");

if($fecha) {
$fecha_max = mysql_fetch_array($fecha);

$fecha_maxima = $fecha_max['event_day'];
$diames_maximo = $fecha_max['event_month'];
} else {
// No row returned...
}


This is very wrong. If $fecha is false, then it means that the query 
didn't execute properly, not that there were no rows returned.


You should do this instead:

$query  = "SELECT event_day, event_month, event_year FROM $db_table ";
$query .= "WHERE event_title = '".$dia_maximo;

$fecha = mysql_query($query);
if (!is_resource($fecha))
{
   die($query."".mysql_error());
}

// -- continue with the rest

Also, make sure you have a valid connection to the database, 
mysql_error() will help you with sorting out what is the problem.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Is there a way to get a variable name as a string?


Rasmus Lerdorf wrote:

Daevid Vincent wrote:


Is there a way to get the name of a variable as a string? For example...



Nope, not possible.


Well

ob_start();
echo '$var';
$contents = ob_get_contents();
ob_end_clean();

echo 'Variable Name is : '.substr($contents,strpos($contents,'$')+1);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Tracking a mobile phone

Please add OT to the subject if the topic has nothing to do with PHP. OT 
= Off Topic.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP from CLI with SAPI


Fredrik Tolf wrote:

Hi!

I've begun to be more and more displeased with Apache lately, so I've
been thinking of writing my own HTTP server instead. I still want PHP
support, but writing a new SAPI for PHP seems like overkill.


What's so bad about Apache?



Therefore, is it possible to use PHP from the command line, but still
enable some HTTP-server-only stuff, like GET and POST variables,
cookies, session management, file uploads, and so on? I haven't been
able to find any docs on doing that, but I'm thinking that it should be
possible.


No, not really.  $_GET and $_POST are populated by PHP from information 
from the HTTP request (which, obviously, isn't available in CLI mode).


In CLI, there is no concept of cookies, sessions (as there are in web 
world), file uploads, etc.  What you get is what you would recieve with 
any CLI app, command line parameters, and access to the system calls 
that you can execute using exec() and friends.


I'm not really sure why you want to write your own HTTP server, as this 
has been done many times over the years.  What exactly are your issues 
with Apache?



So, can someone either point me to some docs in this, or, lacking such,
give me a short intro to it?


For a decent CLI script, you will need to access the command line 
arguments, for which there is a great PHP class over at PEAR.  There you 
will also find classes for color output on the console and other classes 
that you will find useful.


FWIW,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session has new id on 'some' pages.


Marek Kilimajer wrote:

Andy Pieters wrote:

Ok found the solution, seems like one page is on http://server.org.uk 
and the other on www.server.org.uk even though its the same server it 
generates a different session id!




set the domain of the cookie to 'server.org.uk', it's the fifth 
parameter of setcookie()


Actually, you should set it to '.server.org.uk' which will make the 
cookie valid for all *.server.org.uk hosts.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: re-order a sql result


Mark Rees wrote:

""Ross"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


I have a query

$query = "SELECT * FROM sheet1 WHERE '$filter' LIKE '$search_field%'"




Simply requery the database for each search. For example, this orders the
results by surname from a-z

 $query = "SELECT * FROM sheet1 WHERE '$filter' LIKE '$search_field%'
ORDER BY surname ASC";


If you don't want to re-query the information, some clever table sorting 
javascript-fu is available at http://www.brainjar.com/dhtml/tablesort/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] getimagesize not working on images from MYSQL


timothy johnson wrote:

$id = $_GET['id'];
$query = "SELECT * FROM myPhotos WHERE photoId='$id'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$im = imagecreatefromstring($row[photoData]);

$size = getimagesize($im);

header('Content-Type: image/jpeg');
imagejpeg($im, NULL, 100);

I have this nice little php page to return my images from a database,
and everything runs fine except then I try to  use getimagesize, I
then get..

Warning: getimagesize(Resource id #4): failed to open stream:

do I have to do something else, this function works fine if I am using
it on a fileimage, why not an image from a database???


Because the function expects a filename, not an image.  Read the 
documentation for getimagesize.


Regards,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] not sure why form submission gives me error


Edward Vermillion wrote:

Bruce Gilbert wrote:


Hello,

I have a form on my site
http://www.inspired-evolution.com/Contact.php

produces this error on submission

Parse error: parse error, unexpected T_STRING in
/hsphere/local/home/bruceg/inspired-evolution.com/Thankyou.php on line
35



Well.. it says it's found a string it wasn't expecting on, or around, 
line 35 but I can't find it. Did you cut and past the code here or 
retype it when you posted?


BTW... A nice editor for windows is Crimson Editor, and for the mac 
TextWrangler works pretty good too. Both have built in FTP features that 
are easy to use and some decent syntax highlighting. And both are free. 
If your on *nix then I'm not gonna start that war... :P


A good website to go for that sort of information is php-editors.com

My personal recommendations:

Windows - EditPlus (syntax highlighting, edit-over-ftp, etc.)
- SciTE (syntax highlighting, code-complete (ie, IntelliSense))
- UltraEdit

Linux   - pick your favorite, I prefer vim for console editing
- for X11 editors, Kate, SciTE, etc. all work great

Mac - BBEdit (one of -- if not THE -- best text editor for Mac)
- SubethaEdit (great editor with unique features)

As for your PHP issue, check for im-properly nested " " marks.  Would be 
good if you highlighted what lines 33-37 were.


-- Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] connecting to MySQL from a Mac


Bruce Gilbert wrote:

Hello,

I am trying to add a PHP search to my site and the read me file says to:

2. In the server, create a database in MySQL to hold Sphider data.

a) at command prompt type (to log into MySQL):
mysql -u  -p
Enter your password when prompted.

b) in MySQL, type:
CREATE DATABASE sphider_db;

trouble is I am on a mac, so there is no command prompt. What are mac
users supposed to do???


You can access the command prompt (in OS X, this is called the
'Terminal') via:

Applications -> Utilities -> Terminal

If you are using Tiger, you can use spotlight to quickly jump to
Terminal (apple+spacebar is the hotkey to bring up the spotlight search
box).

Alternately, you can also install any number of MySQL front-ends
available for OS X.

Regards,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two websites need to share part of onedatabase,suggestions please


Chris W. Parker wrote:

Robert Cummings 
on Friday, July 08, 2005 5:25 PM said:




Thus siteMask should have one of the following values:

   (1 << 1) == 2   // only site1 can use the product.
   (1 << 2) == 4   // only site2 can use the product.
   ((1 << 1) | (1 << 2)) == 6  // both sites can use the product.



Thanks for the example.

But I'm still at a loss as to what strategy I should take regarding
tables.

Should I create two databases where one database has the product
information and the other does not? Or should I create one giant
database with duplicate tables? That is, one database with 'customers'
and 'customers_two'?


I think this would be a great candidate for a webservice. You could 
write methods that restrict access to only the particular tables that 
the other site requries, and then track access by logging requests to 
the service.


So all the other site needs to know is getCustomers(), and you can code 
whatever SQL is necessary to fetch the information.


As far as the database structure itself, I think a view (if supported) 
could be used here.


Hope this helps,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] constructors in PHP


Alessandro Rosa wrote:

Thanks to all for clear responses!

So just a question now, why have not multiple constructors been implemented?
Are there some security issues related to them ?


As far as I know, its not a security issue, but a structure/design issue.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Apache 1.3x/PHP 5.0.3 404 error handler & posted data...


Rasmus Lerdorf wrote:
[ snip ]

A better option may be to just use mod_rewrite.  Something along the
lines of:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html$  $1.php [T=application/x-httpd-php,L]

You should verify this with the mod_rewrite docs, but this should only
rewrite a request for whatever.html to whatever.php if whatever.html
doesn't exist.  I suppose you could also add a condition to only do the
rewrite if $1.php exists.


I tried something similar to the above. I had a directory that has 
sample php scripts that I use for explaining a concept.  I was hoping 
that the following mod_rewrite would take all requests for .phps and 
parse them as x-httpd-php-source, but it doesn't work, as phps files are 
parsed as php.


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+\.php)s$ $1 [T=application/x-httpd-php-source,L]

Does anyone know of a way to make this work? Is it even possible?

Rasmus:

  A few months back you posted some Apache settings that allow one to 
run both php5 and php on the same Apache instance using mod_proxy 
(iirc).  Can you please post that again? I can't seem to google for it 
in the archives.


Thanks,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] file function


Joseph Lee wrote:

Hi,

I tried file() in the following lines:



However, it only gave me
authFile = Array

What's wrong with this file function? I tried single
quotes, but got the same answer, too.


Nothing.  You need to read the documentation.  What you probably wanted was:

print "authFile = ".implode("",$authFile);

or file_get_contents().

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help - need to quickly optimize a record count!


Brian Dunning wrote:
I am cross-posting this to the PHP and the MySQL lists because I'm  not 
sure in which technology my solution will lie.


I have a pretty busy PHP/MySQL site that executes the following query  a 
lot:


select count(*) as `count` from terms;

My MySQL account was disabled by my ISP because this query was  causing 
resource issues, so I need to find a different way to know  the record 
count in that table. A few records are added once every 5  minutes by a 
cron job. The record count is constant the rest of the  time. No records 
are ever deleted.


Err, this is bubkis.  We have 5 public servers on which there are 
thousands of sites from our users -- some are even *nuke, written in 
*very bad* PHP code, none of which are optimized.  We never faced this 
issue of having to shut down a user because of a query such as yours.


I'm not a database guru, but if you have an auto-incrementing primary 
key, can't you just do SELECT MAX(key) AS `num_records` FROM `terms`;


Since you mentioned that records are never deleted, this could be a more 
resource-friendly way of doing it.


I did a non-scientific test on one of our database tables that has 
14,248 rows (its also never deleted, only added to).


select count(*) as `count` from `log`;
0.3947s

select max(id) as `count` from `log`;
0.2425s

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] imageconvolution


xfedex wrote:

Hi,

Has anybody use this function?
http://www.php.net/manual/en/function.imageconvolution.php

I dont know what a matrix3x3 array is.


This means three columns and three rows:

x x x
x x x
x x x

^ Like that.

And so, if someone has experience on random image generation, it would be 
greate to read what you got to write.


Are you talking about CAPTCHA images? Or something else?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Templating engines


Robert Cummings wrote:

On Fri, 2005-04-29 at 23:55, Rasmus Lerdorf wrote:


Robert Cummings wrote:


I don't think that templates have a dependency between the number of
pages using the template and an increase in the number of functions. In
fact depending on the template, and the template engine, you can have
500 pages using the template and not a single function call. Including
the elimination of include() and include_once() calls since if the
template engine compiles to PHP it can do the includes at compile time
rather than punting to PHP to do at run-time.


While compiling to PHP is by far superior to the various terrible eval() 
and regex-based templating layers out there, it is still dog-slow 
compared to tight specialized PHP code.  Just instantiating the base 
Smarty class, for example, takes a very long time.  I optimized a Smarty 
site a while back where I got a 50% speedup by migrating the base Smarty 
class to C in an extension.



This isn't a problem for engines that compile to PHP source that has
direct hooks into the necessary data structures that will contain the
data at run time.

Smarty isn't one of them though :)


Hey Robert -- can you give an example of one that does this? I'm just 
curious as I haven't seen many that do this.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Templating engines


Jay Blanchard wrote:

[snip]
and box of bending straws.
[/snip]


Nice.


LMAO -- and now, back to the show.

For those that really were looking for a xml-based templating enging, 
IBM's DW has one that you can download the source to.  Its not PHP, but 
hey, its a start.  Google for 'toot-o-matic'.  Really.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Moving PEAR installation (for self-contained class library)


Andrei Verovski (aka MacGuru) wrote:

Hi,

I have a PEAR-related question. My class library using some PEAR 
packages, and I would like to make it self-contained, i.e. to be able 
to move it to a server (for example MacOS X) which do not have (and 
will not require) installation of any PEAR package(s).


What I would like to do is just to copy whole PEAR directory from 
the /usr/share/php5 in the corresponding subdir of my class library. 
The question is - how to make this work transparently. What global 
php_ini variables need to be changed? Just ¨include_path¨ or anything 
else?


Did you already have a look at 
http://pear.php.net/manual/en/installation.shared.php ?


I think it covers most of your questions.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] getting a filename [with no extension] out of a url


Richard Davey wrote:

Hello Graham,

Friday, July 1, 2005, 12:54:42 AM, you wrote:

GA> if  $_SERVER['SCRIPT_NAME'] give this
GA> /folder/folder/Library/php/filename.php

$_SERVER['SCRIPT_NAME'] won't give you that,
$_SERVER['SCRIPT_FILENAME'] would.

SCRIPT_NAME would just give you /filename.php

And if you need to remove the slash at the start, pick any of the
following: substr, str_replace, preg_replace, strpos, etc.


echo basename($_SERVER['SCRIPT_FILENAME'],'.php')

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dynamic pspell module, and adding new words to the list


Dan Rossi wrote:
Hi there, an internal client of ours requires spell checking in their 
textarea forms on names of people for searching thousands of records 
properly. What it needs to be able to do is add new names to the 
dictionary. The server its on is a few years old, it already has the 
pspell and aspell libraries and command line tools, its running php4.3.0 
urrggh, what i am needing to do is load it as a dynamic module and then 
use an Ajax service to do the spell checking. The spell checker needs to 
be able to add names to the dictionary is any of this possible ?


Did you check http://php.net/pspell ? These functions have been 
available since 4.0.2


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Zeus Technology wins again!


John Nichel wrote:

SPAMMERS lose again!

Off to /dev/null with you and your technology.



We really need moderators on this list :(

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] including the result of one query in another query


Pedro Quaresma de Almeida wrote:

Hi

I have two databases, on for aeromodelistas (aeromodelling) and
another for Códigos Postais (Postal Codes). I whant to do the
following query

SELECT CódigoPostal FROM Aeromodelistas 
WHERE CódigoPostal IN 
  (SELECT distinct(CP4) FROM codigopostal.LOCART,codigopostal.DISTRITO
   WHERE codigopostal.LOCART.DD=codigopostal.DISTRITO.DD 
   AND   codigopostal.DISTRITO.DESIG='Coimbra'); 


This query is not working, and I do not know why. If I try the two
queries individualy they work, togheter they don't!?


Firstly, this is not PHP related.  If you are using MySQL, you should 
know that sub-selects are only supported in versions 4.1 and above.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange is_dir() behavior


Marcos Mendonça wrote:

Hello

I'm using PHP 4.3.9, under Windows XP with Apache.

I have the following directory structure on a given app, i'm working on.

photos/
  > folder1
  > folder2
  > folder3
  > ... and so on

I'm trying the following code to make a list of folder under photos:

  $d = dir('photos/');

while (false !== ($entry = $d->read())) {
if (is_dir($entry) && $entry != '.' && $entry != 
'..')
echo $entry . "";
}

For some strange reason, that echoes nothing. is_dir is returning
false on every folder (dir)
under photos, except for '.' and '..' dirs. Can someone explain this?


iirc, is_dir is relative to the path of the script that is calling it. 
Try giving it the full path of the directory. Might solve your problem.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How do I create an Outlook calendar entry?


Daevid Vincent wrote:
You are on to something. Maybe I did get an email with a confirmation. 
I could swear it was via their website though...


There are some pretty crazy "Thread-Index:" and "UID:" things in there. 
Do I have to generate them somehow?  


Anyways, for those interested, this is what the email looks like:


What they are doing is sending you a vcalendar document in the email. 
You can send similar notifications yourself by reading up on the 
vcalendar specs[1] and sending out the appropriate email.


Cheers,
Burhan

[1] http://www.imc.org/pdi/vcal-10.txt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Correcting contractions


Dotan Cohen wrote:


Ill I knew about, its I didn't. I didn't mean to put ill in there...

Should I enter each contraction twice (for the capitalization), or
should I try to do something smart so that the capitalization will
happen automatically. The 'I' contractions are special, I will deal
with those seperatly.


str_ireplace() is a case-insensitive version of str_replace

For god's sake -- please trim your posts! No need to see the enter 
repetitive array + rob's signature in your reply!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Amy's Site question


Jack Jackson wrote:

Hello,

On a site I'm listing measurements in both inches and cm; in the db 
they're stored as inches. To convert them to cm I'm doing:


 x ($cartoon['art_height'] * 2.54); ?> cm



How can I limit the result of that math to one decimal place, ie, 9.5 
cm, not 9.523 cm?


 x printf('%01.1f',($cartoon['art_height']*2.54)); ?> cm


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to convert documents to PDF using PHP


Bosky, Dave wrote:

I need to find a way to allow users to select multiple files from a list
and generate a single PDF file from them.


http://www.fpdf.org
http://php.net/pdf

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: your script: Telling human and machines apart


Merlin wrote:

Hi Burhan,

you posted a while ago to the php user group:

This is an example of what my script outputs : 
http://meidomus.com/code/captcha/

Source available if you are interested.

I would be interested to try that code and alter it to fit my needs.
Would that be possible?


Merlin :

  Sure.  A lot of people have requested this, so I'm going to post it 
online for all to see.  I think I found this script (or a version of it) 
online somewhere and modified it.  I can't remember where exactly.


  Anyway, I have posted the script's source at 
http://meidomus.com/code/captcha/captcha.phps


  The font used in the script is available at 
http://meidomus.com/code/captcha/bboron.ttf


  You can use any other font, provided you change the $font variable in 
the script.  The script sets a session variable turing_string with the 
text of the image (this is what you compare the user's input with).


  The script is not very complex, and has a few comments.  Let me know 
if you have any other questions.


Warmly,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Retrievable weather service info?


Murray @ PlanetThoughtful wrote:

Hi All,

Just wondering if anyone knows of a free weather service that can be
interrogated by PHP for information such as current temperature for a range
of cities around the world?


iirc, weather.com provides a XML feed of such information. Free signup.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] curl


Jon wrote:

I have not used curl before and it looked interesting from the manual.
So, does anyone have a sample script or a tutorial that covers the logon
procedure.

What I want to do is logon to an asp site and download some files.  Can
someone point me in the right direction?  I have done some searches on
google but I guess that I have not used the correct key words because I have
not found any hints at how to logon to a site with curl.


http://curl.haxx.se/libcurl/php/examples/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Telling users and machines apart


Merlin wrote:

Burhan Khalid wrote:


Merlin wrote:


Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their 
forms and the human has to enter a code visible on the image to 
submit the form.

After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create 
the image and does parts of the handling? That seems like a common 
task to me. Maybe someone else already implemented such thing and can 
recommend.




There is Text_CAPTCHA at PEAR, but I haven't used it myself.  I use my 
own little code snippet.



That sounds intersting. Could you show me an online example of this?


This is an example of what my script outputs : 
http://meidomus.com/code/captcha/ -- refresh to see different results.


Source available if you are interested.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Telling users and machines apart


Merlin wrote:

Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their 
forms and the human has to enter a code visible on the image to submit 
the form.

After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the 
image and does parts of the handling? That seems like a common task to 
me. Maybe someone else already implemented such thing and can recommend.


There is Text_CAPTCHA at PEAR, but I haven't used it myself.  I use my 
own little code snippet.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] about the absolutely path


Jochem Maas wrote:

Richard Lynch wrote:


On Mon, June 6, 2005 1:54 am, yangshiqi said:


I have a php application (let's call it app A) which is developed
separated
in a test domain name, like http://testa.xxx.com 
/.

But now I have to move it to another app (called B) using
http://testb.xxx.com  /, and the app A becomes 
just

a
subsystem of app B.

The access url is changed to http://testb.xxx.com/a/.

Then I meet a problem that the app A 's links, the path and other 
elements

in it are set like '/Main.php', '/art/logo.gif' by an absolutely path.

The app A is very independent and I do not want to disperse it to app B.

So how can I get this effect: when the user input the url, '
http://testb.xxx.com/a/ ', the app A will work fine?

Can I just modify some configuration about yapache to fit this
requirement?





maybe you could use the apache ProxyPass directive?

ProxyPass testb.xxx.com/a/ testa.xxx.com

or something like that. (I'm just half-remembering
a cool post by Rasmus L. so the syntax is probably off)



I've been trying to search for that message for a while.  It talked 
about running php4 and php5 in one Apache instance.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] autocomplete a field


xfedex wrote:

Hi,

Anyone know if theres a way to disable this feature for user using old 
browsers or not suporting JS/XML?


Look up 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php + cvs


Vlad Golodov wrote:

Hi All!

are here any people who have tried to develop php application using CVS?
What programms have you used for it? CVS should be located on the internet.


I have used CVS before (since its available in Zend Studio) and have had 
to do a bit of reconfiguring of Zend (because I refuse to connect using 
pserver, and the CVS-over-SSH instructions at Zend didn't work for me).


You can get other CVS clients installed and use them for 
checkin/checkout and then edit the files in your favorite editor (if it 
is not cvs-enabled).


Some of the good ones are TortoiseCVS and WinCVS.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to convert char into number


Jeremy Reynolds wrote:
What function do I use to convert an ASCII character into it's 
equivalent number?


http://php.net/ord

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Getting parameters from the URL


Richard Davey wrote:

Hello Mário,

Friday, May 20, 2005, 4:48:07 PM, you wrote:

MG> http://www.bar.com/[EMAIL PROTECTED]&code=vu782

MG> for testing, but it does print nothing. So, i'm not getting the
MG> parameters from the URL. I have register_globals=Off in php.ini


Jumping in a bit late here, but avoid passing the email address in the 
confirm key.  Instead -- just pass the key, and then optionally you can 
ask for the email address or display it.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] strtotime('yesterday')


Richard Lynch wrote:

On Tue, May 24, 2005 7:24 am, Rahul S. Johari said:


I¹m trying to delete all files in a folder based on a string match with
the
following code:

Erase Successful!All images up to $date, have been
permanently erased from the Server.";
?>

I need the code to delete all images created till yesterday, and leave
images created today. Somehow strtotime(Œyesterday¹) doesn¹t work.
If I put strtotime(Œ-2 days¹) or strtotime(Œ-7 days¹) or even
strtotime(Œ8:00am¹)... They all work accordingly. How come (Œyesterday¹)
isn¹t working? It doesn¹t delete anything.


[EMAIL PROTECTED] burhan $ php -r "echo date('r',strtotime('-1 day'));"
Tue, 24 May 2005 09:00:35 +0300

[EMAIL PROTECTED] burhan $ date
Wed May 25 09:02:10 AST 2005

:)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql connect problem


Jim & Sara Feldman wrote:

Hi:

I have recently upgraded from a Mac G4 running OS 10.3.9 to a G5 
running OS 10.4. I ported a working PHP app and upgraded from PHP 4.3.4 
to 4.3.10 and MySQL 4.0.17 to 4.1.11. I am having a problem connecting 
to MySQL from PHP.


I can connect to the database using either phpMyADMIN  or directly 
from terminal mode using MySQL commands. However, when I try to enter 
the database from php, using


$result = mysql_pconnect("localhost", "api_user", "97533");

I get $result = FALSE. This command works on the old system as does the 
MySQL command:


Jim :

  The problem here is that with MySQL 4.1.xx -- MySQL changed the way 
that passwords should be connect by clients to the server.  PHP 4.3.10 
is still using the old client libraries of MySQL, which do not 
understand the new password schemes.


  The command line client (mysql) works because its using the new 
libraries that came with MySQL 4.1.11.


  You have two options.  You can either upgrade to PHP5 and use the 
mysqli_* functions -- or you can restart MySQL with the --old-passwords 
switch which will allow it to accept connections from older clients.


  See http://php.net/mysqli and 
http://dev.mysql.com/doc/mysql/en/old-client.html for more information.


Warmly,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] db aware text editor? (slightly OT?)


Richard Lynch wrote:

On Tue, May 24, 2005 2:08 pm, Murray @ PlanetThoughtful said:


I'm wondering if anyone knows of a 'db aware' text editor? By 'db aware',
I
mean one that can pull a recordset back from a local MySQL server and edit
the content of fields much like a standard text editor does with files.


Zend Studio 4+ does this.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Free penetration test


Chris Shiflett wrote:

Andy Pieters wrote:


I am looking at where I can get my system tested for penetration.




[ snip ]
You might want to check out the links Christophe mentioned, as these 
provide free advice, which seems to be more along the lines of what you 
want.


I recently stumbled onto Open Web Application Security Project [ 
www.owasp.org ].  Although not PHP-specific, they have some good stuff 
wrt securing web applications. They also have some php functions for 
sanitizing data, but the real good stuff is in their guides.


Might be worth a click.

Oh and Chris -- I loved your PHP Security writeup that you had posted on 
your website a while back.  Keep up the good work.


Regards,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dwonloading a file

Brian Dunning wrote:
I need to write a cron job that retrieves a zipped XML file via FTP,  
unzips it, and then imports the XML into MySQL. I haven't done any of  
these three specific functions yet. Before I tear my hair out on each  
of these functions, can anyone point me to a simple example of any or  
all three?

Download a file : use the 'wget' program if its available on your 
system. Since you mentioned cron, I assume you are working on linux/unix 
or similar.  If wget is not available, try links/lynx.  If those aren't 
available either, then you can use any of the HTTP classes, such as 
HTTP_Client (from pear) or my favorite snoopy.sf.net.  If your PHP 
install is bundled with curl, you can also use the curl functions 
(http://www.php.net/curl)

Unzip a file : http://www.php.net/manual/en/ref.zip.php (example is 
right there in the manual entry)

XML: If you are on PHP5, then use simplexml, otherwise, use the regular 
xml functions. Plenty of examples and tutorials on the internet.  Google 
is your friend.

Import into MySQL : just use the mysql command line client if its 
available to you. mysql -u username -ppassword databasename < file.sql

If it is not, use the regular mysql functions to submit queries 
(mysql_connect, mysql_select_db, and mysql_query).

Regards,
Burhan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sending a string with $_POST/$_GET

Ross wrote:
I want to write a string to a variable and use $_POST or $_GET to retrieve 
it on another page.

I keep gettting an undefined index errror. Can someone show me how this is 
done?

Do I have to use session_start() ?
This would be ideal.
Have checked the documentation, can't find a really basic example.
Well you didn't post any code, so I can't give you specifics, but a 
crude example is :

Read the string';
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP 5.0 and mysql

Jay Blanchard wrote:
[snip]
This is going to a very naive question, but how do I make mysql work
with
PHP 5? I run PHP on IIS on Windows 2000. Help!
[/snip]
Read the instructions http://us4.php.net/mysql
Also See > http://www.php.net/manual/en/install.windows.extensions.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Syntax Coloring

hima wrote:
Hi all,
I am trying to apply syntax coloring to my source code
as I type it in unix shell. I work on a mac machine. 
How do I achieve this.
In the php.ini file I see these following lines
commented out.

; Colors for Syntax Highlighting mode.  Anything
that's acceptable in
;  would work.
;highlight.string  = #DD
;highlight.comment = #FF9900
;highlight.keyword = #007700
;highlight.bg  = #FF
;highlight.default = #BB
;highlight.html= #00
Should I uncomment  the above lines?
These lines are to set up custom colors for the highlight_* functions 
and for the automatic highlighting of .phps files.

For your console needs, you would need to find an editor that supports 
PHP highlighting.  Almost all unix based editors do.  For example, vim 
does PHP syntax highlighting, as I'm sure Emacs has a mode that does 
this too (I don't use emacs).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] changing php ini location

Richard Lynch wrote:
On Fri, May 13, 2005 12:20 pm, Faith Emre YILMAZ said:
anyone knows how to change php ini location?
I m using php5, apache 1.3 on  windows xp.

Re-compile.
Since that's not practical for most users, you just have to use whatever
phpinfo says is the right directory.
Add :
# configure the path to php.ini
PHPIniDir "C:/php"
Change the above path in your httpd.conf file, save it, then restart Apache.
From : http://www.php.net/manual/en/install.windows.apache2.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] strpos with array?

Merlin wrote:
Burhan Khalid wrote:
Merlin wrote:
Hi there,
I am wondering if there is a function (I could not find) which does 
the same thing like strpos does, but with an array.

For example:
$replace = array("picture", "pics");
$pos = strpos ($term, $replace);
//if ($pos !== false) {

  if (in_array($term,$replace)) {
   $term = str_replace($replace, "", $term);
   echo 'term without the word:'.$term;
}

http://www.php.net/in_array
Actually this did not solve the problem, since this function is 
searching for the exact phrase, but not within a string.

I solved it that way:
// try pictures
$replace = array("pictures", "picture", "bilder", "bild", "pic", 
"pics", "pix");
foreach($replace AS $try){
$pos = strpos ($term, $try);
if ($pos !== false) {
$term = str_replace($try, "", $term);
   #echo 'yes'.$term.$pos; exit;
   HEADER("Location:/index.php?search_for=".$term.""); exit;
1. All functions in PHP are lowercase. Do not UPPERCASE your functions. 
Its Just Not Right.

2. You should always pass a full url (ie, with the scheme and host) to 
the Location header.

3. You need a space after Location:
4. There is no need for ."" at the end of your Location: string.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Exec don't work

Greg Donald wrote:
On 5/10/05, Juan Pablo Herrera <[EMAIL PROTECTED]> wrote:
Hi!
I using php version 4.3.10. I have a script that used the exec
function. Well it script only work from shell, but not work form web
browser.
My php.ini:
safe_mode   Off Off
safe_mode_exec_dir  no valueno value
Have somebody experience in this problem?

Is it possible your mod_php is using a different php.ini than your cli php?
In addition to the thing mentioned above, make sure you check the 
following things :

1. Is mod_security enabled on the server? (check the logs to find this out)
2. Is the command that you want to run in the path of the Apache user? 
If this is not true, then you will need to give a full path to the 
program, not just its executable name.  A good way to test this is to 
run your command line script as Apache.
3. Of course, checking permissions on the program is obvious.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parsing XML with php

Merlin wrote:
Hi there,
I am curious if PHP is now able to pars xml without aditional tools like 
xmlrpc.
If yes which version is required? Is the current php 4.x tree sufficient?
4.x requires the expat parser (so I guess it would require external libs).
5.x has the simplexml extension (which I believe requires no external libs).
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php resultset restart??

[EMAIL PROTECTED] wrote:
Hi all.
i've checked the PHP manual but can't find a function for this, perhaps I'm
missing something.
I get a resultset and loop through it but this is in a loop so it only executes
the first time. is this because the resultset is at the end? is there a way to
tell PHP to start at the beginning of the resultset again for each loop? Or is
it best just to copy the resultset to an array and just loop through the array
multilpe times?
http://www.php.net/manual/en/function.mysql-data-seek.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] strpos with array?

Merlin wrote:
Hi there,
I am wondering if there is a function (I could not find) which does the 
same thing like strpos does, but with an array.

For example:
$replace = array("picture", "pics");
$pos = strpos ($term, $replace);
//if ($pos !== false) {
  if (in_array($term,$replace)) {
   $term = str_replace($replace, "", $term);
   echo 'term without the word:'.$term;
}
http://www.php.net/in_array
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Wash with SOAP

Jay Blanchard wrote:
It has come to a point where a vendor is requiring that we use SOAP to
access a service that they provide, so I need some recommendations...
a. Do I build my own request/receipt functions.
2. Do I use something like nusoap or Pears' SOAP classes?
Would those of you who are experienced with PHP and SOAP give me your
opinions? TVMIA!
PHP5 has excellent SOAP capabilities with the built-in SOAP extention. 
So, if you are using PHP5, you have no worries.  Hop over to 
www.php.net/soap and start browsing the function list.

If you are not using PHP5, then either NuSOAP or the PEAR libs will work.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] While and echoing HTML

Mary-Anne Nayler wrote:
Hi Mark,
As far as I can see the only problem is that you have forgotten to add a 
semicolon after the i++
Mark:
 Since you are not displaying the counter, you really don't need to 
mess with $i.

 You can reduce your code to just :
   
   $db = mysql_connect("localhost", "root", "grunger");
   mysql_select_db("status",$db);
   $result = mysql_query("SELECT ProductTypes.product_type_detail FROM
   ProductTypes",$db);
   ?>
   
   
   Product Type
   
   
   while($myrow = mysql_fetch_assoc($result))
echo "".$row['product_type']."";
   }
   ?>
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Any alternative to POST method FTP uploads from client computer?

Murray @ PlanetThoughtful wrote:
[ snipped ]
when u upload it name it dynamiccaly by appending date and time before
the file name
like this
2005050501010-filename.jpg

Hi, yes, I'm already doing this. Conflict of filename isn't my issue -- it's
whether or not the file should be uploaded at all, in the first place.
The difficulty being that you can't examine the file until *after* it has
been uploaded.
As others have suggested, using an ftp client application is one way to
handle it, however, users being users, the feedback has been "Why do we need
to upload the files via an ftp client, *then* go to the web application and
attach the filename to a job entry? Why can't we do it all at once?"
The answer being, "Well, you can, but I bet you're going to be even more
annoyed when you've uploaded a huge file via the web application using the
POST upload method, only to find that the file is already there. Serves you
right for having too many stakeholders in uploading the files, dunnit?"
Here is one thing you can try.  Create a button that (using javascript) 
passes the name of the file to another script -- which then scans your 
files directory to see if the file exists already. If it does, it 
submits an alert or some other indication.

You will have to standardize on the file time. I would suggest that you 
only use the file's meta-data on the server so that users can check when 
the file was last updated on the server, not on their boxes.  Some other 
information (like last uploaded by) would also be helpful from a user's 
standpoint.

Hope this helps,
Burhan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Between Query (0T)

Ryan A wrote:

Your looking at something like. For ages between 21 and 23
$Upper = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-22));
$Lower = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-23));
$sql = "SELECT field1,field2,field3 FROM `table_name` WHERE `age`
BETWEEN " . $Lower . " AND " . $Upper;
$result = myqsl_query($sql);
etc
Cheers
Richard

Hey Rich,
Thanks! That is EXACTLY what I was looking for and instead I got around 10
people sending me
a link to the mySql manual's BETWEEN syntax :-)
If you are lucky enough to use MySQL 5 *grin* you can simply do :
SELECT field1,field2 FROM `sometable` WHERE 
TIMESTAMPDIFF(YEAR,NOW(),`age`) = 22

to find all 22 year olds.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] delete session cookie?

William Stokes wrote:
Hello,
Is it possible to delete a session cookie from browser? If so how?
http://www.php.net/manual/en/function.session-destroy.php
See the example.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mysql insert problems

Andy Pieters wrote:
Hi
Whilst you are searching the net, you might also want to search for 'sql 
injection'.  This is no joke!

Please use the mysql_escape_string on each variable you get from the user 
side.
Use mysql_real_escape_string() instead.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Determining array type

NSK wrote:
We have two kinds of arrays in PHP:
$array["name"] = "George"
$array[0] = "George"
How can I determine (with a function returning true/false for example) which 
type of array I am working with?
There aren't two "kinds" of arrays, there is only one array type:
"There are no different indexed and associative array types in PHP; 
there is only one array type, which can both contain integer and string 
indices."

[ http://www.php.net/manual/en/language.types.array.php ]
So, you can have an array like this:
$array = array("hello", "name" => "Burhan");
If you just want to know if all keys are numeric, then you just do a 
check on the keys :

$keys = array_keys(array("hello","name" => "Burhan", "goodbye"));
foreach($keys as $key) { /* put your check in here */ }
Make sure you do a type-safe check ( === ) not ( == ) which is not type 
safe.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] snort database not appearing in phpmyadmin

Mark Sargent wrote:
Mark Sargent wrote:
Hi All,
I've installed phpmyadmin and have a snort database in mysql, but, it 
doesn't appear in phpmyadmin. I know it's there, because base is using 
it to display info from snort on the machine. Why wouldn't it appear 
in phpmyadmin. It appears with the same set up on my work test 
machine. What should I look for to fix this..? Cheers.

Mark Sargent.
Mark,
This is not the phpmyadmin help list.  Its is not the snort help list 
either. This list is for PHP (the language) related issues.

Regards,
Burhan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Any experience with multi-language PHP sites?

Richard Davey wrote:
Hi all,
[ snipped ]
   I'm interested in knowing of any problems I should be looking out
   for while designing this - what happens to Japanese characters for
   example when stored in a MySQL text field? Any issues re:
   displaying them again once extracted? Or on validating foreign
   data input on web forms?
We develop a few multi-language websites here, but mostly dealing with 
two languages; our most complex site is in three languages. I can 
provide the following tips:

1. MySQL's default character set is latin1 -- you need to watch out for 
this when storing information because it will get garbled.  Character 
sets and collations vary greatly depending on what version of MySQL you 
are using.  I would suggest going over the character set section in the 
manual [ http://dev.mysql.com/doc/mysql/en/charset-server.html ] if you 
haven't already.  4.1 has most of the features you would need.

2. Text searching can be a bit of a pain.  We were using a system that 
defaults to utf-8; and stored the information in MySQL.  Our users were 
logging in from Windows, and their character set was windows-1256 -- so 
searches were turning up blank, till we converted the system to 
windows-1256. Don't ask me how/why, because I'm really not that good 
with all this character set stuff :) If you figure this out, please let 
me know.  I've found that matching the character set of HTML to what is 
expected from your users is the best compromise when coming to display & 
searching.

3. I'm not sure how you would go and validate foreign data input; as I 
have never had to do such myself (all our input was in English on the 
public side, and on the backend, it was manually verified).  Best of 
luck on this one.

Cheers,
Burhan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] loading data from database

Micha Biegnolé wrote:
Hi, I am a student of multimedia design.
I have two tables in a database with one same column(column:Name).
I ask data from table1 collumn:Name. In table2 I want to use the return of
data from table1 and search table2 collumn:Name for other information. I
tried joined SELECT, but it didn't work with me.
I hope someone understands what I mean, my english is not so great.
select data from table1.
SELECT name FROM table1 WHERE movies='yes'
Then I want to select from table2 using the result of select from table1.
SELECT * WHERE..?
If your MySQL server support sub-selects, then you can simply do :
SELECT * FROM table2 WHERE column IN (SELECT name FROM table1 WHERE 
movies = 'yes')

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Session gets corrupted (or lost)

Marcelo Volmaro wrote:
Hi,
IÂve made a simple site with a loguin, that in my machine works 
perfectly,  but not on the server.
The problem seems to be on the session handling. I donÂt loose the SID,  
but the session gets corrupted.
If I do a print_r($_SESSION), after the loguin i get the correct vars, 
but  after i click on a link, while the session ID is
still the same (i pass it both in the URL and using cookies) the 
print_r  returns something like the following:
__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => user 
[ID]  => 30 [nick] => 
Your class is not in scope on the second page.  For your objects to have 
relevance in the session, make sure the class definition is included in 
each file that references the object in the session.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sessions not being stored : DAY 2

Yuri Huitrón Alvarado wrote:

running whoami in php returns : " root "
Are you saying that you typed 'whoami' from a shell, and it gave you root.
Or are you saying that when you did  you got 'root'. If 
this is the case, then you are running a big security risk if your PHP 
scripts are executing with root permissions.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Anybody getting these also?

Jay Blanchard wrote:
[snip]
I wouldn't lose sleep over it.  I think the people here at work are 
actually making fun of me when they 'changed my title'.  Maybe it's 
because at almost 40, I still collect comic books, and watch Star Trek.
:o
[/snip]

Well, I'm between 45 and 50 and still collect football cards, play disc
golf, and watch sci fi all the time. So 'they' can just sit on it!
Wow you all are some old folk :P
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include with remoted address

[EMAIL PROTECTED] wrote:
A this point to include a file in a my script I must use for each .PHP
file:

There is another way (i think to php.ini) to set default include,
require_once, working area to my 'http://localhost:xxx/' avoid
to manually insert upon code ?
There is the include_dir directive in php.ini, but afaik, it requires a 
file path, not a URL.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Command-line php in debian/woody

Robert S wrote:
I am running a Woody server.  I'd like to run php scripts from the command
line, but I note that the php/php4 executable is not in my PATH.
Should you ask this at a debian list?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Preventing automated account creation

[EMAIL PROTECTED] wrote:
Hi,
I have been investigating ways of preventing automated account
creation on the e-commerce system I am currently working on. Obviously I
have seen the graphical solutions to this problem, a small image containing
several letters and numbers which must be typed in by the user to confirm
account creation. However, this (it seems to me) is a bit overkill for what
is a pretty small client, I'm not entirely sure it's a good use of time to
create this script solely for them, does anyone know of anything
pre-packaged? Furthermore is it really worth doing this, what risks do
automated account creation present to an e-commerce site?
Google CAPTCHA for those verify image scripts.
I hope you are kidding about this "what risks do automated account 
creation present to an e-commerce site".

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   3   4   5   6   >