[PHP] mysql query/$post problem

2006-03-27 Thread Mark
I havnt even tried this query but i know its wrong can anyone help!


***
?php
include(header.php);
include(connect.php);

$comp_id = $_SESSION['comp_id'];
$user_id = $_SESSION['user_id'];

// Grab variables and insert into database

$avname = $_POST['avname'];


$query = INSERT INTO users AVATARS WHERE id =$user_id '','$avname');
mysql_query($query);s

mysql_close();

include(footer.html);
?

**



I am trying to insert the value of $avname into the users table, into the 
avatar field. 

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



Re: [PHP] mysql query/$post problem

2006-03-27 Thread nicolas figaro

Mark a écrit :

I havnt even tried this query but i know its wrong can anyone help!


***
?php
include(header.php);
include(connect.php);

  

don't you need a session_start() somewhere ?
(or it's in the header.php or connect.php perhaps ?)

$comp_id = $_SESSION['comp_id'];
$user_id = $_SESSION['user_id'];

// Grab variables and insert into database

$avname = $_POST['avname'];


$query = INSERT INTO users AVATARS WHERE id =$user_id '','$avname');
mysql_query($query);s

mysql_close();

include(footer.html);
?

**



I am trying to insert the value of $avname into the users table, into the 
avatar field. 

  

could you tell us a bit more about what's in the $avname ?
try an echo $query and run your query with an sql client to check if the 
database accepts your request.


N  F

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



Re: [PHP] mysql query/$post problem

2006-03-27 Thread chris smith
On 3/27/06, Mark [EMAIL PROTECTED] wrote:
 I havnt even tried this query but i know its wrong can anyone help!


 ***
 ?php
 include(header.php);
 include(connect.php);

 $comp_id = $_SESSION['comp_id'];
 $user_id = $_SESSION['user_id'];

 // Grab variables and insert into database

 $avname = $_POST['avname'];


 $query = INSERT INTO users AVATARS WHERE id =$user_id '','$avname');

The format for insert queries is:

insert into table(field1, field2) values ('value1', 'value2') 

or

insert into table set field1=value2, field2=value2 etc.

What exactly is the tablename? Also you don't need the ) on the end:

$query = INSERT INTO tablename SET id =$user_id '','$avname';

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Re: mysql query/$post problem

2006-03-27 Thread Barry

Mark wrote:

I havnt even tried this query but i know its wrong can anyone help!

How do you know it's wrong ? O_o


***
?php
include(header.php);
include(connect.php);

$comp_id = $_SESSION['comp_id'];
$user_id = $_SESSION['user_id'];

// Grab variables and insert into database

$avname = $_POST['avname'];


$query = INSERT INTO users AVATARS WHERE id =$user_id '','$avname');
$query = INSERT INTO users (AVATARS) VALUES ('$avname') WHERE id = 
$user_id;


This works only if the $avname is a STRING!


mysql_query($query);s

--^
This will cause an error.
That's why you should test scripts before you post em ...


mysql_close();

include(footer.html);
?

**



I am trying to insert the value of $avname into the users table, into the 
avatar field. 

Yeah seems, so ;)

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] mysql query/$post problem

2006-03-27 Thread PHP Mailer

Mark skrev:

I havnt even tried this query but i know its wrong can anyone help!


***
?php
include(header.php);
include(connect.php);

$comp_id = $_SESSION['comp_id'];
$user_id = $_SESSION['user_id'];

// Grab variables and insert into database

$avname = $_POST['avname'];


$query = INSERT INTO users AVATARS WHERE id =$user_id '','$avname');
mysql_query($query);s

mysql_close();

include(footer.html);
?

**



I am trying to insert the value of $avname into the users table, into the 
avatar field. 

  

Hello Mark,

I think what you are trying to do is coordinated a bit wrong, perhaps 
http://www.w3schools.com/sql/sql_insert.asp

could be of some help for you to achieve this in the future.

Taking a look at your query, i do see what you are trying to do, but the 
structure is wrong.


$query = INSERT INTO users (avatars) VALUES ('$avname')WHERE id ='$user_id');


As Nicolas said, it is important that you understand your abilities to 
debug these queries by outputting them through simple commands such as 
echo or even the php-mysql function mysql_error(); give these a try


Let us know how it works out!

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



Re: [PHP] array_search function bugged? update

2006-03-27 Thread Robin Vickery
On 27/03/06, je killen [EMAIL PROTECTED] wrote:
 Hi all
 Here is an update on my problem reported with the array_search function.
 to those who directed me to the bug report page, thanks.
 There are a number of reports specific to this function. Maybe event
 someone else has written a fix.
 here is my solution to my problem.

There are no open bug reports for array_search(). Loads of bogus ones though.

array_search() also completely the wrong tool for the job - the code
you posted is much more complicated and slower than it needs to be.

That whole palaver that you go through to produce $reduced could be
replaced with:

   $reduced = array_merge(array(), array_unique($str));

That nested loop you use to produce $final would be rather simpler and
faster if you just flipped $reduced and used a hash lookup.

   $charmap = array_flip($reduced);
   foreach ($str as $char) { $final[] = $charmap[$char]; }

-robin

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



Re: [PHP] mysql query/$post problem

2006-03-27 Thread Jasper Bryant-Greene

PHP Mailer wrote:

Mark skrev:

[snip]

$query = INSERT INTO users AVATARS WHERE id =$user_id '','$avname');
mysql_query($query);s

[snip]
I am trying to insert the value of $avname into the users table, into 
the avatar field.


I think what you are trying to do is coordinated a bit wrong, perhaps 
http://www.w3schools.com/sql/sql_insert.asp

could be of some help for you to achieve this in the future.

Taking a look at your query, i do see what you are trying to do, but the 
structure is wrong.


$query = INSERT INTO users (avatars) VALUES ('$avname')WHERE id 
='$user_id');




Also - it looks like an UPDATE might be more suitable for what you want, 
given that you've got a WHERE clause tacked on the end. Google for a 
good SQL tutorial; the PHP mailing list is not the place to learn SQL :)


Jasper

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



[PHP] Three quickies anyone?

2006-03-27 Thread Ryan A
Hey,
I am new to CLI and using PHP to run shell but need to know it so am getting
my feet wet, hopefully with your help :-)

Now when I said three quickies, I mean three PHP RELATED quickies of
course...if you thought anything otherwise... you have a wicked mind.

Here goes:

1.
I start my CLI scripts with:
#!/usr/local/etc/php

as thats the path on my machine... the problem is some of these scripts will
have to  be installed on clients machines by them... any easy way for them
to find out whats the path PHP is installed on their machine? (this q is
more of a doubt really)

is it the same as $_SERVER[include_path]


2.
This ones more of an Apache question but related to my php script and I
think its safe to assume everyone on this list has worked with Apache and
some have a ing good understanding of the server.

Basically I am trying to pipe some data into my php script by adding this to
my .htaccess file:
CustomLog | /home/petpass/public_html/test/testing.php

but it gives me an error as I try to access the directory where the
.htaccess file is in

it works perfectly fine when/if I add the exact same directive in my
httpd.conf file though so, does the format need to be changed in some
way to add it to my .htaccess file or is it simply not allowed in the
htaccess file?



3.
This should be a rather simple question but I just confused myself after
reading/searching google (i do that to myself sometimes, totally
unintentional really)
Can I run CLI/Shell scripts
eg: scripts that began with the  #!php path
on machines that have PHP loaded as a CGI and as a module or only as a CGI
or only as a module?



And in closing lets see if I can borrow a bit from the multitude of chain
letters that I get:

If you answer all three questions quickly and in detail to the best of your
ability you will get a phone call from your true love in the next 30
minutes, if not you will have bad luck for the next 3 years...


Hehe, jokes aside, if you can shed light to any of the above by writing and
tell me or just replying with a link to where I can read up and dig out
the answer, I would really appreciate it.



Thanks in advance,
Ryan

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



[PHP] Re: protecting passwords when SSL is not available

2006-03-27 Thread Barry

Satyam wrote:

b) concatenate this value with the session_id() or whatever random you 
generated before


And where do you get that information?

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] Three quickies anyone?

2006-03-27 Thread Jay Blanchard
[snip]
1.
I start my CLI scripts with:
#!/usr/local/etc/php

as thats the path on my machine... the problem is some of these scripts
will
have to  be installed on clients machines by them... any easy way for
them
to find out whats the path PHP is installed on their machine? (this q is
more of a doubt really)

is it the same as $_SERVER[include_path]
[/snip]

Have them go to the command line and type 'which php' and  it will
return the path.

[snip]
2.
This ones more of an Apache question but related to my php script and I
think its safe to assume everyone on this list has worked with Apache
and
some have a ing good understanding of the server.

Basically I am trying to pipe some data into my php script by adding
this to
my .htaccess file:
CustomLog | /home/petpass/public_html/test/testing.php

but it gives me an error as I try to access the directory where the
.htaccess file is in

it works perfectly fine when/if I add the exact same directive in my
httpd.conf file though so, does the format need to be changed in
some
way to add it to my .htaccess file or is it simply not allowed in the
htaccess file?
[/snip]

What are the permissions of the directory?

[snip]
3.
This should be a rather simple question but I just confused myself after
reading/searching google (i do that to myself sometimes, totally
unintentional really)
Can I run CLI/Shell scripts
eg: scripts that began with the  #!php path
on machines that have PHP loaded as a CGI and as a module or only as a
CGI
or only as a module?
[/snip]

I have actually used PHP to run scripts from the command line like this
before the CLI version came out. As long as the path is correct you
shouldn't have a problem.

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



RE: [PHP] Three quickies anyone?

2006-03-27 Thread Ryan A
Hey Jay,

 [snip]

 is it the same as $_SERVER[include_path]
 [/snip]

 Have them go to the command line and type 'which php' and  it will
 return the path.

The clients will probably not even understand what command line means, I
was thinking of doing something like this:

ask the client to enter the path to php on his server, if he does not know
the path then to download the script get_php_path.php from my site that
would contain

?php echo The path to php on your server is: .$_SERVER[include_path];
?

then they would then enter that valuebut is
$_SERVER[include_path];
the correct thing to use?


 [/snip]
  so, does the format need to be changed in some
 way to add it to my .htaccess file or is it simply not allowed in the
htaccess file?
 [/snip]

 What are the permissions of the directory?
The permissions are 755...but thanks for the tip, for some reason it didnt
strike me that it might be a permissions issue.., will check other
permissions and get back to  you/the list if it still does not work. The
thing is, its not actually writing anything there...I just want it to call
the php script to process the data there..

 [snip]
 3.
 [/snip]
 I have actually used PHP to run scripts from the command line like this
 before the CLI version came out. As long as the path is correct you
 shouldn't have a problem.

Thats a relief, thanks!


Cheers,
Ryan

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



[PHP] Is there a mysql newsgroup like this php.general ANYONE?

2006-03-27 Thread Anasta
I need help with an insert using joins.

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



[PHP] Re: Is there a mysql newsgroup like this php.general ANYONE?

2006-03-27 Thread Barry

Anasta wrote:

I need help with an insert using joins.

yes there is :)

http://lists.mysql.com/

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Three quickies anyone?

2006-03-27 Thread Kevin Kinsey

Ryan A wrote:


Hey,
I am new to CLI and using PHP to run shell but need to know it so am getting
my feet wet, hopefully with your help :-)

Now when I said three quickies, I mean three PHP RELATED quickies of
course...if you thought anything otherwise... you have a wicked mind.

Here goes:

1.
I start my CLI scripts with:
#!/usr/local/etc/php

as thats the path on my machine... the problem is some of these scripts will
have to  be installed on clients machines by them... any easy way for them
to find out whats the path PHP is installed on their machine? (this q is
more of a doubt really)

is it the same as $_SERVER[include_path]

 



The canonical way:

#!/usr/bin/env php

This will call the first php executable in $PATH, and is generally
used when portability in scripts is desired.


3.
This should be a rather simple question but I just confused myself after
reading/searching google (i do that to myself sometimes, totally
unintentional really)
Can I run CLI/Shell scripts
eg: scripts that began with the  #!php path
on machines that have PHP loaded as a CGI and as a module or only as a CGI
or only as a module?
 



