[PHP] Re: Checking a date for validity

2005-09-07 Thread JamesBenson

I would use something like:-



$date = '09/09/2005';

list($month, $day, $year) = explode(/, $date);

if(checkdate($month, $day, $year)) {
/* valid date */
} else {
/* invalid date */
}






Todd Cary wrote:
I need to check the input of a user to make sure the date is valid and 
correctly formatted.  Are there any examples available?


Here is one solution I created:

  /* Is date good */
  function is_date_good($date) {
if (strtotime($date) == -1) {
  $retval = 0;
} else {
  if (strpos($date, /)  0) {
$parts = explode(/, $date);
  } elseif (strpos($date, -)  0) {
$parts2 = explode(-, $date);
$parts[0] = $parts2[1];
$parts[1] = $parts2[2];
$parts[2] = $parts2[0];
  } else {
$parts = explode(., $date);
  }
  //print_r($parts);
  if (checkdate($parts[0], $parts[1], $parts[2]) )
return 1;
  else
return 0;
}
return $retval;
  }

Is there a simplier solution?

Many thanks..


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



[PHP] Re: Php and postfix error [EMAIL PROTECTED]: Sender address rejected: Domain not found

2005-09-02 Thread JamesBenson

http://php.net/mail



choksi wrote:

Hi All,
 I have php running over Apache on a debian box. I am tryin to use the php 
mail function. When i run this command from console (php email.php) it will 
run and the mail is delivered as it will get the from username from the 
postfix config file but when i run the command from browser it runs through 
apache it uses the apache user nobody and give me error. 
 Can some help with how can i change the from username.

  Sep 2 12:00:11 localhost postfix/smtp[17821]: 3B83A52CF6: to=
[EMAIL PROTECTED], said: 450 [EMAIL PROTECTED]: Sender 
address rejected: Domain not found (in reply to RCPT TO command))


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



[PHP] Re: array merge problem

2005-09-01 Thread JamesBenson

could this help


 If you want to completely preserve the arrays and just want to append 
them to each other, use the + operator:


?php
$array1 = array();
$array2 = array(1 = data);
$result = $array1 + $array2;
?


http://www.php.net/manual/en/function.array-merge.php




Ahmed Abdel-Aliem wrote:

i have the array with the following structure :

Array
(
[19] = 20.00
[25] = 20.00
[7] = 30.00
[17] = 30.00
)

when i merge a field to it using array_merge
it returns that :

Array
(
[0] = 20.00
[1] = 20.00
[2] = 30.00
[3] = 30.00
[4] = 200.00
)

how can i merge the field without losing the original keys ?
can anyone help me with that plz
thanks in advance



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



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

2005-08-21 Thread JamesBenson
Sounds like you have a duplicate entry in your httpd.conf for the PHP 
module, 100% of the time ive seen that error is the above reason, so I 
suggest checking your LoadModule * sections, depending whether you have 
a shared libphp4.so module or built-in module there should or shouldnt 
be a LoadModule section present.



HTH



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.


I restarted apache using the inetd script as well as mysql using the  
inetd script.
However the problem exists. I can enter mysql through the shell and  
tables seem intact.

I have no relevant errors in my log file.

One thing I noticed was that when I went to restart Apache it said ( 
before restarting):
[Sun Aug 21 10:39:08 2005] [warn] module php4_module is already  loaded, 
skipping


Should I try to be loading that module, somehow?

Any suggestions in how to get PHP working with mysql again would be  
much appreciated as it is a busy sight, so slightly stressed.


Thanks Alex.


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



[PHP] zlib-1.2.3 php-4.4.0

2005-07-23 Thread JamesBenson
compiled without any problems but when i fired up phpinfo(); it said 
linked zlib version 1.2.2, so i tried recompiling php but moved the 
system ones files /usr/lib, /usr/include and placed the old ones in 
their place but still it says linked zlib version is 1.2.2 within a call 
to phpinfo();, i also checked the makefile and that had my correct 
locations for the zlib-1.2.3 version libs. anyone know why?


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



[PHP] db insert question

2005-07-21 Thread JamesBenson
Im using mysql with PHP4, whats the best way to insert as many as 20 
records at one time from a form?


Currently im just assigning each one a variable but that is messy and 
takes ages, is their a way to loop over the array of form data then 
maybe do the same to enter it into a database?



Thanks for any help.

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



