[PHP] Re: What Works Works Validator

2005-06-02 Thread JB05UK
A small example, using the code below all older browser who cant 
understand CSS will ignore it because its within a comment block...






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



[PHP] Re: what is -- $this variable -> $this other variable -- means?

2005-06-02 Thread JB05UK

http://php.net/manual/en/language.oop.php

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



[PHP] Re: php forum and (almost certainly 0T) client editor

2005-06-02 Thread JB05UK

Hello, I can answer your second question...

Frames can be used to achieve the effect of two seperate windows, one 
can refresh while the other stays as-is.


For a client editor...
Some javascript to add tags on the client side would be fairly simple to 
create, just create some custom tags for display to clients then when 
submitted use PHP's str_replace function to search for your custom tags 
then replace with some HTML before it hits the forums,



James





Ryan A wrote:

Hey guys (and girl...as we have one on the list...(that i know of)),

Can anybody recommend a real bare bones forum that i can modify
or
a tutorial for creating a forum
or
URLs/Classes etc to help me create a simple forum?

I checked on google but I couldnt find any tutorials or code, went to
hot-scripts and saw a   _c r a p l o a d_ of forums (for free and otherwise)
but I have a client who insists I build him a forum which must fall
_exactly_
to his specifications and work of our currently registered users database.

Worse scenario, I will dl a few of the forums from hotscrpts and go through
each of their code...but I would like to avoid that if anyone can give me a
better option.



2nd question
I will need a kind of "client editor" for when people write their messages
into the forum,
eg: make this bold and that italics and that centered and that with an image
and so on
I had actually seen a (dhtml, I think) form some time back where you could
preview your
message at the side as you made changes...somewhat like what google has for
their
ad-cents accounts where you can change the colors of your ad and immediatly
it shows the
changes at the side in a box.
I remember sometime back someone posting some WYSIWYG kind of editors which
loads
on the clients machine with just a textbox and the buttons to go bold,
italics,centered etc
unfortunatly looking into the archives i cant find it.

Thanks,
Ryan





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



[PHP] Re: Can't Get PHP to work

2005-06-02 Thread JB05UK
 You need to insert these two lines to your Apache httpd.conf 
configuration file to set up the PHP module for Apache 2.0:


Example 6-6. PHP and Apache 2.0 as Module


# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

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













Subscriber wrote:

Hi,

I sure hope someone here can help me.  I spent the entire day yesterday 
and most of the evening setting up a webserver on my Windows 2000 Pro 
system. 
I've got PHP 5.04, MySQL 4.1.12, ActivePerl 5.8.6, Java Runtime 
Environment, Tomcat 5.5.9, ZendOptimizer 2.5.10, MyODBC 3.5.11 and 
phpMyAdmin 2.6.2 all installed.


 From what I can tell, all is working well except PHP and phpMyAdmin.

I added PHP to my path like this:

C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\php;C:\Apache2\bin;C:\mysql\bin;C:\php\dlls;C:\Program 
Files\Common Files\Ulead Systems\MPEG;"C:\Program Files\Zone 
Labs\ZoneAlarm\MailFrontier"


I've got a copy of php.ini in both my c:/php directory and in 
c://winnt.  I've listed my user directory as c:/apache/apache2/htdocs 
and I've placed phpmyadmin in htdocs.


But when I try to view a php page I get an error or page cannot be 
displayed.  On a couple of occassions I viewed the raw php data in my 
browser.


Also, when I try to add a php extension using "LoadModule" in my 
httd.conf file I get an error loading Apache telling me that "the file 
cannot be found" (but I've verified it exists - like php5apache.dll and 
php5ts.dll).


Can someone please help me figure out where I'm screwing up at?

Thanks in advance!

Edited to say I'm getting Closer!!!