Well, if you use the canonical way I describe above, one problem
I foresee is that the cgi-bin directory is hardly ever in $PATH. . .

HTH,

Kevin Kinsey

--
How many people work here?
Oh, about half.

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



Re: [PHP] Three quickies anyone?

2006-03-27 Thread Barry

Ryan A wrote:

Have them go to the command line and type 'which php' and  it will
return the path.



The clients will probably not even understand what command line means, I
was thinking of doing something like this:

ask the client to enter the path to php on his server, if he does not know
the path then to download the script get_php_path.php from my site that
would contain

?php echo The path to php on your server is: .$_SERVER[include_path];
?

then they would then enter that valuebut is
$_SERVER[include_path];
the correct thing to use?


Why don't you use the inbuild shell function of php to get the info from 
PHP itself?

http://de3.php.net/manual/de/function.escapeshellcmd.php

Since you can echo that also.

I just forgot what command it was but probably it helps you anyways :)

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Is there a mysql newsgroup like this php.general ANYONE?

2006-03-27 Thread Robin Vickery
On 27/03/06, Anasta [EMAIL PROTECTED] wrote:
 I need help with an insert using joins.


Yes, there is. You'll find all the mysql lists/newsgroups here:

  http://lists.mysql.com/

  -robin

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



Re: [PHP] Three quickies anyone?

2006-03-27 Thread Ryan A

 The canonical way:
 
 #!/usr/bin/env php

Thanks Kevin, 

 Well, if you use the canonical way I describe above, one problem
 I foresee is that the cgi-bin directory is hardly ever in $PATH. . .

Will keep that in mind..

Thanks,
Ryan

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



[PHP] Irritating [EMAIL PROTECTED]

2006-03-27 Thread Ryan A
Anybody else getting these annoying auto responses from [EMAIL PROTECTED]
?

If yes, can someone email the list mod to delete his account or something,
or email me back the list mods email and I'll do it myself.

Thanks,
Ryan

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



Re: [PHP] Three quickies anyone?

2006-03-27 Thread David Tulloh
Ryan A wrote:
 ...
 1.
 I start my CLI scripts with:
 #!/usr/local/etc/php
 
 as thats the path on my machine... the problem is some of these scripts will
 have to  be installed on clients machines by them... any easy way for them
 to find out whats the path PHP is installed on their machine? (this q is
 more of a doubt really)
 
 is it the same as $_SERVER[include_path]
 
I don't think I even have a $_SERVER[include_path], I certainly
wouldn't count on it pointing to the php binary.  As another user
pointed out, `which php` is probably the safest way.

If you are concerned about a simple method for clients, a quick bash
script which finds php and adds the appropriate line to the top of the
file would be simple.  Getting them to install a webpage to find out
where the php binary is seems excessive.

 
 2.
 This ones more of an Apache question but related to my php script and I
 think its safe to assume everyone on this list has worked with Apache and
 some have a ing good understanding of the server.
 
 Basically I am trying to pipe some data into my php script by adding this to
 my .htaccess file:
 CustomLog | /home/petpass/public_html/test/testing.php
 
 but it gives me an error as I try to access the directory where the
 .htaccess file is in
 
 it works perfectly fine when/if I add the exact same directive in my
 httpd.conf file though so, does the format need to be changed in some
 way to add it to my .htaccess file or is it simply not allowed in the
 htaccess file?
 
The logging directives including CustomLog can't be set in the .htaccess
file.  You can set it in the server config or in a virtual host config.
 
 
 3.
 This should be a rather simple question but I just confused myself after
 reading/searching google (i do that to myself sometimes, totally
 unintentional really)
 Can I run CLI/Shell scripts
 eg: scripts that began with the  #!php path
 on machines that have PHP loaded as a CGI and as a module or only as a CGI
 or only as a module?
 
You can use the CGI executable to execute shell scripts however you will
get http headers like Content-type: and HTML versions of output from a
few functions such as phpinfo.
You can't execute scripts using the Apache module.


David

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



[PHP] OT? - newbie php/xml/xsl question

2006-03-27 Thread ksmeeks
I know this is off-topic, but I'm hoping someone will share a little
php/xml/xsl knowledge with me.

I'm trying to (via php 5) to do the following:

 - load an xml file
 - load an xsl stylesheet
 - apply the two, and build a page that contains hyperlinks based on the xml

Here's the basics of the xml layout, test.xml 

?xml version=1.0 encoding=iso-8859-1?
dataset
record
menu_nameContent Manager/menu_name
menu_descriptionThis section of your site management system allows 
you add/edit/delete pages in your site, add photos, etc.
/menu_description
url_labelClick here to go to the Content Manager/url_label
menu_urlpages/index.php/menu_url
/record
record
menu_nameSite Configuration/menu_name
menu_descriptionChoose your site template, choose/upload your 
logo, and manage other website related information./menu_description
url_labelClick here to go to Site Configuration./url_label
menu_urlconfig/menu_url
/record
/dataset

I'm trying to output an html table that would have for each row:

tr
td(value of menu_name)/td
td(value of menu_description/td
tda href=(value of menu_url)(value of url_label)/a/td
/tr

I'm getting hung up on the xsl side of things.  How would you create the link
portion via xsl?  My php page that calls all of this looks like:

?
$xml = simplexml_load_file('test.xml');
$xsl = simpleXML_load_file('test.xsl');
$proc = new XsltProcessor();
$proc-importStylesheet($xsl);
$newxml = $proc-transformToDoc($xml);
print $newxml-saveXML();
?

I'd like to get this to work with php putting the pieces together, and have
xsl handle the xml transformation, but can't figure out the xsl necessary to
construct the href.

Anyone know how to do this?

Thanks in advance, and sorry for the off-topic post.

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



Re: [PHP] Re: protecting passwords when SSL is not available

2006-03-27 Thread Satyam

The php server sends it along the form. Which I said so:

PHP will send a random number along with the login form. 

I don't see any problem sending that information to the client clear 
(unencrypted), but that's why I'm asking.


Satyam

- Original Message - 
From: Barry [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Monday, March 27, 2006 3:36 PM
Subject: [PHP] Re: protecting passwords when SSL is not available



Satyam wrote:

b) concatenate this value with the session_id() or whatever random you 
generated before


And where do you get that information?

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
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: Irritating [EMAIL PROTECTED]

2006-03-27 Thread Barry

Ryan A wrote:

Anybody else getting these annoying auto responses from [EMAIL PROTECTED]
?

If yes, can someone email the list mod to delete his account or something,
or email me back the list mods email and I'll do it myself.

Thanks,
Ryan

Yeah, it's annoying _

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] cron via cPanel

2006-03-27 Thread tedd

Hi gang:

In cPanel one can schedule cron jobs.

In the command line box, what command do you enter to run a php script?

Thanks.

tedd
--

http://sperling.com

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



[PHP] Re: cron via cPanel

2006-03-27 Thread Barry

tedd wrote:

Hi gang:

In cPanel one can schedule cron jobs.

In the command line box, what command do you enter to run a php script?

Thanks.

tedd

wget --spider http://www.url.com/blahblah.php

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] protecting passwords when SSL is not available

2006-03-27 Thread Evan Priestley
This is called a nonce[1], and the method you've described will  
give you marginally less awful security than submitting a plaintext  
password or an unadulterated hash of the password, but, obviously, is  
in no way a substitute for real SSL. For instance, if this password  
puts the session in a logged in state, an attacker with the  
capacity to sniff the password can also sniff the logged in session  
ID after authentication. You can potentially bind the login to IP,  
but will prevent users behind rotating proxies from using your  
service and may not protect users behind non-rotating proxies, and  
the source IP for a request can be spoofed. Alternatively, you can  
require the password for any action requiring authorization (and  
never put the user in a logged in state), but this will impose  
substantial constraints on your design. And, of course, an attacker  
can still observe any other data you transmit.


If you implement nonced password transmission, absolutely ensure that  
an attacker can not alter the provided nonce. For instance, if Bob  
sees Alice log in under nonce abc123 (her PHP session ID), what  
happens if Bob later executes a replay attack by mimicking her form  
submission (username: alice, password_hash: def456, session_id:  
abc123)? If he can gain access via replay attack at any time after  
Alice's first login ([a] while her session is valid or [b] after it  
has expired presumably being the critical periods), the system offers  
no security over non-nonced password transmission.


Evan

[1] http://en.wikipedia.org/wiki/Nonce

On Mar 27, 2006, at 8:30 AM, Satyam wrote:

I know the answer to a secure site is SSL, but what if you are on a  
shared host, SSL is unavailable and you still want some sort of  
security?


This is what I came by and I would appreciate any advice as to  
possible security holes in it.  There is a big hole I know, which  
is the screen to change the password, I find no way to secure that  
one.  But lets go to what I do have.


I found at http://pajhome.org.uk/crypt/md5/md5src.html a Javascript  
version of the MD5 algorithm.

I checked it against the PHP md5() function:

htmlheadtitleMD5 test/title
script language=JavaScript src=includes/md5.js/script
script
function enOnLoad() {
 document.getElementById('prueba').innerHTML = md5_vm_test(); // 
test provided by the library

 ?php
  $valor = rand();
 ?
 document.getElementById('p2').innerHTML = hex_md5('?=$valor?');
}
/script
/headbody onLoad=enOnLoad();
div id=prueba/div
div id=p2/div
div?=md5($valor)?/div
/body/html

And the results of the Javascript and the PHP md5() functions are  
the same (the JS source has a couple of parameters to play with,  
but the defaults proved good enough)


So, my idea is that in the login script, PHP will send a random  
number along with the login form. That random might actually be the  
session_id() but if not, the random value sent has to be stored in  
a session variable. (I really don't see any reason not to use the  
session_id()).


On clicking on submit to send the login form, the password field  
would be replaced by the result of


a) calculate the MD5() of the password, trimmed of whitespace.   
This should be the same value stored in the user table of the  
database.
b) concatenate this value with the random number (or session_id())  
provided by the server.

c) calculate the MD5() of this
d) replace it into the original password field and let the submit  
proceed.


On the server side, when the login data is received:

a) retrieve the password field from the user table on the  
database.  This should actually be the MD5-encripted of the actual  
password.
b) concatenate this value with the session_id() or whatever random  
you generated before

c) calculate the MD5() of this
d) compare with received value.  If they match, they come from the  
same password.


Would it work?

Satyam

--
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] Pause script

2006-03-27 Thread Pieter du Toit
Hi

I want to pause script in php, in a while loop, so that a key must be 
pressed or a button must be clicked for the script to continue.

Is this possible, i had a look at some functions, but it is not what i want.

Can someone point me in a direction to search or maybe solve this problem 
for me.

Thanks 

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



RE: [PHP] Pause script

2006-03-27 Thread Jay Blanchard
[snip]
I want to pause script in php, in a while loop, so that a key must be 
pressed or a button must be clicked for the script to continue.

Is this possible, i had a look at some functions, but it is not what i
want.

Can someone point me in a direction to search or maybe solve this
problem 
for me.
[/snip]

PHP is server-side...you would need a client-side method of interacting
with PHP. From the command line or browser?

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



Re: [PHP] Pause script

2006-03-27 Thread tedd

Hi

I want to pause script in php, in a while loop, so that a key must be
pressed or a button must be clicked for the script to continue.

Is this possible, i had a look at some functions, but it is not what i want.

Can someone point me in a direction to search or maybe solve this problem
for me.

Thanks


Pieter:

You could use a form with a submit button to continue.

tedd
--

http://sperling.com

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



Re: [PHP] Pause script

2006-03-27 Thread Richard Davey

On 27 Mar 2006, at 17:04, Pieter du Toit wrote:


I want to pause script in php, in a while loop, so that a key must be
pressed or a button must be clicked for the script to continue.

Is this possible, i had a look at some functions, but it is not  
what i want.


You mean when the script is called from the command line, right?  
because you cannot do it when called from a web page.


Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



[PHP] Why Should I Use Zend Optimizer?