Re: [PHP] db insert question

2005-07-21 Thread JamesBenson
Thanks for your reply, your example demonstrates what i was doing but 
does that do a MySQL query for every piece of data?
So 20 form values would be 20 db queries, would that not consume a lot 
of resources?

Is their another way?




Thanks,
James



Jim Moseby wrote:
Im using mysql with PHP4, whats the best way to insert as many as 20 
records at one time from a form?


Currently im just assigning each one a variable but that is messy and 
takes ages, is their a way to loop over the array of form data then 
maybe do the same to enter it into a database?



Thanks for any help.



A generic question begs a generic answer:

foreach($formdata as $thisdata){
  $result=mysql_query(insert into ... values($thisdata) where ...);
}


Hope this helps, but it would be useful to have code examples, etc so that a
more relevant answer could be rendered.

JM
 


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



[PHP] Re: alternative to empty

2005-07-06 Thread JamesBenson

Use the trim function,

http://php.net/manual/en/function.trim.php







Ross wrote:
I have been using empty in forms for some time now. but have just discovered 
that


  PHP 4 As of PHP 4, The string value 0 is considered empty.




Is there an alternative that will just check for empty strings. I suppose I 
could just use eregi and check for numbers but thought there may be a 
function that would work in a similar way.



R. 


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



[PHP] Re: Help recognizing bots?

2005-06-23 Thread JamesBenson

http://www.funender.com/phpBB2/about18577.html








Brian Dunning wrote:

I'm using the following code in an effort to identify bots:

$client = $_SERVER['HTTP_USER_AGENT'];
if(!strpos($client, 'ooglebot')  !strpos($client, 'ahoo')  !strpos 
($client, 'lurp')  !strpos($client, 'msnbot'))

{
(Stuff that I do if it's not a bot)
}

But it doesn't seem to be catching a lot of bot action. Anyone have a  
better list of user agents? (I left off the first letter of some to  
avoid case conflicts.)


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



[PHP] Re: So many returned mail notices!

2005-06-21 Thread JamesBenson

You could unsuscribe, open your news client and enter news.php.net

you can then browse at your own leasure, it does actually say a warning 
msg at the bottom of this page,


http://www.php.net/mailing-lists.php






Chris W. Parker wrote:

Hey,

I know this kind of post can be annoying to some people but I must ask
anyway. Is everyone else getting a bunch of returned mail from
[EMAIL PROTECTED] It looks like it has something to do with
(possibly) an email address that is subscribed through Road Runner?

Anyway this kind of thing always makes me a bit nervous because I start
to think something is wrong with my end.



Chris.


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



Re: [PHP] undefined mysql_connect() ???

2005-06-21 Thread JamesBenson
With the fedora core 3 apache/php RPM packages im sure php is loaded 
statically instead of dynamically, that would be the reason why the 
loadModule directive is not in httpd.conf, in my setup apache was not 
compiled with --enable-so
i tried upgrading the PHP version but found having to recompile, my 
experience with fedora is most modules come enabled by default with 
apache, however im sure i had to install php-mysql module



Could try - yum install php-mysql

If its not already







Frank Whitsell wrote:


Sheesh, the electric power has just been off for almost an hour!

Here's the result of running rpm -qa | grep -i php:

 php-4.3.9-3
 php-ldap-4.3.9-3
 php-pear-4.3.9-3

The o/s is Fedora Core 3, and I selected the Server installation, which 
also

automatically installed apache 2.0.52, php 4.3.9, and mysql 3.23.58, as I
wanted.  And those are all rpm's.

I've installed a number of redhat's, suse's, debian, etc, and never had 
this

problem...but I have never used (or installed) apache2 before.

The .php files execute fine.  That is, until I try to call the 
mysql_connect()

function.  Then I get the undefined-function error.

On apache1.3, the phpinfo() function shows the apache modules loaded, 
and that
shows that mod_php4 is loaded.  But on apache2, nothing is mentioned 
about php

in the list of loaded modules.

Nevertheless, if I add the LoadModule directive for php4 and restart 
apache2,
apache2 complains that the module is already loaded.  And it must be, 
because

otherwise, the .php files wouldn't execute.

It's almost as if apache2 is loading it's php module from some other source
that doesn't contain the mysql functions.  By from some other source, 
I mean

that maybe it's not loading the libphp4.so that's in the apache2 modules
directory.

The httpd.conf file has the directive ServerRoot set to /etc/httpd, and the
modules all use the pathname modules/mod_name.  Thus,
/etc/httpd/modules/mod_name should load the correct module.  But 
there is no
mention at all of libphp4.so in the httpd.conf file, or anywhere else 
I can
find.  In fact, a search for php in the httpd.conf file finds 
nothing.  I'm

really stumped.

 --frank--


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



Re: [PHP] comparing two texts

2005-06-20 Thread JamesBenson
I saw a function in the php manual the other day which displays the 
difference as a percentage, for instance two strings,


foo
foos

would be maybe 90% match, not sure thats what you mean though, you can 
always do a str_replace like so,



$string1 = 'foo';
$string2 = 'foos';


$string = (str_replace($string1, , $string2));

echo $string;


The difference being one letter in this case, the letter 's', whether 
that would work for what your after im not sure because it would depend 
on string1 containg string in the same order but not work for random 
characters.





jenny mathew wrote:
so,what what should i conclude .it is not possible to compare two texts and 
hight the difference at this moment.

thanks.
Yours ,
Jenny

 On 6/19/05, Robert Cummings [EMAIL PROTECTED] wrote: 


On Sun, 2005-06-19 at 12:33, M. Sokolewicz wrote:


Robert Cummings wrote:


On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote:



jenny mathew wrote:



Untested, very crude:

?php
$maxlen = max(strlen($text1), strlen($text2));
for ($i = 0; $i  $maxlen; $i++){
if (@$text1[$i] == @$text2[$i]) echo @$text1[$i];
else @echo font color=red$text1[$i]|$text2[$i]/font;
}
?


donot you think you program will just bring the server to its foot 


,if the


text message encountered is very large of order of 40 KB or
larger.is http://larger.ishttp://larger.isthere any other 


efficient method.


40KB isn't large... now, when you're talking about hundreds of MBs of
text, then it gets large :) 40KB, with that method, is nothing...