Now when I go to 
[url=http://localhost/phpmyadmin]http://localhost/phpmyadmin[/url] I get 
the following info:


cannot load mysqli extension;
please check PHP configuration
[u]Documentation[/u]

And the documentation says:
[b][1.20] I receive the error "cannot load MySQL extension, please check 
PHP Configuration". [/b]To connect to a MySQL server, PHP needs a set of 
MySQL functions called "MySQL extension". This extension may be part of 
the PHP distribution (compiled-in), otherwise it needs to be loaded 
dynamically. Its name is probably mysql.so or php_mysql.dll. phpMyAdmin 
tried to load the extension but failed.


Usually, the problem is solved by installing a software package called 
"PHP-MySQL" or something similar.


I have tried using both mysql and mysqli in config.inc.php (phpmyadmin 
config file) and either way I get the same error message.  And in 
php.ini I have enabled the following extensions:


extension=php_mysql.dll
extension=php_mysqli.dll



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



[PHP] Re: headers and session

2005-06-06 Thread JB05UK

You have two calls to header?


The first should be changed to:-

session_cache_limiter('private');

http://php.net/manual/en/function.session-cache-limiter.php




Alessandro Rosa wrote:

Hi to all,

I got a problem while storing session variables.



After the call to header(...), the values of session variables are lost.

I think I should fix this up with some settings in my php.ini

Could you help me, please?

Alessandro Rosa


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



Re: [PHP] PHP and Zend

2005-06-06 Thread JB05UK

Ok thanks



Richard Lynch wrote:

On Sun, June 5, 2005 12:08 am, JamesBenson said:


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

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



I think you've just done it right.

Note that the version numbers are for distinctly different Zend products:

Engine
Extension Manager
Optimizer

Zend is kind enough to inform you of all of these, which is a Good Thing.

Unless there is something inherently wrong with the versions mis-matching
I'm not aware of, you have nothing to fix. :-)

I could be sarky and suggest you un-install the ones you don't want :-)



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



[PHP] Re: headers and session (2)

2005-06-06 Thread JB05UK
Ahhh, for storing session passwords...if you really need to store a 
password in the session then try using md5, like so...


$psw = md5($_POST['txtPassword']);


Then to verify a users password just do the same and compare to the 
stored md5 value in your database.


But, its a very bad idea storing passwords in your sessions full stop if 
using a shared server.




James





Alessandro Rosa wrote:

I want to thank you all for previous helpings.

Really the first code was easy to be solved, but
this is how it shall work out. This is a program running
locally and the trouble is that session vars are stored
in local files. I must avoid to store a plain text password
therein, thus I need to crypt and save it into session.

When 2.php file just displays session data (it is test environemnt),
but the output is blank !

Suggest a different approach ?

Alessandro Rosa
 





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



Re: [PHP] linux php editor

2005-06-06 Thread JB05UK


Clive Zagno wrote:
> what I really want is a app that can do that predictive text thing, you
> know when it start showing me the possible php syntax as Im typing it
> in. Two reasons for this is it help with debugging as I get the syntax
> correct the first time and secondly I think its cool.




Bluefish does that for HTML so it could be extended to PHP, I use it on 
Fedora and like it so far, color highlighting etc







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



[PHP] Re: protect file access outside webroot

2005-06-06 Thread JB05UK


Bosky, Dave wrote:


Currently I upload them the htsdata directory, is this the best
location? 




Any location outside your webroot is fine.

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



[PHP] Re: retreiving postal/zip codes with PHP

2005-06-14 Thread JB05UK
ive used royal mail before for my ebay sales, they give so many lookups 
per day for free, not enough for a website to use,
im not sure any other service would be accurate or free but let us know 
if you do find any which are because I need something like this also.





I. Gray wrote:

Hi.

I was wandering whether anyone knew how i can use php to retrieve info 
from a postal code (probably mainly in the UK) so that when a person 
enters the post code it comes up with the address or I can do other 
things with the info.  Is there a php class that can do this? Would I 
need to use a database of postal info? If so are there any (preferably 
free) ones?


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



[PHP] Re: SFTP problems

2005-06-20 Thread JB05UK
Read the php man, it says to use the 'b' flag for binary files, infact 
it says to use it most the time anyway, if im not mistaken.




Lowell Allen wrote:
I need to use SFTP to send text files and binary files from one server 
to another, but I'm unable to use fopen on the remote server, and if I 
send with ssh2_scp_send the files are truncated. I'm assuming the 
libssh2-PECL/ssh2 installation isn't the problem because I'm able to 
connect using ssh2_auth_password, create a directory on the remote 
server with ssh2_sftp_mkdir, and copy files with ssh2_sftp_send and 
ssh2_sftp_recv (even though ssh2_sftp_send truncates files).


When I try to use fopen, I get this error message:

Warning: fopen(): Unable to open ssh2.sftp://Resource id 
#10/whatever.com:22/home/whatever/public_html/flamingo/test.txt on 
remote host in /home/user/public_html/cms/sftp_test.php on line 79


Warning: fopen(ssh2.sftp://Resource id 
#10/whatever.com:22/home/whatever/public_html/flamingo/test.txt): failed 
to open stream: Resource temporarily unavailable in 
/home/user/public_html/cms/sftp_test.php on line 79


Here's line 79 of sftp_test.php:

$stream = 
fopen("ssh2.sftp://$sftp/whatever.com:22/home/whatever/public_html/ 
flamingo/".$filename, "wt")


I've read "Secure Communications with PHP and SSH" in the February PHP 
Architect. That's what prompted me to try PECL/ssh2, but now I'm stuck. 
Anybody successfully using fopen with SFTP or anybody using 
ssh2_sftp_send without getting truncated files?


--
Lowell Allen


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



[PHP] Re: MYSQLI, Class not found?

2005-06-21 Thread JB05UK

Try placing the following into a .php file,





If that fails you either dont have a mysql server or PHP was not 
compiled with mysql support, see here for instructions 
http://php.net/manual/en/ref.mysql.php








[EMAIL PROTECTED] wrote:
 
Hey guys,
 
 I'm doing a tutorial from a book (PHP and MySQL Web Development) and  I'm 
having a problem... when I use the script they supply I get this  error:
 
 
Fatal error: Class 'mysqli' not found  in 
C:\apachefriends\xampp\htdocs\results.php on line 29 
 
here is the code:
 
 
===

 
// create short variable  names

$searchtype=$_POST['searchtype'];
$searchtype=$_POST['searchterm'];
 
$searchterm= trim($searchterm);
 
if (!$searchtype || !$searchterm)

{
echo 'You have not  entered search details. Please go back and try  again.';
exit;
}
 
if (!get_magic_quotes_gpc())

{
$searchtype=  addslashes($searchtype);
$searchterm=  addslashes($searchterm);
}
 
$db = new mysqli('localhost', 'root', 'root', 'bookorama');
 

//$db = mysql_connect('localhost', 'root', 'root');  // tried  this way, no 
luck

//mysql_select_db("bookorama", $db);
 
if(mysqli_connect_errno())

{
echo 'Error: Could not connect  to the Database. Please try again later.';
exit;
}
 
$query = "select * from books where ".$searchtype." like  
'%".$searchterm."%'";

$result = $db->query($query);
 
$num_results = $result->num_rows;
 
echo 'Number of books found:  '.$num_results.'';
 
for ($i=0; $i <$num_results; $i++)

{
$row =  $result->fetch_assoc();
echo ''.($i+1).'.  Title: ';
echo  htmlspecialchars(stripslashes($row['title']));
echo  'Author: ';
echo  stripslashes($row['author']);
echo 'ISBN: ';
echo  stripslashes($row['isbn']);
echo 'Price: ';
echo  stripslashes($row['price']);
echo '';
}
 
$result->free();

$db->close();
 
?>
 



 
===
 
I updated PHP from 5.0.3 to 5.0.4 to see if it would help, no luck.
 
Now I'm just completely lost.
 
Thanks,
 
Clint





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



[PHP] Re: GD library images not displaying

2005-06-21 Thread JB05UK

Found this in the PHP manual,


To enable GD-support configure PHP --with-gd[=DIR], where DIR is the GD 
base install directory. To use the recommended bundled version of the GD 
library (which was first bundled in PHP 4.3.0), use the configure option 
--with-gd. GD library requires libpng and libjpeg to compile.


In Windows, you'll include the GD2 DLL php_gd2.dll as an extension in 
php.ini. The GD1 DLL php_gd.dll was removed in PHP 4.3.2. Also note that 
the preferred truecolor image functions, such as imagecreatetruecolor(), 
require GD2.






So, why not try upgrade your PHP version.

James



Ross Trewhella wrote:


Hi,

I am running Apache 2.0 with PHP 4.2.11 on Windows XP.
I installed php_gd2.dll by uncommenting extension=php_gd2.dll and making sure 
that the file was in my extension_dir.
I restarted Apache and didn't get an error, so assumed it was working.
When I run my example code:

$im = imagecreatetruecolor (300, 200); 
$black = imagecolorallocate ($im, 0, 0, 0); 
$white = imagecolorallocate ($im, 255, 255, 255); 
imagefilledrectangle($im,0,0,399,99,$white); 
imagerectangle($im,20,20,250,190,$black); 
header ("Content-type: image/png"); 
imagepng ($im);

?>

I get the following error:

Fatal error: Call to undefined function: imagecreatetruecolor() in 
imagetest.php on line 2

This code works on other servers, so where have I gone wrong in my installation 
of GD?

Thanks in advance,

Ross
 



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



Re: [PHP] Re: So many returned mail notices!

2005-06-21 Thread JB05UK

Chris W. Parker wrote:

JamesBenson 
on Tuesday, June 21, 2005 8:41 AM said:



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



No.



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

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



Your point is?




My point is if you dont like spam do something about it, clearly your 
too ignorant to understand.


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



[PHP] Re: Re-inserting newlines

2005-06-23 Thread JB05UK
This is the correct way to make a safe mysql query, see if it makes a 
difference, taken from:- 
http://php.net/manual/en/function.mysql-real-escape-string.php














Philip Thompson wrote:

Hi all.

I have searched for a way to figure out this problem, but nothing is  
popping up. Here's the scenario:


I have a form which I will write to a database - so I escape the form  
content. I have a  in the form. Obviously,  people 
can type whatever they want to in this textarea, including  newlines. 
Ok, I know how to escape the content to put it in the  database - but if 
there is an error on the page, I want to redirect  back to the page and 
correct their stuff.


So they have in one of the textareas:

--- start here ---
This is a line in the text area.

This is a line a couple of lines down in the text area.
--- end here ---

If I print the stuff back out to screen, it reads:

--- start here ---
This is a line in the text area.\r\n\r\nThis is a line a couple of  
lines down in the text area.

--- end here ---

Anyone know how/what to replace the \r\n in the textarea to that it  
shows up correctly with the actual newlines, not the \r\n???


Thanks in advance,
~Philip


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