2006-03-27 Thread Jonathan Duncan
I posted this on the Zend.com forums but have not been able to get a 
response yet.  So I decided to ask the people that know.


I do not understand the need for an optimizer.  What exactly is Zend 
Optimizer optimizing?  If it is changing my code, then how about if I just 
learn how to code better?  Is that all that Zend Optimizer is doing? 
Making my code better?


Instead of making a program to fix all the dumb things that programmers 
like me do, why not show us what is not working.  If post-incrementing is 
slower than pre-incrementing then I will just start pre-incrementing. 
What if I already write perfect code?  Would I still benefit from having 
Zend Optimizer on my system?


In other words, is Zend Optimizer a program designed to help poor coders 
have faster running code despite their lack of skill?  Or is it also 
optimizing other things?  If so, why are those things not already 
optimized?


Can anyone help me unfold this mystery?  I have read quite a bit about 
what Zend Optimizer is and perhaps I have missed the point.  So if there 
is a document that explains this, please direct me to it.


Thanks,
Jonathan

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



[PHP] phpmailer subject line wierdness

2006-03-27 Thread Mark Steudel
I know that there is a phpmailer list, but it's pretty low volume, so I
hoped you all might have some ideas on this.
 
If I set the subject line for a mail like:
 
$mail-Subject = 'Jconnect Passover Registration Confirmation';
 
The email never send, but if I stick a letter between O and N it goes out:
 
$mail-Subject = 'Jconnect Passover Registration Confirmatioan';
 
Any ideas? Does the 'on' translate to some weird line end character? Can I
try and re-encode it or something?
 
Mark


Re: [PHP] Why Should I Use Zend Optimizer?

2006-03-27 Thread Alister Bulman
On 27/03/06, Jonathan Duncan [EMAIL PROTECTED] wrote:
 I posted this on the Zend.com forums but have not been able to get a
 response yet.  So I decided to ask the people that know.

 I do not understand the need for an optimizer.  What exactly is Zend
 Optimizer optimizing?  If it is changing my code, then how about if I just
 learn how to code better?  Is that all that Zend Optimizer is doing?
 Making my code better?

There is no good reason to use ZO unless you have bought code that
requires it, and the code has been encrypted to require it.

If you run your own server, you would be far better served with
something to actually speed your code, like APC
(http://pecl.php.net/apc) or Eaccellerator (http://eaccelerator.net/)
that is a compiled-code cache.  And then learn how to write good code
as well.

Alister

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



Re: [PHP] Irritating [EMAIL PROTECTED]

2006-03-27 Thread Kevin Kinsey

Ryan A wrote:


Anybody else getting these annoying auto responses from [EMAIL PROTECTED]
?

If yes, can someone email the list mod to delete his account or something,
or email me back the list mods email and I'll do it myself.

Thanks,
Ryan

 




What, no killfile?

If we bug the mods for every idiot autoresponder out
there, when will they have time to improve PHP?

My $0.02,

KDK

--
An investment in knowledge always pays the best interest.
-- Benjamin Franklin

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



Re: [PHP] Why Should I Use Zend Optimizer?

2006-03-27 Thread Richard Davey

On 27 Mar 2006, at 17:36, Jonathan Duncan wrote:

I posted this on the Zend.com forums but have not been able to get  
a response yet.  So I decided to ask the people that know.


I do not understand the need for an optimizer.  What exactly is  
Zend Optimizer optimizing?  If it is changing my code, then how  
about if I just learn how to code better?  Is that all that Zend  
Optimizer is doing? Making my code better?


Think of the guts of PHP (the Zend Engine) as being like a virtual  
computer, complete with processor. When your PHP script is run, PHP  
takes it and first of all it is run through a lexer which will  
convert all of your wonderfully human-readale code (no matter how  
badly written!) into tokens suitable for this virtual CPU. The tokens  
are then passed over to the 'parser'. The parser takes each token and  
generates an instruction set. This is an assembly style form of code  
that runs on the Zend Engine. Finally it is executed.


It is this process that the Zend Optimiser (and packages like it)  
speed up. Typically they will compile your scripts into  
'executables' (for want of a better phrase), so that each time your  
script is called none of that lexer/parsing stage has to happen. It  
just executes and returns.


slight diversion

This whole process, and the fact that the Zend Engine IS a Virtual  
Machine in its own right, is why I get annoyed at people who claim  
that you cannot speed-up your scripts by changing the way certain  
things happen. I remember somebody posted a comment to my blog once  
to the effect of 'you aren't coding in assembly, it makes no  
difference what you do!' - which is of course complete crap, because  
actually your code does have a very direct correlation to the  
efficiency of the intermediate code that is generated and executed.


/slight diversion

In short, Zend Optimise has *nothing* at all to do with 'making dumb  
programmers code better' I'm afraid.


Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



Re: [PHP] Irritating [EMAIL PROTECTED]

2006-03-27 Thread Ryan A

On 3/27/2006 7:04:52 PM, Kevin Kinsey ([EMAIL PROTECTED]) wrote:
 Ryan A wrote:

 Anybody else getting these annoying auto responses from [EMAIL PROTECTED]
 com
 ?
 
 If yes, can someone email the list mod to delete his account or
something,

 or email me back the list mods email and I'll do it myself.
 
 Thanks,
 Ryan
 
 
 


 What, no killfile?

 If we bug the mods for every idiot autoresponder out
 there, when will they have time to improve PHP?

 My $0.02,

 KDK


Fair enough, but I think you wrote the sentance sligntly wrong
coz its not the idiot autoresponder but the idiot with an autoresponder to
the list

:-)

Cheers!

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



RE: [PHP] Why Should I Use Zend Optimizer?

2006-03-27 Thread ray . hauge

 
 In short, Zend Optimise has *nothing* at all to do with 'making dumb  
 programmers code better' I'm afraid.
 
 Cheers,
 
 Rich

I'm not completely sure on this, and if it is true I don't have the
links, but I think it does do one thing to make your code better. 
That is to use pre-increments wherever possible, since the
post-increment requires the parser to store the value first then
increment it (or something to that effect).  But even then it's really
only saving you milliseconds of processing time, which would only make
a beneficial improvement on an enterprise system (million-plus hits). 
Other than that I haven't heard anything else.  It won't clean up a
whole bunch of loops to something more efficient.

In response to your slight diversion  YES!  You are TOTALLY correct. 
If you write something that uses a loop inside of a loop instead of
just one loop (while or for) then it's going to be slower... no matter
if it's compiled beforehand or at runtime :)

Ray

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



Re: [PHP] cron via cPanel

2006-03-27 Thread John Nichel

tedd wrote:

Hi gang:

In cPanel one can schedule cron jobs.

In the command line box, what command do you enter to run a php script?



Same way you run any other app.  If it's in your path, you can just type 
the filename of the app, if not, give it the path...


phpscript.php

/path/to/phpscript.php

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[PHP] where php at?

2006-03-27 Thread tedd

Hi:

Related to my cron problem -- where do you get the path to php? My 
phpinfo() says:


http://www.xn--ovg.com/info.php

reports it as:

/usr/lib/php:/usr/local/lib/php

That can't be right, right? Or am I reading this wrong?

In any event, where's it at?

Thanks.

tedd
--

http://sperling.com

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



Re: [PHP] cron via cPanel

2006-03-27 Thread tedd

tedd wrote:

In cPanel one can schedule cron jobs.

In the command line box, what command do you enter to run a php script?


John answered:

Same way you run any other app.  If it's in your path, you can just 
type the filename of the app, if not, give it the path...


phpscript.php

/path/to/phpscript.php


John:

That was the first thing I tried, namely.

email_me.php   -- it's just a script that emails me.

Then I put in the complete url:

http://www.xn--ovg.com/email_me.php

Since then (following leads), I've tried these commands:

GET http://www.xn--ovg.com/email_me.php
php -f -q /home/tedd/public_html/email_me.php
# /usr/bin/php -q /home/tedd/public_html/email_me.php
/usr/bin/php -q /home/tedd/public_html/email_me.php
/usr/lib/php:/usr/local/lib/php -q /home/tedd/public_html/email_me.php
/usr/local/lib/php -q /home/tedd/public_html/email_me.php
/usr/local/lib/php -q -f /home/tedd/public_html/email_me.php

and a couple of dozen others with a cron job to be run every minute 
-- and nothing has worked.


I've been at this since late yesterday until 3:00 am and from 7:00 am 
to now. I have read scores of posts, articles, searched a dozen of 
php books, and couple of manuals and I can't get any 
suggestion/examples to work.


If nothing else, at least I'm persistent. I just wish I could be 
right more often.


Thanks for any suggestions.

tedd

--

http://sperling.com

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



Re: [PHP] where php at?

2006-03-27 Thread Warren Vail
Looks like you have a unix machine, if you have a shell account you may be 
able to use the command;


which php

to identify it's path.

hope this helps,

Warren Vail

At 10:45 AM 3/27/2006, tedd wrote:

Hi:

Related to my cron problem -- where do you get the path to php? My 
phpinfo() says:


http://www.xn--ovg.com/info.php

reports it as:

/usr/lib/php:/usr/local/lib/php

That can't be right, right? Or am I reading this wrong?

In any event, where's it at?

Thanks.

tedd
--

http://sperling.com

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





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



Re: [PHP] where php at?

2006-03-27 Thread John Meyer
tedd wrote:
 Hi:
 
 Related to my cron problem -- where do you get the path to php? My
 phpinfo() says:
 
 http://www.xn--ovg.com/info.php
 
 reports it as:
 
 /usr/lib/php:/usr/local/lib/php
 

If you're on a linux box, have you tried which php?

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



Re: [PHP] mysql_fecth_array() and function call as parameter

2006-03-27 Thread Paul Goepfert
I have done the following to my code hoping that the fix would work

$query1 = mysql_query(SELECT months FROM Month WHERE m_id = month(curdate()));
//echo $query1 . br /;

$query1_data = mysql_fetch_assoc($query1);
echo $query1_data . br /;  returns Array (The word that is)
switch ($query1_data)
{

I also outputted
$query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum = 
day(curdate()));
echo $query2 . br /;

and I got an empty string

This is the code that I use when I call the function

$month = $this-determineMonth();
//echo $month . br /;
$Month_query = mysql_query($month);
//echo mysql_error() . br /;
while ($x = mysql_fetch_assoc($Month_query))
{
$form .=option value={$x[m_id]}{$x[months]}/option\n;
}

And according to my apache error log I have

[Mon Mar 27 11:34:42 2006] [error] [client 192.168.0.2] PHP Warning: 
mysql_fetch_assoc(): supplied argument is not a valid MySQL result
resource in C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\validation.php on line 130
[Mon Mar 27 11:34:42 2006] [error] [client 192.168.0.2] PHP Warning: 
mysql_fetch_assoc(): supplied argument is not a valid MySQL result
resource in C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\validation.php on line 342

By the way I tested the SQL statements in MYSQL and they returned the
values I was looking for.

What am I missing?  At the time of this email I was unable to check
the php docs at php.net.

Thanks,