It's a bit of a dirty hack though. If I compare a 2 character text
against a 40k text, the error handler will be invoked (39998 * 3) 


times


if $text1 is the 2 byte string. That's extremely inefficient. I don't
think I've ever seen error suppression abused so badly to prevent
writing an extra line or 2 using isset().

Cheers,
Rob.


I agree with what you said fully; however, even though that's the case,
and it indeed could be written a lot faster and cleaner, it would not
pose a problem on most systems. That was the point I tried to make ;)


Oh absolutely, 40k is tiny :) Just never seen error suppression used for
such mundane processing. Now if we up it to 2 chars and 5 megs :) With a
custom user space error handler in the background... ugh.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`'

--
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: rename

2005-06-20 Thread JamesBenson
Well, why not first check for existance of the file then check if its 
able to write to the new location, do something like,


if(!file_exists('/my/file/name')) {
echo 'File does not exist';
}
if(!is_writable('/my/new/file/name')) {
echo 'Destination dir is not writable';
}


then finally check if the actual file was renamed or not,

what else would you need to check for?






Mister Jack wrote:

Hi,

I would like to know precisely what rename do in case of error. any
link for that ?
I do a : @rename($old, $new), what happens if I run out of space ? is
the rename just an alias for C function library ?
thanks


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



[PHP] Re: possible jscript/php/frames question!!

2005-06-20 Thread JamesBenson

Ive never seen this happen with an image map.



Dont this work?





MAP Name=mymap
AREA Shape=rect Coords=25,180,125,280
 Href=http://www.example.com;
/MAP

IMG Src=/images/imagemap.gif Width=500 Height=300
Alt=Image Map Usemap=#mymap








bruce wrote:

hi...

i've got a problem where i'm trying to play with imagemaps. i created a test
image map, but when i select inside the image map, i 'see' the ?x,y from
the imagemap, appended to the url in the browser address bar... i get
http://foo.com?3,5 etc...

is there a way to prevent this from occuring??

i'd like to be able to select the imagemap, get the coordinate, and not have
the x,y mouse coordinate show up in the address bar...

i thought i could use an onClick, and go to a javascript function, but i
couldn't figure out how to get the mouse coordinates within the jscript
function.

if i slammed all this inside a frame, would that prevent the url-x,y
information from being displayed??

my sample code is below...

thanks

-bruce
[EMAIL PROTECTED]



---
[EMAIL PROTECTED] site]# cat map.php
?
  /*
 test for image maps...
  */
?
?
 $_self = $_SERVER['PHP_SELF'];
?

html
body
script language=javascript type=text/javascript
!--

function foo1(q)
{
//   str = window.location.search
//   document.write(fff +q+br);
// location.href=map.php;
// return true;
}
function foo(e)
{
//q = q+1;
 mX = event.clientX;
 mY = event.clientY;
//   str = window.location.search
   document.write(fff +mX+ y= +mY+br);
 location.href=map.php;
 return true;
}
// --
/script

!--
centera href=?=$_self;?img
--

center
!--
a href=?=$_self;? onclick =alert(self.location.search); return false
--
a href=ff.php onclick=
img src=imagemap.gif ISMAP/a/center
p
script language=javascript type=text/javascript
!--

str = location.search
 if(str)
 {
   document.write(fff +str+br);
   //location.href=map.php;
 }

// --
/script


/body
/html


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



[PHP] Re: So many returned mail notices!

2005-06-20 Thread JamesBenson
Im suscribed to the newsgroup and dont receive emails, I simply browse 
the threads in Thunderbird, you must of signed up for daily digests.







Chris W. Parker wrote:

Hey,

I know this kind of post can be annoying to some people but I must ask
anyway. Is everyone else getting a bunch of returned mail from
[EMAIL PROTECTED] It looks like it has something to do with
(possibly) an email address that is subscribed through Road Runner?

Anyway this kind of thing always makes me a bit nervous because I start
to think something is wrong with my end.



Chris.


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



[PHP] Re: Fshockopen error while opening a https stream urgent help needed

2005-06-17 Thread JamesBenson
You pointed the configure line to the source files and not the installed 
version of openssl, you should compile and install openssl first, change...


--with-openssl-dir=/usr/local/src/webserver/openssl-0.9.7d


to...

--with-openssl-dir=/usr/local

Or wherever you installed openssl, /usr/local is default, it will then 
find all openssl files in /usr/local/lib and wherever else it needs but 
openssl needs to be compiled installed then linked by PHP from an 
installed version and NOT the origanal source files.




James




choksi wrote:
Hello All 
 I am running PHP5.0.2 over apache 1.3.29 and openssl-0.9.7d on a Debian 
 Php Configure command './configure' '--with-apxs=/www/bin/apxs' 
'--with-openssl-dir=/usr/local/src/webserver/openssl-0.9.7d/' 
'--enable-trans-sid' '--disable-libxml' 
 
Registered PHP Streams : php, file, http, ftp 
Registered Stream Socket Transports : tcp, udp, unix, udg 
allow_url_fopen : On On 

Now when i try to open a https url via it gives me this error 

[Wed Jun 15 19:03:36 2005] [error] PHP Warning: fsockopen() [a 
href='function.fsockopen'function.fsockopen/a]: unable to connect to 
ssl:// 192.168.0.10:443http://www.google.com/url?sa=Dq=http://www.testcall.com:443(Unable

to find the socket transport
quot;sslquot; - did you forget to enable it when you configured PHP?) 
in /www/htdocs/testcon.php on line 2 

I am trying to fix this from last few days but not successful can some 
please help me its very urgent. 
Do I need to register ssl and https as registered php streams? and if 
so how do i register them. 

Thankyou 
Regards 
Dhaval Choksi




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



Re: [PHP] Reading binary file data into variable

2005-06-17 Thread JamesBenson
I have one for windows, think it works with PHP4 aswell, not sure where 
i put it so let me know if you require it and Ill dig it up?


problem is it wont work on Linux.





Jay Blanchard wrote:

[snip]
Did you try using fopen's binary safe read?  Something like :
[/snip]


Shy of being able to do this in the way that I imagined, does anyone
know of a class (not requiring PHP 5, as one does on phpclasses.org)
that will allow me to specify several PDF and/or other files in a
directory to be zipped up so that the archive can be unzipped by the
great unwashed at some point? TVMIA


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



[PHP] PHP module permissions

2005-06-15 Thread JamesBenson
After upgrading my fedora core 3 box with the latest selinux update i 
get the following error when trying to start apache (2.0.54-prefork)




Cannot load /usr/local/apache2/modules/libphp4.so into server: 
/usr/local/apache2/modules/libphp4.so: cannot restore segment prot after 
reloc: Permission denied



Im using PHP-4.3.11, when I turn off selinux it works, nobody has any 
suggestion over at fedoraforum so anyone here got any ideas what to 
change or a quick fix ?



TIA

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



[PHP] Re: news php 5.0.5/5.1

2005-06-12 Thread JamesBenson

5.1.0 BETA, http://www.php.net/downloads.php






mbneto wrote:

Hi,

I've looked at php.net but could not find info regarding if/when are
we going to have further 5.0.x versions and what will change in php
5.1.

Any pointers (besides the php-devel) ?


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



[PHP] Re: Getting help on using the PHP lists

2005-06-10 Thread JamesBenson
I thin they must get loads of spam so tighten up security, when I tried 
signing up it never worked for at least two weeks then finally when it 
did I had to wait another few weeks for a reply to my subscription request.







Jim Elliott wrote:

Per the instructions in the subscription reply, I tried the following:

For help and a description of available commands, send a message to:
   [EMAIL PROTECTED]

If you need to get in touch with the human owner of this list,
please send a message to:

[EMAIL PROTECTED]

Neither of these worked. The first got back a reply saying the server 
did not know what I wanted and the second got back a reply saying If 
you are trying to post to one of the PHP mailing lists, the correct

address looks something like [EMAIL PROTECTED].

All I want to do is find out what commands I can use with this list 
processor. Every other list I use supports a HELP query, but this one 
does not appear to.


Jim


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



[PHP] Re: Problems escaping apostrophe, please help

2005-06-10 Thread JamesBenson
Hello, what exactly do you mean when you say break the browser, if its a 
PHP error you get then its something to do with PHP, however, your 
javascript is not correct and produces errors, im not too good at 
javascript but know when I see an error, i could be wrong but dont think 
its possible to have code like your example, I modified it a little to 
get rid of the error:-


a href=# onclick='document.form1.how.value=Pulmonary edema is a
condition in which fluid accumulates in the lungs, usually because the
heart\'s left ventricle does not pump adequately. In cases of severe
pulmonary edema, the symptoms will worsen and include A drop in blood
pressure resulting in a thready pulse.;'




Like I say though unless your error is PHP related then its most likely 
your javascript code but I could be wrong,


Hope that helps.






Leila Lappin wrote:

Hello all,

I hope this hasnt been answered a zillion times already, I've tried
everything I know and nothing has worked. The following is the PHP statement
and the HTML rendering.  The apostrophe is displayed as is and breaks the
browser.  May be I am wrong but I was under the impression that escaping
special characters with one of the these, htmlspecialchars, htmlentities,
and addslashes would replace them with encoded (hex?) value so they wont
break the browser. But it hasnt worked that way.  I am using
charset=iso-8859-1.  This is my PHP:

=== This is the PHP ===
li
a href=#
onclick='document.form1.how.value=?=htmlentities($row['how'])?;
document.form1.factor.value=?=addslashes($row['factor'])?;document.form1
..submit();'?= addslashes($row['factor'])?
  /a
/li

== This is the rendering ===
== (note the heart's apostrophe breaks IE and firefox) ===
li
 a href=# onclick='document.form1.how.value=Pulmonary edema is a
condition in which fluid accumulates in the lungs, usually because the
heart's left ventricle does not pump adequately. In cases of severe
pulmonary edema, the symptoms will worsen and include A drop in blood
pressure resulting in a thready pulse.;
document.form1.factor.value=Pulmonary
edema;document.form1.submit();'Pulmonary edema
/a
/li


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



[PHP] Re: Making a page loop with header('Location: ...

2005-06-10 Thread JamesBenson
It may be better to not execute the script through apache at all, you 
could use PHP's exec(); function and have it run in the background, 
display a count down then refresh say five minutes later to get the result.





Joe Harman wrote:

is it possible to make a page loop with header('Location : page.php')???

I've ran into a little bit of a snag with php execution time... so, i
need to execute the page a few times so that I can split the operation
up into multiple parts... my other option would be to make a
javascript reload




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



[PHP] Re: PHP exec function.

2005-06-10 Thread JamesBenson
I prefer using the backtick operator for the reason that I could never 
get exec(); to work.



http://php.net/manual/en/language.operators.execution.php






Bob Snowdon wrote:
I run Windows XP Home SP2, Apache 1.3.24 and PHP 4.3.1. I have a php script 
which uses the exec function to invoke a win32 application which writes its 
results to a file which is then used in what is returned to the browser by the 
script. It works.


I wanted to install the same script invoking the same win32 application on a 
friends machine which runs Windows XP Pro SP2, Apache 2 and PHP 5.0.4. It 
doesn't work.


Investigation/debugging indicates that the exec call simply doesn't invoke the 
win32 application at all with no error indications from PHP. (echo statements 
either side of the call). I have checked things like the path to the 
application (I can call the application from the run prompt ok) and am now 
completely stumped.


The relevant bit of my php script is:


$execstring=winposd.exe \${physical}-${logical}-${parameter}\;
$output=exec($execstring);


I am sure this is something very simple! But obviously beyond me.

Bob Snowdon


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



[PHP] Re: headers and session (question)

2005-06-06 Thread JamesBenson
I use sessions, I also dont store the users password into the session, 
if you use flat file sessions on a shared server then storing the 
password should be avoided,


What I do is take a username and password, verify their details against 
database, if their details match one in database I simply add their 
username to the session, to check if someone is logged in I just check 
whether their username exists in the session, if it does I deliver my 
protected content but if not I display a login box.








Alessandro Rosa wrote:

Here's below the solution (the encryption will be shortly performed
into login.php).

1 ?php
2 session_start();

3 $_SESSION['session_user'] = $_POST['txtIdUtente'];
4 $_SESSION['session_password'] = $_POST['txtPassword'];

5 $PHPcmd = login.php ;

6 header( Location: .$PHPcmd );
7 ?


But a QUESTION now :

if line 5 is replaced by these two lines, say here 5a and 5b:

5a require_once(config.inc.php);
5b $PHPcmd = $GLOBALS['gestionale_path_name'].phpcode/login/login.php ;

this does not work (meaning user and psw are not passed to login.php);
but again the below code works again:

5a require_once(config.inc.php);
5b $PHPcmd = $gestionale_path_name.phpcode/login/login.php ;


Thanks,

Alessandro
 


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



[PHP] Re: headers and session (question)

2005-06-06 Thread JamesBenson
It wont get passed because your not passing it along to the script in 
anyway, at line 3/4 you set the details into the session, then you 
redirect them to the login page so in your login.php just call the 
session variables which you just stored at line 3/4.



login.php example:

?php
echo $_SESSION['session_user'];
echo $_SESSION['session_password'];
?


Now when you redirect the user it will have these session variables stored.



James



Alessandro Rosa wrote:

Here's below the solution (the encryption will be shortly performed
into login.php).

1 ?php
2 session_start();

3 $_SESSION['session_user'] = $_POST['txtIdUtente'];
4 $_SESSION['session_password'] = $_POST['txtPassword'];

5 $PHPcmd = login.php ;

6 header( Location: .$PHPcmd );
7 ?


But a QUESTION now :

if line 5 is replaced by these two lines, say here 5a and 5b:

5a require_once(config.inc.php);
5b $PHPcmd = $GLOBALS['gestionale_path_name'].phpcode/login/login.php ;

this does not work (meaning user and psw are not passed to login.php);
but again the below code works again:

5a require_once(config.inc.php);
5b $PHPcmd = $gestionale_path_name.phpcode/login/login.php ;


Thanks,

Alessandro
 


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



[PHP] Re: about the absolutely path

2005-06-06 Thread JamesBenson
If you have .htaccess and mod_rewrite with apache server you can use 
something like the following in a .htaccess file.





RewriteEngine on
RewriteBase /


RewriteRule ^(.*)/$ /e/$1






Thats just an example to get you started.

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



[PHP] PHP and Zend

2005-06-05 Thread JamesBenson

PHP 4.3.11 / Apache 2.0.54 / Zend Optimizer 2.5


I have the above on fedora core 3, Ive ran the zend auto setup to 
install but when I open phpinfo.php the version of zend says:-


This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0,



I directed apache to load the php.ini file using the PHPinidir setting 
in httpd.conf then in phpinfo.php it said the following:-


This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend 
Extension Manager v1.0.7, Copyright (c) 2003-2005, by Zend Technologies 
with Zend Optimizer v2.5.10, Copyright (c) 1998-2005, by Zend Technologies




Ive had it installed before on another copy but never seen this before, 
normally has an image plus just one version listed,


Can anyone help?

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



[PHP] Re: missing $_GET

2005-06-04 Thread JamesBenson
Possibly the PHP version your using, try looking at the PHP manual and 
also getting your PHP version by placing ? phpinfo(); ?
into a file and running it in your browser, see this document for other 
methods:-


http://php.net/manual/en/reserved.variables.php#reserved.variables.get





Ric Manalac wrote:

Hello,

I've encountered a weird problem with using $_GET. I've recently moved
to a new hosting company and an old code suddenly stopped working
correctly.

From my index page, I pass a value through the querystring to another
PHP script. The querystring parameter goes like ?catid=500.

In the script that attempts to get the value, I have the following code:

if (isset($_GET[catid]))
{
   $catid = $_GET[catid];
}
else
{
   $catid = 1;
}

What used to happen was $catid is assigned the value of $_GET[catid]
if the catid parameter is passed through the querystring. But what
happens now is $catid is always set to 1 because $_GET[catid] seems
to be always blank now. I've already tried removing the isset()
check and went directly assigning the value as such:

$catid = $_GET[catid];

... but it still returned a blank value. What's happening to my
$_GET values? 


I hope someone can help. Is this something that can be
fixed by changing some configuration on the server? Is there something
that I need to change with my code?

Thanks!

Ric


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



[PHP] Re: mozilla urlencode

2005-06-04 Thread JamesBenson


Your code is wrong, there is nothing wrong with Firefox's support for 
anchor tags (that im aware of) and IE dont do too badly with them 
either. Paste the following into a blank HTML file

Shoule work...does for me, no problem.




htmlheadtitle/title/headbody

a href=#test%20linkclick me/a

br /br /br /br /br /br /br /br /br /br /br /br 
/br /br /br /br /br /br /br /br /br /br /br /br 
/br /br /br /br /br /br /br /br /br /br /br /br 
/br /br /br /br /br /br /


a name=test%20linkHa, you clicked me, should work in Firefox 1.0.4 
(Linux)/a


/body/html








Im sure its just the é
Above works but not with an é (dont have IE) which leads me to think you 
should use the equivalent of the é



HTH
James

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



Re: [PHP] Frames or iframes? (Basically The devil or deap sea or A rock and a hard place etc) - - - - (0T)

2005-06-04 Thread JamesBenson
You could write a script which uses a cookie to remember which users 
have seen the animation or not, I personally wouldnt use frames but 
thats just my opinion.






Ryan A wrote:

On 6/4/2005 5:30:14 PM, Marek Kilimajer ([EMAIL PROTECTED]) wrote:


Ryan A wrote:


I had a real good flash header which she too liked, so I modified the


header


and she really liked it,
problem is, its around 230kb to load, so I thought


I'll put it in a frame


(top frame - header,
bottom frame- content and forum) so the flash part won't


reload on each


page request.


.swf files are not cached by the browsers? Seems they are, so you don't
need to care about frames. Simply output the html needed to load the
flash file each time, the flash will be downloaded only once.



Hey,
Thanks for replying.

Yep, but the animation and the intro music will play each time...which I am
guessing can
be quite irritating.

Cheers,
Ryan




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



[PHP] Help with some OOP

2005-06-03 Thread JamesBenson
Hello all, Ive been working with PHP for my websites for a few months, 
just attempted to build my own class, after reading all this stuff about 
 automated robots and XSS attacks etc decided to step up security a 
bit, my result is an attempt to create a class for using the token 
method within web forms, not even sure whether its the real thing but my 
work is below, some advice on whether its ok or what needs improving 
would be appreciated, thanks.



?php
// PHP 4.3.11


class SecretToken {

var $_returnCode;


function GenerateToken() {
 if(!isset($_SESSION['token'])) {
  session_regenerate_id();
  $new_token = md5(uniqid(rand(), true));
  $_SESSION['token'] = $new_token;
 }
}


function VerifyToken($post) {
 if(isset($_SESSION['token'])) {
  $saved_token = ($_SESSION['token']);
 }
 if($post == $saved_token):
  $this-_returnCode = 1;
  unset($_SESSION['token']);
 else:
  $this-_returnCode = 0;
 endif;
}


function ReturnCode() {
## Result will be 1 for success or 0 for fail
  return $this-_returnCode;
}


// end class definition
}
?


Basically in my web form I call GenerateToken firstly, then when the 
forms been submitted I then call VerifyToken and finally check return 
codes using a switch statement, seems to work,



TIA
James Benson

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