Paul
On 3/26/06, Chris [EMAIL PROTECTED] wrote:
 Paul Goepfert wrote:
  I placed the echo statements in my code and I found out that my query
  was empty.  I also went a step further and tested if I was getting the
  correct outputs from the queries that initially do at the beginning of
  the method.  Instead of getting an output like March I got an output
  that says Resource id#9.  I don't get it.  I tested the sql
  statement in MySQL that I have on my computer.  It worked,  Why
  wouldn't it give the same output through mysql_query()?

 Ahh, didn't notice that.


 $query1 = mysql_query(SELECT months FROM Month WHERE m_id =
 month(curdate()));

 $query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum =
 day(curdate()));

 $query3 = mysql_query(SELECT year FROM Year WHERE year = year(curdate()));


 These return result resources (kinda like '$fp = fopen' doesn't return
 the file - it returns a handle only), not the results. You need to do:

 $query1_data = mysql_fetch_assoc($query1, 0, 0);

 then

 switch($query1_data) {
 
 }

 see http://www.php.net/mysql_query and
 http://www.php.net/mysql_fetch_assoc for more info.


  On 3/26/06, Chris [EMAIL PROTECTED] wrote:
 
 Paul Goepfert wrote:
 
 Hi all,
 
 I have wriiten a function that determines whether tomorrows date is
 the first of the month or not then returns a SQL string based on
 whether its the first of the month or not.  According to my apache
 error logs I get an error that says:
 
 [Sun Mar 26 21:43:14 2006] [error] [client 192.168.0.2] PHP Warning:
 mysql_fetch_array(): supplied argument is not a valid MySQL result
 resource in C:\\Program Files\\Apache
 Group\\Apache2\\htdocs\\validation.php on line 331
 
 I understand that this is a warning but I believe that it has
 something to do with the fact that no output is being displayed.  All
 other mysql database outputs work fine.
 
 This is the code that sets the query in the mysql_query parameter
 
 $Month_query = mysql_query($this-determineMonth());
 
 Add this after your month_query call:
 
 echo mysql_error() . br/;
 
 It will tell you what's wrong with the query. I'd probably also print
 out the query:
 
 $qry = $this-determineMonth();
 echo $qry . br/;
 
 and run it manually (if something does get returned).
 
 --
 Postgresql  php tutorials
 http://www.designmagick.com/
 
 
 


 --
 Postgresql  php tutorials
 http://www.designmagick.com/


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



Re: [PHP] where php at?

2006-03-27 Thread tedd

Warren Vail said:

Looks like you have a unix machine, if you have a shell account you 
may be able to use the command;


which php

to identify it's path.


John Meyer said:


If you're on a linux box, have you tried which php?


Where do I type in which php?

I'm dealing with a host account and I'm simply trying to find out 
where php is so I can set up a cron job.


Thanks.

tedd
--

http://sperling.com

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



RE: [PHP] where php at?

2006-03-27 Thread Jay Blanchard
[snip]
Where do I type in which php?
[/snip]

At the command line on the host.

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



RE: [PHP] where php at?

2006-03-27 Thread tedd

At 1:19 PM -0600 3/27/06, Jay Blanchard wrote:

[snip]
Where do I type in which php?
[/snip]

At the command line on the host.


Aarrrg -- no disrespect meant.

I'm totally and absolutely clueless and frustrated. It must be my age 
because I haven't seen a command line since my Apple][ days -- let 
alone one while doing web work.


I'm sitting in front of my computer accessing my remote web site via 
ftp (GoLive) writing code and trying to set up a cron job using 
cpanel to run that code.


Now, I have no idea of where I should type in which php  -- I've 
tried putting it in my cpanel cron jobs command to run box, but 
that doesn't do anything.


Does anyone have any reference material of where a command line of 
the host is?


Thanks.

tedd

--

http://sperling.com

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



Re: [PHP] Why Should I Use Zend Optimizer?

2006-03-27 Thread Richard Davey

On 27 Mar 2006, at 19:10, [EMAIL PROTECTED] wrote:


In short, Zend Optimise has *nothing* at all to do with 'making dumb
programmers code better' I'm afraid.


I'm not completely sure on this, and if it is true I don't have the
links, but I think it does do one thing to make your code better.
That is to use pre-increments wherever possible, since the
post-increment requires the parser to store the value first then
increment it (or something to that effect).  But even then it's really
only saving you milliseconds of processing time, which would only make
a beneficial improvement on an enterprise system (million-plus hits).


Sorry I should have been more explicit - I meant it won't re-write  
your actual source code for you, which I believe is what the OP  
thought it was supposed to do (if only!)


Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



RE: [PHP] where php at?

2006-03-27 Thread Jay Blanchard
[snip]
Aarrrg -- no disrespect meant.

I'm totally and absolutely clueless and frustrated. It must be my age 
because I haven't seen a command line since my Apple][ days -- let 
alone one while doing web work.

I'm sitting in front of my computer accessing my remote web site via 
ftp (GoLive) writing code and trying to set up a cron job using 
cpanel to run that code.

Now, I have no idea of where I should type in which php  -- I've 
tried putting it in my cpanel cron jobs command to run box, but 
that doesn't do anything.

Does anyone have any reference material of where a command line of 
the host is?
[/snip]

Dagnabit! Contact your host provider, they will tell you.

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



Re: [PHP] where php at?

2006-03-27 Thread Dusty Bin
tedd wrote:
 At 1:19 PM -0600 3/27/06, Jay Blanchard wrote:
 [snip]
 Where do I type in which php?
 [/snip]

 At the command line on the host.
 
 Aarrrg -- no disrespect meant.
 
 I'm totally and absolutely clueless and frustrated. It must be my age
 because I haven't seen a command line since my Apple][ days -- let alone
 one while doing web work.
 
 I'm sitting in front of my computer accessing my remote web site via ftp
 (GoLive) writing code and trying to set up a cron job using cpanel to
 run that code.
 
 Now, I have no idea of where I should type in which php  -- I've tried
 putting it in my cpanel cron jobs command to run box, but that doesn't
 do anything.
 
 Does anyone have any reference material of where a command line of the
 host is?
 
 Thanks.
 
 tedd
 
I know nothing of cpanel, but if you can use cpanel to execute your
script, can you not use cpanel to say 'which php'??
HTH...  Dusty

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



Re: [PHP] where php at?

2006-03-27 Thread Warren Vail
ah, perhaps you don't have a shell account.  With a shell account you would 
telnet to the server and enter the which command on the command line right 
after your prompt, once you were logged on.


try creating a file called which.php

have it contain the following;

?php
$result = exec(which php);
echo $result;
?

Upload it to your website and execute it in your browser.  I uploaded it to 
my RedHat Linux server and it showed the following;


/usr/local/bin/php

good luck,

Warren Vail

At 11:05 AM 3/27/2006, tedd wrote:

Warren Vail said:

Looks like you have a unix machine, if you have a shell account you may 
be able to use the command;


which php

to identify it's path.


John Meyer said:


If you're on a linux box, have you tried which php?


Where do I type in which php?

I'm dealing with a host account and I'm simply trying to find out where 
php is so I can set up a cron job.


Thanks.

tedd
--

http://sperling.com




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



RE: [PHP] where php at?

2006-03-27 Thread tedd

Dagnabit! Contact your host provider, they will tell you.



10 Been there
20 Done that
30 GOTO 10

Thanks anyway.

tedd
--

http://sperling.com

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



RE: [PHP] mysql_fecth_array() and function call as parameter

2006-03-27 Thread Brady Mitchell
 I have done the following to my code hoping that the fix would work
 
 $query1 = mysql_query(SELECT months FROM Month WHERE m_id =
month(curdate()));
 //echo $query1 . br /;
 
 $query1_data = mysql_fetch_assoc($query1);
   echo $query1_data . br /;  returns Array 
 (The word that is)

Use:  print_r($query1_data) or var_dump($query1_data) to see everything
in the array.  If you want to use echo, you'd have to echo each index of
the array one at a time with something like:  echo $query1_data[0]; 

http://php.net/echo
http://php.net/print_r
http://php.net/var_dump

 switch ($query1_data)
 {

You can't switch on an entire array.  Switch is used to check the value
of a variable (which could be an index of the array, but not the entire
array).

Something like this should work:

switch($query1_data[months])
{

}

http://php.net/switch

In your original posting you have lines like the following in your
switch statement: 

 if($query2 == 31)

As someone mentioned, mysql_query returns a resource ID, you then have
to use mysql_fetch_assoc (or one of the other mysql_fetch_* functions)
to get an array that you can use as you are trying to do.

So after doing:  $query2_data = mysql_fetch_assoc($query2);

You could do:  if($query2_data[dayNum] == 31)

In your switch statement you are checking for the full name of the
month, but your query will be returning the month number.  Since you
don't have a default case on your switch statement, $return is never
being set, so  $month = $this-determineMonth();  is not setting
$month to anything, which is why you are getting error messages.

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

Brady

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



Re: [PHP] where php at?

2006-03-27 Thread tedd

I know nothing of cpanel, but if you can use cpanel to execute your
script, can you not use cpanel to say 'which php'??
HTH...  Dusty


Dusty:

Nope, it doesn't appear to work that way.

Everything I've read thus far is that you must somehow enter the 
exact command you would via a command line -- very similar to how you 
reset your MySQL db by injecting text directly into phpMySQLAdmin.


It should look something like:

/usr/local/lib/php -q -f /home/tedd/www/email_me.php

But, like a monkey typing all possible combinations, I've been 
unsuccessful in typing the right combination.


Thanks anyway.

tedd
--

http://sperling.com

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



Re: [PHP] where php at?

2006-03-27 Thread Joe Henry
On Monday 27 March 2006 12:31 pm, tedd wrote:
 At 1:19 PM -0600 3/27/06, Jay Blanchard wrote:
 [snip]
 Where do I type in which php?
 [/snip]
 
 At the command line on the host.

 Aarrrg -- no disrespect meant.

 I'm totally and absolutely clueless and frustrated. It must be my age
 because I haven't seen a command line since my Apple][ days -- let
 alone one while doing web work.

 I'm sitting in front of my computer accessing my remote web site via
 ftp (GoLive) writing code and trying to set up a cron job using
 cpanel to run that code.

 Now, I have no idea of where I should type in which php  -- I've
 tried putting it in my cpanel cron jobs command to run box, but
 that doesn't do anything.

 Does anyone have any reference material of where a command line of
 the host is?

 Thanks.

 tedd

 --
 ---
- http://sperling.com


Hey Tedd,

Do you have ssh access to your remote server from your local machine? If you 
do, then that would be where you'd run the command which php.

On Linux/Mac OS X, you can ssh via a terminal. On Windows, a program like 
PuTTY will do the trick.

Link for PuTTY download (just in case):
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Syntax for ssh:
ssh user account@hostname/IP

Once you have an ssh session open to your remote server, running which php 
will return the remote path for php.

Hope that helps.
--
Joe Henry
www.celebrityaccess.com
[EMAIL PROTECTED]

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



RE: [PHP] where php at?

2006-03-27 Thread Jim Moseby
 
 Dagnabit! Contact your host provider, they will tell you.
 
 
 10 Been there
 20 Done that
 30 GOTO 10
 
 Thanks anyway.

?PHP
  if(!$host_provider_instructions){
echo If your host provider can't tell you how to connect to _their_
server, what makes you think someone in php_general will be able to?;
  }else{
echo Follow host provider instructions;
  }
?

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



Re: [PHP] where php at?

2006-03-27 Thread Kevin Kinsey

tedd wrote:


Warren Vail said:


Looks like you have a unix machine, if you have a
shell account you may be able to use the command;

which php

to identify it's path.



John Meyer said:


If you're on a linux box, have you tried which php?



Where do I type in which php?

I'm dealing with a host account and I'm
simply trying to find out where php is so
I can set up a cron job.

Thanks.

tedd




If you don't have a shell, you might get away with
a page using system(), backticks, escapeshellcmd(),
and the like (though on a shared host I'd think them
to be wise to disable a shell for www/nobody/apache):

?php

$foo=`which php`;
echo $foo;

?

Now, you may want to use whereis(1) instead, since
which is a shell-built in . . . but it sounds like a catch22:
no shell, no which; no shell, no shell, so whereis(1) can't
work either ... hmm, OTOH, which is only a shell builtin
in some shells, in which case ... ah, nevermind.

If you're guessing?  typical places include : /usr/local/bin/php,
/usr/bin/php, /usr/etc/php . . . .

HTH,

Kevin Kinsey

--
The devil finds work for idle glands.

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



Re: [PHP] where php at?

2006-03-27 Thread Richard Davey

On 27 Mar 2006, at 20:47, tedd wrote:


Dagnabit! Contact your host provider, they will tell you.



10 Been there
20 Done that
30 GOTO 10


40 Gosub 'get decent web host'

Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



Re: [PHP] where php at?

2006-03-27 Thread tedd



try creating a file called which.php

have it contain the following;

?php
$result = exec(which php);
echo $result;
?

Upload it to your website and execute it in your browser.  I 
uploaded it to my RedHat Linux server and it showed the following;


/usr/local/bin/php


 Warren:

Bingo -- that did it -- mine is:

/usr/local/bin/php

as well.

Now, to figure out what command I need to run a php script from there.

Thanks -- one step closer.

tedd
--

http://sperling.com

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



Re: [PHP] where php at?

2006-03-27 Thread Kevin Kinsey

Jay Blanchard wrote:


[snip]
Aarrrg -- no disrespect meant.

I'm totally and absolutely clueless and frustrated. It must be my age 
because I haven't seen a command line since my Apple][ days -- let 
alone one while doing web work.


I'm sitting in front of my computer accessing my remote web site via 
ftp (GoLive) writing code and trying to set up a cron job using 
cpanel to run that code.


Now, I have no idea of where I should type in which php  -- I've 
tried putting it in my cpanel cron jobs command to run box, but 
that doesn't do anything.


Does anyone have any reference material of where a command line of 
the host is?

[/snip]

Dagnabit! Contact your host provider, they will tell you.
 



If they offer a shell account.  I *shudder* to think that as recently
as 1999 I was administering a remote mail/webserver in the Pac
NW from the center of the country via telnet.

Possibly they offer access via ssh (Secure Shell), but a lot of hosts
don't any longer --- many customers wouldn't know what to do with
it anyway (heh, their loss), and some customers who *do* know how
to use it are a tad too curious sometimes, I expect.  I know I've seen
more than one big hosting company act like such things didn't
exist

Kevin Kinsey

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



Re: [PHP] Why Should I Use Zend Optimizer?

2006-03-27 Thread Kevin Kinsey

Richard Davey wrote:


On 27 Mar 2006, at 19:10, [EMAIL PROTECTED] wrote:


In short, Zend Optimise has *nothing* at all to do with 'making dumb
programmers code better' I'm afraid.



I'm not completely sure on this, and if it is true I don't have the
links, but I think it does do one thing to make your code better.
That is to use pre-increments wherever possible, since the
post-increment requires the parser to store the value first then
increment it (or something to that effect).  But even then it's really
only saving you milliseconds of processing time, which would only make
a beneficial improvement on an enterprise system (million-plus hits).



Sorry I should have been more explicit - I meant it won't re-write 
your actual source code for you, which I believe is what the OP 
thought it was supposed to do (if only!)


Cheers,

Rich



Yeah; I'm still petitioning the Team daily via cron for
'make_shopping_cart(str general_business_type);'
in PHP6 

:D

KDK

--
In Boston, it is illegal to hold frog-jumping contests in nightclubs.

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



RE: [PHP] where php at?

2006-03-27 Thread tedd

At 2:50 PM -0500 3/27/06, Jim Moseby wrote:

 

 Dagnabit! Contact your host provider, they will tell you.


 10 Been there
 20 Done that
 30 GOTO 10

 Thanks anyway.


?PHP
  if(!$host_provider_instructions){
echo If your host provider can't tell you how to connect to _their_
server, what makes you think someone in php_general will be able to?;
  }else{
echo Follow host provider instructions;
  }
?


Sorry to have bothered you.

tedd
--

http://sperling.com

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



[PHP] --enable-radius, not found

2006-03-27 Thread Mike Milano
I'm trying to compile PHP with radius enabled.  I have the pecl source 
and I can use other pecl extensions just fine.


When I type: cscript /nologo configure.js --help, I do not see any 
option for radius.


I've also tried to compile the dll by itself, but it is simply not found.

My system is WinXP using the platform SDK for Win2k to compile.  I get 
the same results compiling in VC7.


Any insight into what might be causing this would be greatly appreciated.

Thank you,

Mike Milano

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



RE: [PHP] where php at?

2006-03-27 Thread Jay Blanchard
[snip]
/usr/local/bin/php


Now, to figure out what command I need to run a php script from there.
[/snip]

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

Now, you can do this one of two ways

17 8 * * * /usr/local/bin/php /path/to/your/script.php 

Or you can add a bash line to the top of your file and then make sure to
have one blank line after the bash line

#!/usr/local/bin/php

/* start your script here */

The bash line may not work depending on how the host is set up.


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



RE: [PHP] where php at?

2006-03-27 Thread tedd

At 2:50 PM -0500 3/27/06, Jim Moseby wrote:

 

 Dagnabit! Contact your host provider, they will tell you.


 10 Been there
 20 Done that
 30 GOTO 10

 Thanks anyway.


?PHP
  if(!$host_provider_instructions){
echo If your host provider can't tell you how to connect to _their_
server, what makes you think someone in php_general will be able to?;
  }else{
echo Follow host provider instructions;
  }
?


Jim Moseby:

On second thought, I'm really not sorry to have brother you -- you 
don't have to reply to any request for help on this list.


Furthermore, I'm not asking you to provide me with how to connect to 
my host's server -- I've done that and that's not the problem. What 
I was asking for was some help, which Warren was capable of both 
understanding and providing.


Now maybe you didn't mean to come off as you did, but if positions 
were reversed, I like to think I wouldn't.


tedd
--

http://sperling.com

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



RE: [PHP] where php at?

2006-03-27 Thread Jay Blanchard
[snip]

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

Now, you can do this one of two ways

17 8 * * * /usr/local/bin/php /path/to/your/script.php 

Or you can add a bash line to the top of your file and then make sure to
have one blank line after the bash line

#!/usr/local/bin/php

/* start your script here */

The bash line may not work depending on how the host is set up.
[/snip]

And the cron line should then read (with a bash);

17 8 * * * /path/to/your/script.php

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



RE: [PHP] where php at?

2006-03-27 Thread Ryan A
 [/clip]

 http://www.unixgeeks.org/security/newbie/unix/cron-1.html

 Now, you can do this one of two ways

 17 8 * * * /usr/local/bin/php /path/to/your/script.php

[/clip]

Now, I might be coming in a bit late here...but I have worked with cpanel
and using their simplified version of setting cron its pretty easy plus to
call the script you dont have to give the path the php like in the clip
above

Just
 17 8 * * *  /path/to/your/script.php

would do fine... at least it worked for me.

HTH.

Cheers,
Ryan

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



Re: [PHP] where php at?

2006-03-27 Thread Rory Browne


 Jim Moseby:

 On second thought, I'm really not sorry to have brother you -- you
 don't have to reply to any request for help on this list.



Two-Faced SOB - One minute you're sorry, the next you're not. Make up your
gd Mind.


Furthermore, I'm not asking you to provide me with how to connect to
 my host's server -- I've done that and that's not the problem. What
 I was asking for was some help, which Warren was capable of both
 understanding and providing.

That's being pedantic. Da monsewers point still stands. If your host can't
give you details of its host, we would have difficulty given that we don't
have access to them. It would probably fall on the point that Warren managed
to write a script to extract the details - but that wasn't the point you
made.



Now maybe you didn't mean to come off as you did, but if positions
 were reversed, I like to think I wouldn't.


How would you like to come across? As an ungrateful SOB who can't take some
constructive critisism? You have some growing up to do before entering el
big bad world. Babies these days...

I'll add more to this tomorrow morning when I'm sober.



tedd
 --

 
 http://sperling.com

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




Re: [PHP] where php at?

2006-03-27 Thread Anthony Ettinger
On 3/27/06, Rory Browne [EMAIL PROTECTED] wrote:
 
 
  Jim Moseby:
 
  On second thought, I'm really not sorry to have brother you -- you
  don't have to reply to any request for help on this list.



 Two-Faced SOB - One minute you're sorry, the next you're not. Make up your
 gd Mind.


 Furthermore, I'm not asking you to provide me with how to connect to
  my host's server -- I've done that and that's not the problem. What
  I was asking for was some help, which Warren was capable of both
  understanding and providing.

 That's being pedantic. Da monsewers point still stands. If your host can't
 give you details of its host, we would have difficulty given that we don't
 have access to them. It would probably fall on the point that Warren managed
 to write a script to extract the details - but that wasn't the point you
 made.



 Now maybe you didn't mean to come off as you did, but if positions
  were reversed, I like to think I wouldn't.


 How would you like to come across? As an ungrateful SOB who can't take some
 constructive critisism? You have some growing up to do before entering el
 big bad world. Babies these days...

 I'll add more to this tomorrow morning when I'm sober.



 tedd
  --

In a related question, I have php5 installed on my box (works fine
with Apache2)...but I can't seem to find php5 on the command line.

Is there a separate package I need (fyi: I'm using Gentoo).



--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] where php at?

2006-03-27 Thread Ryan A
 Two-Faced SOB - One minute you're sorry, the next you're not. Make up
 your
 gd Mind.



 I'll add more to this tomorrow morning when I'm sober.




DAMN! I love this listother than two people on the list I think everyone
else is gonna have a smile on their faces.

My $0.2

:-p

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



RE: [PHP] where php at?

2006-03-27 Thread Ryan A
Ooops, and lets not forget this one:

curl http://www.yoursite.com/path/to/script/yourscript.php

you can put that in your cron job by going to cpanel its a long way
round but sometimes it can be usefulyou should have CURL installed of
course.
The good thing about the above is it does not matter where the heck your php
is installed or if you have the shebang or not...

HTH again.

Cheers,
Ryan

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



Re: [PHP] where php at?

2006-03-27 Thread Jon Anderson

Anthony Ettinger wrote:

In a related question, I have php5 installed on my box (works fine
with Apache2)...but I can't seem to find php5 on the command line.

Is there a separate package I need (fyi: I'm using Gentoo).
Enable the cli USE flag in either /etc/make.conf or 
/etc/portage/package.use and re-emerge dev-lang/php


Cheers,

jon

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



Re: [PHP] protecting passwords when SSL is not available

2006-03-27 Thread Satyam

Thanks Evan, that's a new word I didn't know about, 'nonce'.

Let me see if I got your objection right and may answer it.  The 
session_id() is no secret, the server sends it to the client.  The client 
cannot and does not send the session_id() used to hash the password back to 
the server, it does not need to, the client got it from the server.


It is the server that challenges the client with a session_id() (or any 
other random) sent clear and the client has to take the challenge and 
combine it with the password (which is not transmitted clear).  Thus the 
client cannot tell the server, 'this is user xxx, with password  hashed 
under session_id '.   It is the server that challenges the client with 
the session_id.  The attacker might collect enough samples so if a challenge 
repeats, he can have the answer ready, but that is unlikely with long enough 
challenges (and session_ids are long).


As for sending the session_id() from the server to the client in clear (not 
encrypted) it seems to me it doesn't make any sense to alter it in any way 
since, after all, you are also sending the algorithm in Javascript to the 
client, which is clear for anyone to see, so there would be no point in 
trying to hide the session_id in any way, and I don't think it would help 
the overall security.


My bank does use SSL, of course, and it still requires confirmation to do 
critical processes so, that might be a partial solution to spoofing.


Anyway, this is a poor man replacement for SSL, with limitations, but it is 
good to know what are those limitations.


Thanks for your help

Satyam



- Original Message - 
From: Evan Priestley [EMAIL PROTECTED]

To: Satyam [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, March 27, 2006 5:41 PM
Subject: Re: [PHP] protecting passwords when SSL is not available


This is called a nonce[1], and the method you've described will  give 
you marginally less awful security than submitting a plaintext  password 
or an unadulterated hash of the password, but, obviously, is  in no way a 
substitute for real SSL. For instance, if this password  puts the session 
in a logged in state, an attacker with the  capacity to sniff the 
password can also sniff the logged in session  ID after authentication. 
You can potentially bind the login to IP,  but will prevent users behind 
rotating proxies from using your  service and may not protect users behind 
non-rotating proxies, and  the source IP for a request can be spoofed. 
Alternatively, you can  require the password for any action requiring 
authorization (and  never put the user in a logged in state), but this 
will impose  substantial constraints on your design. And, of course, an 
attacker  can still observe any other data you transmit.


If you implement nonced password transmission, absolutely ensure that  an 
attacker can not alter the provided nonce. For instance, if Bob  sees 
Alice log in under nonce abc123 (her PHP session ID), what  happens if 
Bob later executes a replay attack by mimicking her form  submission 
(username: alice, password_hash: def456, session_id:  abc123)? If he can 
gain access via replay attack at any time after  Alice's first login ([a] 
while her session is valid or [b] after it  has expired presumably being 
the critical periods), the system offers  no security over non-nonced 
password transmission.


Evan

[1] http://en.wikipedia.org/wiki/Nonce

On Mar 27, 2006, at 8:30 AM, Satyam wrote:

I know the answer to a secure site is SSL, but what if you are on a 
shared host, SSL is unavailable and you still want some sort of 
security?


This is what I came by and I would appreciate any advice as to  possible 
security holes in it.  There is a big hole I know, which  is the screen 
to change the password, I find no way to secure that  one.  But lets go 
to what I do have.


I found at http://pajhome.org.uk/crypt/md5/md5src.html a Javascript 
version of the MD5 algorithm.

I checked it against the PHP md5() function:

htmlheadtitleMD5 test/title
script language=JavaScript src=includes/md5.js/script
script
function enOnLoad() {
 document.getElementById('prueba').innerHTML = md5_vm_test(); // test 
provided by the library

 ?php
  $valor = rand();
 ?
 document.getElementById('p2').innerHTML = hex_md5('?=$valor?');
}
/script
/headbody onLoad=enOnLoad();
div id=prueba/div
div id=p2/div
div?=md5($valor)?/div
/body/html

And the results of the Javascript and the PHP md5() functions are  the 
same (the JS source has a couple of parameters to play with,  but the 
defaults proved good enough)


So, my idea is that in the login script, PHP will send a random  number 
along with the login form. That random might actually be the 
session_id() but if not, the random value sent has to be stored in  a 
session variable. (I really don't see any reason not to use the 
session_id()).


On clicking on submit to send the login form, the password field  would 
be replaced by the result of


a) calculate 

Re: [PHP] where php at?

2006-03-27 Thread Anthony Ettinger
On 3/27/06, Ryan A [EMAIL PROTECTED] wrote:
 Ooops, and lets not forget this one:

 curl http://www.yoursite.com/path/to/script/yourscript.php

 you can put that in your cron job by going to cpanel its a long way
 round but sometimes it can be usefulyou should have CURL installed of
 course.
 The good thing about the above is it does not matter where the heck your php
 is installed or if you have the shebang or not...

 HTH again.

 Cheers,
 Ryan


$which php
returns nothing

$whereis php
php: /etc/ph
$ ls /etc/php
apache2-php4  apache2-php5  cli-php4

I don't think the binary php exists on my system.
The only php* binary matches I have are:
$ php
php-config  phpize


I think cli-php4 is the command-line-interface php.ini file for php4,
but the binary is no longer on my system.

If anyone knows...otherwise, I'll redirect to #gentoo


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] where php at?

2006-03-27 Thread Warren Vail
I believe the command portion of your chron entry is /usr/local/bin/php 
/full/path/to/myscript.php (separated by a space)


My Cpanel allows two methods scheduling (updating cron.tab file), if you 
are using the unix option, you have the ability to schedule the execution 
at a certain time of day, etc.  Soneone else on this thread gave you a 
pretty good description of how that works, and there are other tutorials 
out there that will help.  I prefer the unix option from my cpanel.


make sure that the full path name is provided to your script, usually this 
will point to home/user or something like that.  Also your script will need 
to use full path names to files, you can use the pwd command (as we did 
with which) to find out what the current directory is for your script, but 
it is safest to use nothing but full directory names, because it is almost 
guaranteed to not be what you would expect, so relative path names will 
give you problems.


hope this helps,

Warren Vail
At 11:59 AM 3/27/2006, tedd wrote:


try creating a file called which.php

have it contain the following;

?php
$result = exec(which php);
echo $result;
?

Upload it to your website and execute it in your browser.  I uploaded it 
to my RedHat Linux server and it showed the following;


/usr/local/bin/php

 Warren:

Bingo -- that did it -- mine is:

/usr/local/bin/php

as well.

Now, to figure out what command I need to run a php script from there.

Thanks -- one step closer.

tedd
--

http://sperling.com




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



Re: [PHP] cron via cPanel

2006-03-27 Thread John Nichel

tedd wrote:

tedd wrote:

In cPanel one can schedule cron jobs.

In the command line box, what command do you enter to run a php script?


John answered:

Same way you run any other app.  If it's in your path, you can just 
type the filename of the app, if not, give it the path...


phpscript.php

/path/to/phpscript.php


John:

That was the first thing I tried, namely.

email_me.php   -- it's just a script that emails me.

Then I put in the complete url:

http://www.xn--ovg.com/email_me.php

Since then (following leads), I've tried these commands:

GET http://www.xn--ovg.com/email_me.php
php -f -q /home/tedd/public_html/email_me.php
# /usr/bin/php -q /home/tedd/public_html/email_me.php
/usr/bin/php -q /home/tedd/public_html/email_me.php
/usr/lib/php:/usr/local/lib/php -q /home/tedd/public_html/email_me.php
/usr/local/lib/php -q /home/tedd/public_html/email_me.php
/usr/local/lib/php -q -f /home/tedd/public_html/email_me.php

and a couple of dozen others with a cron job to be run every minute -- 
and nothing has worked.


I've been at this since late yesterday until 3:00 am and from 7:00 am to 
now. I have read scores of posts, articles, searched a dozen of php 
books, and couple of manuals and I can't get any suggestion/examples to 
work.


If nothing else, at least I'm persistent. I just wish I could be right 
more often.


Thanks for any suggestions.

tedd



Is the script executable by the user you're trying to run it as?

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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



Re: [PHP] where php at?

2006-03-27 Thread Anthony Ettinger
On 3/27/06, Anthony Ettinger [EMAIL PROTECTED] wrote:
 On 3/27/06, Ryan A [EMAIL PROTECTED] wrote:
  Ooops, and lets not forget this one:
 
  curl http://www.yoursite.com/path/to/script/yourscript.php
 
  you can put that in your cron job by going to cpanel its a long way
  round but sometimes it can be usefulyou should have CURL installed of
  course.
  The good thing about the above is it does not matter where the heck your php
  is installed or if you have the shebang or not...
 
  HTH again.
 
  Cheers,
  Ryan
 

 $which php
 returns nothing

 $whereis php
 php: /etc/ph
 $ ls /etc/php
 apache2-php4  apache2-php5  cli-php4

 I don't think the binary php exists on my system.
 The only php* binary matches I have are:
 $ php
 php-config  phpize


 I think cli-php4 is the command-line-interface php.ini file for php4,
 but the binary is no longer on my system.

 If anyone knows...otherwise, I'll redirect to #gentoo


fyi: i didn't have the cli use flag set when I installed php5.

--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



[PHP] $i vs. $r

2006-03-27 Thread Kevin Murphy

Does anyone have a clue why using this code doesn't work:

$i = 0;

while ($row = mysql_fetch_array($result))

{   
echo (Blah blah blah);
$i++;
}

but this code does?

$r = 0;

while ($row = mysql_fetch_array($result))

{   
echo (Blah blah blah);
$r++;
}

I don't use $i anywhere else on the page.

--
Kevin Murphy
Webmaster - Information and Marketing Services
Western Nevada Community College
www.wncc.edu
(775) 445-3326

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



RE: [PHP] $i vs. $r

2006-03-27 Thread Jay Blanchard
[snip]
Does anyone have a clue why using this code doesn't work:

$i = 0;

while ($row = mysql_fetch_array($result))

{   
echo (Blah blah blah);
$i++;
}

but this code does?

$r = 0;

while ($row = mysql_fetch_array($result))

{   
echo (Blah blah blah);
$r++;
}

I don't use $i anywhere else on the page.
[/snip]

While $i is often used as an iterative (hence $i) variable it is not
required to be $i. You are echoing $r at the end of the while loop,
aren't you? Nothing in the loop requires an $i at this point.

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



Re: [PHP] protecting passwords when SSL is not available

2006-03-27 Thread Evan Priestley
The client cannot and does not send the session_id() used to hash  
the password back to the server, it does not need to, the client  
got it from the server.


It does send the session ID back though, because that's how the user  
maintains their session across requests.


For simplicity, let the totally made up word noncehash represent  
hash(hash(password)+nonce) -- that is, the hash of 'the nonce  
appended to the hash of the password'.


Generally, if the client ONLY sends (a) a user name and (b) a  
noncehash, then the server has no way to tell which nonce was  
originally issued. Therefor, the client has to send (a) a user name,  
(b) a noncehash, and (c) some key which can identify which nonce was  
sent. This key might be the session ID, the nonce itself, or  
something else[1].


If the key is the nonce itself and the only server-side validation is  
that the response noncehash is correct for the supplied nonce,  
attacker Bob can observe ANY valid nonce/noncehash combination Alice  
submits and replay it to gain access[2].


If the key is the session ID, and the only server-side validation is  
still that the response noncehash is correct for the given session  
ID, attacker Bob can STILL observe ANY valid session ID / noncehash  
combination Alice submits (she _is_ submitting the session ID -- the  
nonce, here -- because every request always includes the session ID  
when sessions are being used) and replay it immediately to gain  
access. This is session hijacking, and it works because PHP will  
let Bob into Alice's session as long as he knows her session ID[3].


Instead, suppose the server-side validation is a little stronger: it  
checks that the response noncehash is correct for the given session  
ID, but ALSO checks to make sure that this session ID hasn't logged  
in yet. Now Bob can't replay the response immediately. He can still  
just hijack the logged-in session, though, and he might be able to  
replay the attack after Alice's session has expired, because the flag  
that says this session has already logged in will also have  
expired. I'm not sure if PHP will create an expired session ID for  
you; presumably it won't, but if you're writing your own session  
handler or implementing nonced password transmission in some other  
programming language, this might be a viable attack vector.


Evan

[1] It could even be the username, if the login process went like  
this: client sends server username, server generates a nonce and  
stores it in the user table, server sends generated nonce to client,  
client sends hash(hash(password)+nonce) to server -- but then an  
attacker can perform a DOS attack by repeatedly sending the server a  
username so that it regenerates nonces more quickly than the real  
user can log in. In any case, (a), (b) and (c) do not necessarily  
need to be three separate pieces of information, since one piece of  
information can serve multiple roles.
[2] Unless nonces are stored in a database and flagged as used  
afterward. You can also, e.g., generate nonces in the form  
timestamp,hash(timestamp+secret); google for more on this.
[3] Unless you're e.g. restricting sessions by IP, but this is  
potentially a whole different can of worms.





It is the server that challenges the client with a session_id() (or  
any other random) sent clear and the client has to take the  
challenge and combine it with the password (which is not  
transmitted clear).  Thus the client cannot tell the server, 'this  
is user xxx, with password  hashed under session_id '.   It  
is the server that challenges the client with the session_id.  The  
attacker might collect enough samples so if a challenge repeats, he  
can have the answer ready, but that is unlikely with long enough  
challenges (and session_ids are long).


As for sending the session_id() from the server to the client in  
clear (not encrypted) it seems to me it doesn't make any sense to  
alter it in any way since, after all, you are also sending the  
algorithm in Javascript to the client, which is clear for anyone to  
see, so there would be no point in trying to hide the session_id in  
any way, and I don't think it would help the overall security.


My bank does use SSL, of course, and it still requires confirmation  
to do critical processes so, that might be a partial solution to  
spoofing.


Anyway, this is a poor man replacement for SSL, with limitations,  
but it is good to know what are those limitations.


Thanks for your help

Satyam



- Original Message - From: Evan Priestley [EMAIL PROTECTED]
To: Satyam [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, March 27, 2006 5:41 PM
Subject: Re: [PHP] protecting passwords when SSL is not available


This is called a nonce[1], and the method you've described will   
give you marginally less awful security than submitting a  
plaintext  password or an unadulterated hash of the password, but,  
obviously, is  in no way a 

[PHP] file_get_contents / url wrappers

2006-03-27 Thread Mike Dunlop

Hi gang,

If i am trying to read the contents of url into a string and I am  
getting 403 errors yet the page will load perfectly through a normal  
browser, do u think the site is looking at the http request headers  
and determining it's not a browser and thus blocking access? If  
something like that was happening, does anyone know what headers i  
should put into a request to simulate a browser?


error msg :: ... failed to open stream: HTTP request failed! HTTP/ 
1.1 403 Forbidden in ...


Any info is much appreciated.

Thanks - MD

...
Mike Dunlop
Director of Technology Development
[ e ] [EMAIL PROTECTED]
[ p ] 323.644.7808




RE: [PHP] file_get_contents / url wrappers

2006-03-27 Thread Shaunak Kashyap
It is possible that the site is rejecting the script since it is not a
browser. You can fake a browser by using the User-Agent header.

I am also going to take the liberty to suggest an alternate means to the
same end. If you are on a *nix system you can run the wget command to
connect to the site and retrieve the data. With the right options to
wget the user agent can be faked and the output be sent to stdout. Then
using output buffering you can capture the output to a string.

Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Direct: 323.330.9870
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is intended
only for the use of the intended recipient.  If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.


 -Original Message-
 From: Mike Dunlop [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 27, 2006 2:15 PM
 To: php-general@lists.php.net
 Subject: [PHP] file_get_contents / url wrappers
 
 Hi gang,
 
 If i am trying to read the contents of url into a string and I am
 getting 403 errors yet the page will load perfectly through a normal
 browser, do u think the site is looking at the http request headers
 and determining it's not a browser and thus blocking access? If
 something like that was happening, does anyone know what headers i
 should put into a request to simulate a browser?
 
 error msg :: ... failed to open stream: HTTP request failed! HTTP/
 1.1 403 Forbidden in ...
 
 Any info is much appreciated.
 
 Thanks - MD
 
 ...
 Mike Dunlop
 Director of Technology Development
 [ e ] [EMAIL PROTECTED]
 [ p ] 323.644.7808
 

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



Re: [PHP] mysql_fecth_array() and function call as parameter

2006-03-27 Thread Paul Goepfert
I finally got the function to work.  However I have a problem with
another function.  It is almost exactly like the origional function
but in this function I am determining the days instead of the month. 
I made the same changes to the days function as I did to the month
function.  However no value is being set to be returned. I can't find
my error. My function is below:

function determineDay ()
{
$return = ;
$query1 = mysql_query(SELECT months FROM Month WHERE m_id =
month(curdate()));
$query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum =
day(curdate()));
$query3 = mysql_query(SELECT year FROM Year WHERE year = 
year(curdate()));

$query1_data = mysql_fetch_assoc($query1);
$query2_data = mysql_fetch_assoc($query2);
$query3_data = mysql_fetch_assoc($query3);

switch ($query1_data[months])
{
case January:
case March:
case May:
case July:
case August:
case October:
case December:
if ($query2_data[dayNum] == 31)
$return .= SELECT dayNum FROM Days;
else
$return .= SELECT dayNum FROM Days 
WHERE dayNum = day(curdate()) +1;
break;
case February:
if ($query2_data[dayNum] == 28 || 
$query2_data[dayNum] == 29)
{
if ($query2_data[dayNum] == 28)
$return .= SELECT dayNum FROM 
Days WHERE dayNum = 28;
else
$return .= SELECT dayNum FROM 
Days WHERE dayNum = 29;
}
else
{
if (($query3_data[year] % 4 == 0) 
($query3_data[year] % 100
!= 0 || $query3_data[year] % 400 == 0))
$return .= SELECT dayNum FROM 
Days WHERE dayNum =
day(curdate()) +1 AND dayNum =28;
else
$return .= SELECT dayNum FROM 
Days WHERE dayNum =
day(curdate()) +1 AND dayNum =29;
}
break;
case April:
case June:
case September:
case November:
if ($query2_data[dayNum] == 30)
$return .= SELECT dayNum FROM Days 
WHERE dayNum = 30;
else
$return .= SELECT dayNum FROM Days 
WHERE dayNum =
day(curdate())+1 AND dayNum = 30;
break;
}
return $return;
}

Here is the code for where I output the contents of the query

$day = $this-determineDay();
$Day_query = mysql_query($day);
while ($a = mysql_fetch_assoc($Day_query))
{
$form .= option 
value={$a[dayNum]}{$a[dayNum]}/option\n;
}
$form .=   /select\n;

If anyone can find my error please let me know.  I have looked at this
for about an hour and I can't figure it out.

Thanks,

Paul
On 3/27/06, Brady Mitchell [EMAIL PROTECTED] wrote:
  I have done the following to my code hoping that the fix would work
 
  $query1 = mysql_query(SELECT months FROM Month WHERE m_id =
 month(curdate()));
  //echo $query1 . br /;
 
  $query1_data = mysql_fetch_assoc($query1);
echo $query1_data . br /;  returns Array
  (The word that is)

 Use:  print_r($query1_data) or var_dump($query1_data) to see everything
 in the array.  If you want to use echo, you'd have to echo each index of
 the array one at a time with something like:  echo $query1_data[0];

 http://php.net/echo
 http://php.net/print_r
 http://php.net/var_dump

  switch ($query1_data)
  {

 You can't switch on an entire array.  Switch is used to check the value
 of a variable (which could be an index of the array, but not the entire
 array).

 Something like this should work:

 switch($query1_data[months])
 {

 }

 http://php.net/switch

 In your original posting you have lines like the following in your
 switch statement:

  if($query2 == 31)

 As someone mentioned, mysql_query returns a resource ID, you then have
 to use mysql_fetch_assoc (or one of the other mysql_fetch_* functions)
 to get an array that you can use as you are trying to do.

 So after doing:  $query2_data 

[PHP] PHP|FLASH hit counter

2006-03-27 Thread Tom Haschenburger
Got this from a tutorial and I am not able to get this to work. 

Even when I download the finished files from the site I can't get it to
work. It definitely does its job on bringing in the variable but, it
never increments any higher from zero. It seems as though I maybe have a
problem with reading/writing files. Would someone mind taking a look and
see if this looks correct?

Using PHP 4.4.2

//FLASH
//instance of dynamic text box on stage with variable name count
//Frame1
this.loadVariables(counter.php?num=+random(99));

//Frame2
this.loadVariables(count.txt?num=+random(999));

//frame40
gotoAndPlay(2);


//PHP
?php
$count = file_get_contents(count.txt);
$count = explode(=, $count);
$count[1] = $count[1]+1;
$file = fopen(count.txt, w+);
fwrite($file, count=.$count[1]);
fclose($file);
print count=.$count[1];
?


Thanks,
Tom

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



Re: [PHP] $i vs. $r

2006-03-27 Thread Jasper Bryant-Greene

Kevin Murphy wrote:

Does anyone have a clue why using this code doesn't work:


Please specify what doesn't work means in this case :)


$i = 0;

while ($row = mysql_fetch_array($result))

{   
echo (Blah blah blah);

$i++;
}




$r = 0;

while ($row = mysql_fetch_array($result))

{   
echo (Blah blah blah);

$r++;
}


Those two blocks of code are for all intents and purposes identical, and 
indeed probably end up as exactly the same opcodes.


Jasper

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



[PHP] Text encoding

2006-03-27 Thread David . Martinez
Hi everybody.

I'm currently using a PHP script to download messages through a POP3 
connection (with fsockopen()). Messages are pooled and classified into my 
application (a help desk manager). As long as we use a lot of accents in 
spanish: á, é, í, ó, ú, ñ; those characters appears as =F1, =E9, =ED, =F3, 
etc. 

What type of encoding is it ?
Which PHP function should I use to decode it ?


Thanks in advance ! 

Re: [PHP] $i vs. $r

2006-03-27 Thread Kevin Murphy

Hello all

I simplified the code a bit, and I am guessing that it was too much.  
Below is the complete code that works fine. The weird part is, the  
part that I have the question on, is if I change $r to $i, it doesn't  
work anymore. $i doesn't count up as it should and instead gives me  
some unpredictible results. as it goes down the list sometimes  
its sequential (1,2,3 but never more than 3), other times its just  
the number 2 over and over).



$r = 1;

while ($row = mysql_fetch_array($website_result))
{
if (is_int(($r+2)/3))
{   echo (\ntr);}
echo (\ntd align=\center\ valign=\bottom\);

		include($site_path/common/code/directory_format_name.php); //  
Gets the name Formatter
		echo (\na href=\/directory/.$row['sup_link']./\img src=\/ 
images/directory/.$row['sup_picture'].\ border=\0\/a);
		echo (bra href=\/directory/.$row['sup_link']./\$full_name/ 
a);


echo (\n/td);

if (($r = $website_total) AND (is_int(($r+2)/3)))
{   echo (tdnbsp;/tdtdnbsp;/td/tr);   }
elseif (($r = $website_total) AND (is_int(($r+1)/3)))
{   echo (tdnbsp;/td/tr);  }   
elseif (is_int(($r)/3))
echo (\n/tr);

$r++;

}
echo (/table);


--
Kevin Murphy
Webmaster - Information and Marketing Services
Western Nevada Community College
www.wncc.edu
(775) 445-3326


On Mar 27, 2006, at 3:11 PM, Jasper Bryant-Greene wrote:


Kevin Murphy wrote:

Does anyone have a clue why using this code doesn't work:


Please specify what doesn't work means in this case :)


$i = 0;
while ($row = mysql_fetch_array($result))
{   echo (Blah blah blah);
$i++;
}



$r = 0;
while ($row = mysql_fetch_array($result))
{   echo (Blah blah blah);
$r++;
}


Those two blocks of code are for all intents and purposes  
identical, and indeed probably end up as exactly the same opcodes.


Jasper

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



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



Re: [PHP] $i vs. $r

2006-03-27 Thread Philip Hallstrom
I simplified the code a bit, and I am guessing that it was too much. Below is 
the complete code that works fine. The weird part is, the part that I have 
the question on, is if I change $r to $i, it doesn't work anymore. $i doesn't 
count up as it should and instead gives me some unpredictible results. as 
it goes down the list sometimes its sequential (1,2,3 but never more than 3), 
other times its just the number 2 over and over).



$r = 1;

while ($row = mysql_fetch_array($website_result))
{
if (is_int(($r+2)/3))
{   echo (\ntr);}
echo (\ntd align=\center\ valign=\bottom\);

include($site_path/common/code/directory_format_name.php);


I'm going to guess that $site_path/common/code/directory_format_name.php 
uses $i to do something else on it's own and is therefore messing up your 
$i.  At least that's where I'd start looking.




// Gets the name Formatter
		echo (\na href=\/directory/.$row['sup_link']./\img 
src=\/images/directory/.$row['sup_picture'].\ border=\0\/a);
		echo (bra 
href=\/directory/.$row['sup_link']./\$full_name/a);


echo (\n/td);
if (($r = $website_total) AND 
(is_int(($r+2)/3)))

{   echo (tdnbsp;/tdtdnbsp;/td/tr);   }
elseif (($r = $website_total) AND (is_int(($r+1)/3)))
		{	echo (tdnbsp;/td/tr);	} 
elseif (is_int(($r)/3))

echo (\n/tr);

$r++;

}
echo (/table);


--
Kevin Murphy
Webmaster - Information and Marketing Services
Western Nevada Community College
www.wncc.edu
(775) 445-3326


On Mar 27, 2006, at 3:11 PM, Jasper Bryant-Greene wrote:


Kevin Murphy wrote:

Does anyone have a clue why using this code doesn't work:


Please specify what doesn't work means in this case :)


$i = 0;
while ($row = mysql_fetch_array($result))
   {   echo (Blah blah blah);
   $i++;
   }



$r = 0;
while ($row = mysql_fetch_array($result))
   {   echo (Blah blah blah);
   $r++;
   }


Those two blocks of code are for all intents and purposes identical, and 
indeed probably end up as exactly the same opcodes.


Jasper

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



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



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



RE: [PHP] mysql_fecth_array() and function call as parameter

2006-03-27 Thread Brady Mitchell
 -Original Message-
 I finally got the function to work.  However I have a problem with
 another function.  It is almost exactly like the origional function
 but in this function I am determining the days instead of the month. 
 I made the same changes to the days function as I did to the month
 function.  However no value is being set to be returned. I can't find
 my error. My function is below:

snip

   switch ($query1_data[months])
   {
   case January:
   case March:
   case May:
   case July:
   case August:
   case October:
   case December:

Once again, in your switch statement you are checking for the full name
of the
month, but your query will be returning the month number.  Since you
don't have a default case on your switch statement, $return is never
being set, so  $day = $this-determineDay();  is not setting
$month to anything, which is why you are getting error messages.

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

Brady

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



Re: [PHP] Why Should I Use Zend Optimizer?

2006-03-27 Thread Ray Hauge
On Monday 27 March 2006 12:40, Richard Davey wrote:
 On 27 Mar 2006, at 19:10, [EMAIL PROTECTED] wrote:
  In short, Zend Optimise has *nothing* at all to do with 'making dumb
  programmers code better' I'm afraid.
 
  I'm not completely sure on this, and if it is true I don't have the
  links, but I think it does do one thing to make your code better.
  That is to use pre-increments wherever possible, since the
  post-increment requires the parser to store the value first then
  increment it (or something to that effect).  But even then it's really
  only saving you milliseconds of processing time, which would only make
  a beneficial improvement on an enterprise system (million-plus hits).

 Sorry I should have been more explicit - I meant it won't re-write
 your actual source code for you, which I believe is what the OP
 thought it was supposed to do (if only!)

 Cheers,

 Rich
 --
 http://www.corephp.co.uk
 Zend Certified Engineer
 PHP Development Services

Still right on with the pre-compiling though ;)  I find that the Optimizer has 
value.  If you wanted to cache on top of that you could probably speed it up 
even further with cached responses (APC or I think Zend has one too)

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] phpmailer subject line wierdness

2006-03-27 Thread Chris

Mark Steudel wrote:

I know that there is a phpmailer list, but it's pretty low volume, so I
hoped you all might have some ideas on this.
 
If I set the subject line for a mail like:
 
$mail-Subject = 'Jconnect Passover Registration Confirmation';
 
The email never send, but if I stick a letter between O and N it goes out:
 
$mail-Subject = 'Jconnect Passover Registration Confirmatioan';
 
Any ideas? Does the 'on' translate to some weird line end character? Can I

try and re-encode it or something?


Could be as simple as a spam filter grabbing it - check your mail logs 
to make sure it's getting that far.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] word matrix

2006-03-27 Thread Mike Dunlop
i have an array of various words and am looking to create a result  
array of every possible combination of words from the orig array. I'm  
not sure how to accomplish this elegantly within a for loop. Anyone  
have any ideas?



Thanks - Mike D



Re: [PHP] mysql_fecth_array() and function call as parameter

2006-03-27 Thread Paul Goepfert
according to my SQL the month name ois going to be returned not the
month number.

m_id is the number equivlent to the month.
months is the full name of the month.

In my month method I did not change the case values to the month
number and the function returns correctly.  All I had to do was add
the column name to $query1_data[] or $query2_data[]  But in this
method it didn't work.  I can't figure it out.  I've even checked my
column name to be sure I spelled it right.  It was.



On 3/27/06, Brady Mitchell [EMAIL PROTECTED] wrote:
  -Original Message-
  I finally got the function to work.  However I have a problem with
  another function.  It is almost exactly like the origional function
  but in this function I am determining the days instead of the month.
  I made the same changes to the days function as I did to the month
  function.  However no value is being set to be returned. I can't find
  my error. My function is below:

 snip

switch ($query1_data[months])
{
case January:
case March:
case May:
case July:
case August:
case October:
case December:

 Once again, in your switch statement you are checking for the full name
 of the
 month, but your query will be returning the month number.  Since you
 don't have a default case on your switch statement, $return is never
 being set, so  $day = $this-determineDay();  is not setting
 $month to anything, which is why you are getting error messages.

 http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html

 Brady


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



Re: [PHP] Text encoding

2006-03-27 Thread tedd

At 5:47 PM -0600 3/27/06, [EMAIL PROTECTED] wrote:

Hi everybody.

I'm currently using a PHP script to download messages through a POP3
connection (with fsockopen()). Messages are pooled and classified into my
application (a help desk manager). As long as we use a lot of accents in
spanish: á, é, í, ó, ú, ñ; those characters appears as =F1, =E9, =ED, =F3,
etc.

What type of encoding is it ?
Which PHP function should I use to decode it ?


David:

The encoding is Unicode code points.

00F1 is HEX for ñ
00E9 is HEX for é
00ED is HEX for í

and so on.

To decode, it's:

?php
$result = chr(hexdec(whatever HEX value));
echo $result;
?

However, to display it, you have to have a font 
capable of displaying the code point.


HTH's

tedd
--

http://sperling.com

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



Re: [PHP] Text encoding

2006-03-27 Thread tedd

At 5:47 PM -0600 3/27/06, [EMAIL PROTECTED] wrote:

Hi everybody.

I'm currently using a PHP script to download messages through a POP3
connection (with fsockopen()). Messages are pooled and classified into my
application (a help desk manager). As long as we use a lot of accents in
spanish: á, é, í, ó, ú, ñ; those characters appears as =F1, =E9, =ED, =F3,
etc.

What type of encoding is it ?
Which PHP function should I use to decode it ?



David:

After some thought, the chr() may be limited to 
ASCII, which ends at 7F (127 dec). You may be 
able to work with the Extended ASCII codes 
which go up to 255 -- however, the characters 
vary between OS -- thus the Extended ASCII 
because it's not really ASCII.


--- I previously said:

David:

The encoding is Unicode code points.

00F1 is HEX for ñ
00E9 is HEX for é
00ED is HEX for í

and so on.

To decode, it's:

?php
$result = chr(hexdec(whatever HEX value));
echo $result;
?

However, to display it, you have to have a font 
capable of displaying the code point.


HTH's

tedd
--

http://sperling.com

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



RE: [PHP] where php at?

2006-03-27 Thread tedd

At 11:26 PM +0200 3/27/06, Ryan A wrote:

Ooops, and lets not forget this one:

curl http://www.yoursite.com/path/to/script/yourscript.php

you can put that in your cron job by going to cpanel its a long way
round but sometimes it can be usefulyou should have CURL installed of
course.
The good thing about the above is it does not matter where the heck your php
is installed or if you have the shebang or not...

HTH again.

Cheers,
Ryan



Thanks Ryan, but that failed to work as well.

tedd
--

http://sperling.com

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



Re: [PHP] where php at?

2006-03-27 Thread Chris

tedd wrote:

At 11:26 PM +0200 3/27/06, Ryan A wrote:


Ooops, and lets not forget this one:

curl http://www.yoursite.com/path/to/script/yourscript.php

you can put that in your cron job by going to cpanel its a long way
round but sometimes it can be usefulyou should have CURL installed of
course.
The good thing about the above is it does not matter where the heck 
your php

is installed or if you have the shebang or not...

HTH again.

Cheers,
Ryan




Thanks Ryan, but that failed to work as well.


Are you getting errors emailed to you? What are they? If you're not, 
make sure you set the email address appropriately and then let us know 
what errors you get.


If you use the shebang method:

#!/path/to/php

make sure you set the file to executable - it should be 755.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] --enable-radius, not found

2006-03-27 Thread Chris

Mike Milano wrote:
I'm trying to compile PHP with radius enabled.  I have the pecl source 
and I can use other pecl extensions just fine.


When I type: cscript /nologo configure.js --help, I do not see any 
option for radius.


I've also tried to compile the dll by itself, but it is simply not found.

My system is WinXP using the platform SDK for Win2k to compile.  I get 
the same results compiling in VC7.


Any insight into what might be causing this would be greatly appreciated.


Can you try the binary?

http://pecl4win.php.net/list.php/5_1

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] word matrix

2006-03-27 Thread Chris

Mike Dunlop wrote:
i have an array of various words and am looking to create a result  
array of every possible combination of words from the orig array. I'm  
not sure how to accomplish this elegantly within a for loop. Anyone  
have any ideas?


Could you post a sample of what you have and what you want to end up with?

It'll be easier for us to work out rather than guess at what you're 
trying to do.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] where php at?

2006-03-27 Thread tedd

At 12:45 PM +1100 3/28/06, Chris wrote:

tedd wrote:

At 11:26 PM +0200 3/27/06, Ryan A wrote:


Ooops, and lets not forget this one:

curl http://www.yoursite.com/path/to/script/yourscript.php

you can put that in your cron job by going to cpanel its a long way
round but sometimes it can be usefulyou should have CURL installed of
course.
The good thing about the above is it does not matter where the heck your php
is installed or if you have the shebang or not...

HTH again.

Cheers,
Ryan




Thanks Ryan, but that failed to work as well.


Are you getting errors emailed to you? What are they? If you're not, 
make sure you set the email address appropriately and then let us 
know what errors you get.


If you use the shebang method:

#!/path/to/php

make sure you set the file to executable - it should be 755.


Chris:

No, I'm not getting anything emailed to me -- and I'm using this email address.

The file is executable and is set at 755.

Last night I was able to access a file, but the errors I received 
were first a permission thing, which I changed. Then I received a 
bunch of emails back as I tried to get the thing to work -- can't 
find directory and such.


But, I was not using anything like:

/usr/local/bin/php /full/path/to/myscript.php

but rather something like:

/home/tedd/public_html/e1.sh

where in the e1.sh file was php code.

However, after reading so much about doing the usr/local/... thing, I 
now can't get the /home/tedd/... thing to do anything.


I'm quilting for the night -- over 24 hours of fighting this nonsense 
-- but I thank everyone for their help (even the drunk). :-)


tedd
--

http://sperling.com

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



Re: [PHP] PHP|FLASH hit counter

2006-03-27 Thread Chris

Tom Haschenburger wrote:
Got this from a tutorial and I am not able to get this to work. 


Even when I download the finished files from the site I can't get it to
work. It definitely does its job on bringing in the variable but, it
never increments any higher from zero. It seems as though I maybe have a
problem with reading/writing files. Would someone mind taking a look and
see if this looks correct?

Using PHP 4.4.2

//FLASH
//instance of dynamic text box on stage with variable name count
//Frame1
this.loadVariables(counter.php?num=+random(99));

//Frame2
this.loadVariables(count.txt?num=+random(999));

//frame40
gotoAndPlay(2);


//PHP
?php
$count = file_get_contents(count.txt);
$count = explode(=, $count);
$count[1] = $count[1]+1;


echo or error_log $count[1] here - is it what you expect?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] where php at?

2006-03-27 Thread Chris

tedd wrote:

At 12:45 PM +1100 3/28/06, Chris wrote:


tedd wrote:


At 11:26 PM +0200 3/27/06, Ryan A wrote:


Ooops, and lets not forget this one:

curl http://www.yoursite.com/path/to/script/yourscript.php

you can put that in your cron job by going to cpanel its a long way
round but sometimes it can be usefulyou should have CURL 
installed of

course.
The good thing about the above is it does not matter where the heck 
your php

is installed or if you have the shebang or not...

HTH again.

Cheers,
Ryan





Thanks Ryan, but that failed to work as well.



Are you getting errors emailed to you? What are they? If you're not, 
make sure you set the email address appropriately and then let us know 
what errors you get.


If you use the shebang method:

#!/path/to/php

make sure you set the file to executable - it should be 755.



Chris:

No, I'm not getting anything emailed to me -- and I'm using this email 
address.


The file is executable and is set at 755.

Last night I was able to access a file, but the errors I received were 
first a permission thing, which I changed. Then I received a bunch of 
emails back as I tried to get the thing to work -- can't find directory 
and such.


But, I was not using anything like:

/usr/local/bin/php /full/path/to/myscript.php

but rather something like:

/home/tedd/public_html/e1.sh

where in the e1.sh file was php code.

However, after reading so much about doing the usr/local/... thing, I 
now can't get the /home/tedd/... thing to do anything.


Last thought.. add something like this:

echo I am in file  . __FILE__ .  at line  . __LINE__ .  at time  . 
date('r') . \n;


to the top of the script that is meant to be running.

Every time it runs it will email you.

If you don't get an email, get your host to check their logs to make 
sure it's being triggered properly.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



  1   2   >