[PHP] clear a mysql table

2008-10-25 Thread Ronald Wiplinger (Lists)
I need to clear a table (cache) from a database based on the database size.

Our web site uses cached pages. Our webhost only allow us 100 MB
storage. Usually the database is just 10 MB, but when a search engine
crawls our calendar, then the storage is quickly 108 MB. The system
reports then mathematically correct: Space left on database -8MB !!!

I plan therefore a web page, which is triggered by cron every hour and
will just clear the table.

Can I use just:
mysql_query(DELETE FROM cash)
or die(mysql_error());


or do I need to loop through all records? or is there a better solution?

How can I get the database size?

bye

R.


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



[PHP] Unsubscribe issues

2008-08-22 Thread Ronald Wiplinger
The guy who wrote the guide lines for unsubscribing must be a lawyer or so.

To make a page to find out where the unsubscribe link is in each kind of
email type is paranoid.
I mean the link is coming from the mail server, so just to say:

[EMAIL PROTECTED]


would be sufficient, wouldn't it?
Maybe some (other lawyer) could clean up that unsubscribe page.


(Replies would not reach me, save your energy!)

bye

Ronald


[PHP] syntax error

2008-07-21 Thread Ronald Wiplinger
On a system with php4 and mysql 4.x I had these lines:

require(../db-config); // includes $dbhost, $buname, $dbpass
$db = mysql_connect($dbhost, $dbuname, $dbpass);
mysql_select_db($dbname,$db);

$sql = SELECT * FROM CATEGORY WHERE .;
$result = mysql_query($sql,$db);
$num=mysql_num_rows($result);
while ($myrow = mysql_fetch_array($result)) {


Moving the *.php to a php5 and mysql 5.x site I get these errors:

PHP Warning:  mysql_num_rows(): supplied argument is not a valid MySQL
result resource in ...
PHP Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in ...


Looking at the manual, I cannot see what I am doing wrong.

bye

R.


[PHP] phpmyadmin

2008-07-10 Thread Ronald Wiplinger
I would like to use this time phpmyadmin (2.11.3) to setup for a new
user a database, which he can use to setup his own tables for his web site.

User abc should get his own database xyz.

I am not sure if I did it correct, and if it is safe to do so:

A
==
1. I created an empty database xyz (main page of phpmyadmin)
2. I added a new user on the Privileges page with:
User: abc
Host: Any (%)
Password: (yes)
Global privileges: 
(Data:) SELECT, INSERT, UPDATE, DELETE, FILE
(Structure:) CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES
(Administration:)(nothing ticked)
(Resource limits:)   (nothing ticked)

What does it mean so far? Can the user abc already access data of any
database?

B
==
I found Database-specific privileges for the user abc, where I added
the database xyz and ticked:
(Data:) SELECT, INSERT, UPDATE, DELETE
(Structure:) CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES
(Administration:)(nothing ticked)

What confuses me is that I have already some databases setup for my own
web, but none of the users has B attached.
Currently I am going away from a single person using the database to
allow others also to use the database.

Thanks for enlightening me.

bye

Ronald







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



[PHP] Image modifications

2008-05-25 Thread Ronald Wiplinger
I would like to find some samples to start with.

We want to upload a picture and the user may apply some filters or
instructions to create a new picture, based on the uploaded picture and
the available filters and instructions.

The idea of it is not really mature, since we have no idea where to start
and what is possible to do.

bye

R.


[PHP] scanned in manipulate to a pdf

2008-05-25 Thread Ronald Wiplinger
I got a Windows program, which can scan in a book by scanning in the pages
1,3,5, n  turn the book by 180 degrees and scan in from the back side
n-1,n-3, ... 2. Then the program made a pdf book of the scanned in pages.

I am not sure if a php program is the right way to do, but I thought to do
the same by scanning in the pages (p0001, p0002, p0003, .) and then work
on each page in a batch to turn p0001 by 180 degree and rename it to a0001,
rename p000(n-1) to a0002, turn p0002 by 180 degree and rename it to a0003

and add each page to a book.pdf

Is php right for that?

bye

Ronald


[PHP] Tool for programmer team

2008-01-21 Thread Ronald Wiplinger
What is a good tool to coordinate a team of programmers efficiently?

To give each one a different part of the project is a start, but it needs to
get combined at some points to be a working project.

Not to debug code you have written was a hint, to see actually bugs as a bug
and not as a feature.

Some hinted let programmer be on different places, others say put them
together on a big table, ...

Where can I find more information about that subject?

bye

R


[PHP] BBcode

2007-12-16 Thread Ronald Wiplinger
I tested BBcode (Pear extension) with that code:

if (!empty($_POST['bbcode'])) {
require_once 'HTML/BBCodeParser.php';
$parser = new HTML_BBCodeParser(parse_ini_file('BBCodeParser.ini'));
echo $parser-qParse($_POST['bbcode']);
}
?

form action=?php echo $_SERVER['PHP_SELF']; ? method=POST
textarea name=bbcode
?php echo @$_POST['bbcode']; ?
/textarea
input type=submit /
/form



it works!

I added it to a production page, by moving BBCodeParser.ini ouside of
htdocs directory. Added at the beginning of the php file:
require_once 'HTML/BBCodeParser.php';

and at the wished output:
echo TD bgcolor='yellow';
$parser = new HTML_BBCodeParser(parse_ini_file('../BBCodeParser.ini'));
echo FONT face=$FFACE color=$FCOLOR;
echo $parser-qParse($DB_DETAIL);
echo /TD;

I tested the input of my form with:
   [list] [*]normal [*][b]bold[/b] [*][u]underline[/u] [*][i]italic[/i]
[/list]
The database field in got these data, but the output on the screen is
also just:
   [list] [*]normal [*][b]bold[/b] [*][u]underline[/u] [*][i]italic[/i]
[/list]


What am I doing wrong?

bye

Ronald

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



Re: [PHP] BBcode - Solved

2007-12-16 Thread Ronald Wiplinger
I copied BBCodeParse.ini to the wrong place, 


Ronald Wiplinger wrote:
 I tested BBcode (Pear extension) with that code:

 if (!empty($_POST['bbcode'])) {
 require_once 'HTML/BBCodeParser.php';
 $parser = new HTML_BBCodeParser(parse_ini_file('BBCodeParser.ini'));
 echo $parser-qParse($_POST['bbcode']);
 }
 ?

 form action=?php echo $_SERVER['PHP_SELF']; ? method=POST
 textarea name=bbcode
 ?php echo @$_POST['bbcode']; ?
 /textarea
 input type=submit /
 /form



 it works!

 I added it to a production page, by moving BBCodeParser.ini ouside of
 htdocs directory. Added at the beginning of the php file:
 require_once 'HTML/BBCodeParser.php';

 and at the wished output:
 echo TD bgcolor='yellow';
 $parser = new HTML_BBCodeParser(parse_ini_file('../BBCodeParser.ini'));
 echo FONT face=$FFACE color=$FCOLOR;
 echo $parser-qParse($DB_DETAIL);
 echo /TD;

 I tested the input of my form with:
[list] [*]normal [*][b]bold[/b] [*][u]underline[/u] [*][i]italic[/i]
 [/list]
 The database field in got these data, but the output on the screen is
 also just:
[list] [*]normal [*][b]bold[/b] [*][u]underline[/u] [*][i]italic[/i]
 [/list]


 What am I doing wrong?

 bye

 Ronald

   

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



[PHP] checkbox unchecked

2007-12-02 Thread Ronald Wiplinger
I have now tried to add many of the security hints on a web page and
come to a problem.
I am checking if the allowed fields match the sent fields.
From the database I get the information if a checkbox is checked or not:

?php if($DB_a ==y) {
$checked=checked;
} else {
$checked=;
}
?
input type=checkbox name=R_a value=y ?php echo $checked ?


If the user takes out the checkmark the value will become  and the
field will not submitted which results in a missing field.

$allowed = array();
$allowed[]='form';
$allowed[]='R_a';
$allowed[]='R_b';

$sent = $array_keys($_POST);
if($allowed == $sent) {
... do some checking ...
} else {
echo Expected input fields do not match!;
}
break;


How can I force a n for not checked in the input field? or how can I
solve that?

bye

Ronald

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



Re: [PHP] checkbox unchecked

2007-12-02 Thread Ronald Wiplinger
Stephen wrote:
 Ronald Wiplinger wrote:
 How can I force a n for not checked in the input field? or how can I
 solve that?
   
 Either use radio buttons  or a drop down  for the input field.

Thanks!


 Stephen


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



Re: [PHP] Can I create flash via php?

2007-11-28 Thread Ronald Wiplinger
Jay Blanchard wrote:
 [snip]
 I want to create flash animations via a web page. Is it possible? What
 do I need. I do not want to use Windows 
 [/snip]

 STFW http://www.google.com/search?hl=enq=create+flash+using+PHP



   
Excellent link (and bet I tried that one before!!!),  can you please
help me to find the right page of the about 58,200,000 pages. (In words:
58 million 200 thousand)  ;-)

Thanks in advance!

bye

Ronald

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



[PHP] Can I create flash via php?

2007-11-27 Thread Ronald Wiplinger
I want to create flash animations via a web page. Is it possible? What
do I need. I do not want to use Windows 

bye

Ronald

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



[PHP] How to ask if private IP?

2007-11-25 Thread Ronald Wiplinger
I use $aa=$_SERVER[REMOTE_ADDR];

and

if(($aa==192.168.2.108) || ($aa==192.168.2.34)) {
$aa=61.64.101.101;// for testing put in a public IP   
}


However, I would like to cover all private IPs (192.168.x.x and 10.x.x.x
and 172.??.x.x). How can I do that simple?

bye

Ronald


[PHP] session_destroy AND reload a page

2007-11-25 Thread Ronald Wiplinger
If my user wants to logout, I want that the session will be destroyed
and that he must start with the first page again (index.php) and a new
session.

Whatever I try he always gets the old sessions or he does not come to
the first page.

How can I solve that?

bye

Ronald

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



[PHP] Should I put pictures into a database?

2007-11-20 Thread Ronald Wiplinger
I have an application, where I use pictures. The size of the picture is
about 90kB and to speed up the preview, I made a thumbnail of each
picture which is about 2.5 to 5kB.
I use now a directory structure of   ../$a/$b/$c/pictures

I wonder if it would be good to put the thumbnails into the current
table, in a different table or leave it like it is now. Same for the
pictures.

What is your opinion and why?

bye

Ronald

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



Re: [PHP] bank query and curl --- not important, skip it

2007-11-19 Thread Ronald Wiplinger
Stut wrote:
 Admin: Please don't reply directly to me. If you want to say
 something that you don't want to share with the group, don't bother.

 I did start replying to this email, but decided it wasn't worth it.
 Anyone who uses language like this does not deserve a response, but it
 made me chuckle so I thought I'd share it...

 [EMAIL PROTECTED] wrote:


I deleted the words but would replace it with:

Often it is not so important the contents of the message, but how to
pack it.
With the (deleted) words I believe future employers do not care which
certificate he has, but if you can work with him or not.

or short: Try to keep your job, maybe there is no other left for you.


bye

Ronald

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



[PHP] htmlentities()

2007-11-17 Thread Ronald Wiplinger
I tried to understand htmlentities by putting this code into a test.php:

?php
if(!$page) {
?
H3Test of evil input/H3

form method=post action=?php echo $PHP_SELF?

INPUT type=text name=field1 size=100 maxlength=100
INPUT type=hidden name=page value=1
INPUT type=submit name=submit value=Check it!
/form

?php
}
else
{
echo field1=$field1br;
$field2=htmlentities($field1,ENT_QUOTES,UTF-8);
echo field2=$field2p;
echo htmlentities($field1,ENT_QUOTES,UTF-8);

echo p;
$str = A 'quote' is bbold/b;

// Outputs: A 'quote' is lt;bgt;boldlt;/bgt;
echo htmlentities($str);
echo br;
// Outputs: A #039;quote#039; is lt;bgt;boldlt;/bgt;
echo htmlentities($str, ENT_QUOTES);

}
?



The output on the screen is:

field1=*Greater input and lower input*
field2=bGreater input and lower input/b

bGreater input and lower input/b

A 'quote' is bbold/b
A 'quote' is bbold/b


I expected that it would give me in the second line:
field2=lt;bgt;Greater input and lower inputlt;/bgt;

and the lower two lines I expected as:

A 'quote' is lt;bgt;boldlt;/bgt;
A #039;quote#039; is lt;bgt;boldlt;/bgt;


What do I miss understand here?

bye

Ronald

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



Re: [PHP] bank query and curl

2007-11-17 Thread Ronald Wiplinger
Stut wrote:
 [EMAIL PROTECTED] wrote:
 WHY! Would you even want to pull that data first off? It would be out
 dated as of the next transaction anyway.
 Secondly if you can curl the data from the server, and get your account
 information! I suggest you change banks.

Could it be that I try to use if a customer has paid?
WHY would that be wrong?


 With that attitude you'll end up keeping your money under your bed.
 Anything my browser can do curl can do.

 Bad decision I think to make this attempt. 

 Why? If Ronald decides to access *his* account using a method other
 than a browser, what is he doing wrong? The only downside to it is if
 he's storing his authentication credentials somewhere so it can be an
 automated process. Aside from that possibility I don't see the bad here.

 You can bet I will be watching your networks for an attempt on
 authentication failures.
 Because that request does not sound RIGHT to me.

 inetnum: 59.124.0.0 - 59.127.255.255
 netname: HINET-NET
 country: TW
 descr: CHTD, Chunghwa Telecom Co.,Ltd.
 descr: Data-Bldg.6F, No.21, Sec.21, Hsin-Yi Rd.
 descr: Taipei Taiwan 100


 Interland, Inc. MAXIM-NETBLK-1 (NET-216-65-0-0-1) 216.65.0.0 -
 216.65.127.255
 Poke Internet Services MAX-CUSTNET-348 (NET-216-65-86-0-1)
 216.65.86.0 - 216.65.86.255


NOW THAT is a strong word.

Are  you really a sysadmin? or are you just a worker in an IT firm?
Have you signed a contract? or are you anyway just the cleaner there?

I am not sure what are you trying to do here.
Is this a list about php?

It seems to me that you are from the http://veryevil.org site?
How many systems have you already hacked?
How many systems have you already damaged?
Are you proud of that?

Go to my website (easy to find it out which one, right?) There you will
find the bank account number and the bank name.
Good Luck! I wish you a happy jail term!!!


NO answer please. PLEASE no answer!
Please go back to your room and think at least ten times what you
actually told us now about yourself!

 Wow. Look everyone, he knows how to look up the owner of an IP
 address. Phear his mad sysadmin skillz!

 Seriously, I highly doubt Ronald is going to try anything against your
 systems. Just curious about something... what would you do if he did
 try something? Call your mother and have a little cry?

 -Original Message-
 From: Ronald Wiplinger [mailto:[EMAIL PROTECTED] Sent: Friday,
 November 16, 2007 11:38 PM
 To: PHP General list
 Subject: [PHP] bank query and curl

 I have a bank account and would like to query the last transactions.

 I can do that now via web and think that I can convert this procedure to
 a list of curl requests and finally put the result into a database on my
 server.
 Fortunately this bank account does not allow transactions, just viewing
 the account.

 Is there a guide available how to start this project?

 I would suggest the curl documentation. In order to duplicate what a
 browser does you basically just need to make sure you persist cookies
 between requests. Depending on what the site you're accessing does it
 may not be particularly trivial to do this. You may end up needing to
 parse each page that's returned to get the right URL to use for the
 next request, but it shouldn't get any more complicated than that.

I found in the meantime some code to play with. I also found a tutorial
I followed, but it was only to pull some web sites.
The challenge is to select so many things on the following pages.
 As I mentioned above I would strongly recommend that you do not store
 your authentication credentials anywhere. If you need this to be an
 automated system don't bother - it's not worth the risk.

That is the point I do not understand. Where is the risk? The bank
information is stored on the customers web site anyway, in order that
their user can pay. The only thing what is not there is the login
information.
I believe if we can use the out of the path credentials like we access
the sql server it should be same secure.

The bank does not allow transactions, it is only for viewing the last
100 days transactions.


 Oh, and don't underestimate the damage that can be caused by someone
 gaining access to this account. Just because you can't carry out
 transactions through the site doesn't mean the information it gives
 you access to can't be used for evil purposes.

 One last thing... you may find yourself getting blocked from the banks
 site if you make too many failed requests. You may want to pick
 another site while you learn how curl works.

Well, I will not try more than 3 times in a row with curl and than with
the browser. Thanks for the hint though.

bye

Ronald

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



[PHP] bank query and curl

2007-11-16 Thread Ronald Wiplinger
I have a bank account and would like to query the last transactions.

I can do that now via web and think that I can convert this procedure to
a list of curl requests and finally put the result into a database on my
server.
Fortunately this bank account does not allow transactions, just viewing
the account.

Is there a guide available how to start this project?

bye

Ronald

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



Re: [PHP] file_exists

2007-11-14 Thread Ronald Wiplinger
Chris wrote:
 Ronald Wiplinger wrote:
 I am having troubles with the function  file_exists()

 I tried the full path like:

 if (file_exists('/srv/www/../images/pic412.jpg') {
 echo IMG SRC='images/pic412.jpg';
 } else {
 echo nbsp;   //picture is missing!
 }

 No matter if I use the full path or just images/pic412.jpg, it always
 shows the picture is missing!


Sorry, I expressed it wrong.

The picture is displayed if it exists!
However, when the picture does not exist, then the missing file is not
recognized (hence the subject line file_exists)
With my if construction I try, if the picture does not exist, just to
echo nbsp;

(nbsp; is necessary for the table in which the picture would be displayed)


bye

Ronald



Re: [PHP] file_exists

2007-11-14 Thread Ronald Wiplinger
Stut wrote:
 Philip Thompson wrote:
 I've run into similar problems where I *thought* I was looking in the
 correct location... but I wasn't. Take this for example

 ?php // index.php?page=hello/hi
 $page = $_GET['page'];
 if (file_exists ($page.php)) {
 include ($page.php);
 }
 ?

 I really hope this is not a piece of production code. If it is then
 you might want to think very hard about what it's doing. If you still
 can't see a problem let me know!

Ok, I let you know! I don't see it!

I tried the full path like:

if (file_exists('/srv/www///htdocs/images/pic412.jpg')) {
echo IMG SRC='images/pic412.jpg';
} else {
echo nbsp;   //display space to make a table happy 
if picture is missing!
}


I also tried it with that line:
if (file_exists('/images/pic412.jpg')) {

or that line:
if (file_exists('images/pic412.jpg')) {


Basically I just want to avoid to show a missing picture ! If there is 
another solution for that problem I am happy too.

bye

Ronald

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



Re: [PHP] file_exists - this part is of topic

2007-11-14 Thread Ronald Wiplinger
Instruct ICC wrote:


 Called like this?

 index.php?page=http://evil-hacker-site.com/evil-payload.php

 And the browser will probably url_encode for me if needed.
 _
 Climb to the top of the charts!  Play Star Shuffle:  the word scramble 
 challenge with star power.
 http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
   

I do hope that some hackers will get a great jail sentence. Sometimes
the law takes a long time (see spamers get now also jailed).
I do not see any difference between a Terrorist sending people to
heaven with a bomb or by hacking or sending virus so that a company has
to lay off a lot of employees and so kills families over the time!


I had a bad experience!
20 years ago, when we had no Internet one of my employees brought a
floppy with a game to the office. The virus nested itself to the login
of the Novel network. First the virus played music with the internal
speakers. During that time you could not work. It was only once an hour!
Then the virus played 55 minutes per hour
To print a letter we had to run twice the only virus utility we got (per
mail!!!) to be able to print one document. After that the virus took
over again.

I had to take drastically measurements, and lay off 50% of my work force!
Nobody was happy about it.


No answer needed!

bye

Ronald

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



[PHP] Simple reading a file and extract fields

2007-11-13 Thread Ronald Wiplinger
I got a larger file which consists of lines with a defined length of 56
characters. Each line ends with a line feed (0A),

From each line I want one field from position 1 ~ 5 and field 2 from
position 7 ~ 46.

I tried:

$myFile = plaiso;
$fh = fopen($myFile, 'r');
$theDataLine = explode(\n,fgets($fh));

echo Field1Field2p; // headline

for($i=0;$icount($theDataLine);$i++){

$Field1 = substr($theDataLine[$i], 0, 5);
$Field2 = substr($theDataLine[$i], 7, 46);
echo $Field1 nbsp; nbsp; $Field2;
}

It prints only the headline and the first record.

What do I miss?

bye

Ronald

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



[PHP] Input field

2007-11-13 Thread Ronald Wiplinger
I added just into a input field

19 enclosure

which was displayed from the database as:

19\ enclosure


That gives me some questions:
1. where the protecting slash comes from?
2. how can I get it away when I want to display that field?
3. The slash is not to see in phpmyadmin, why not?

and:

1. what else do I need to take care with input fields and if they are
going to a mysql database?
2. can I use a function for that kind of protection for each field - or
even better just flag it in php to protect?
3. is HTTP_REFERER  session-id enough to make sure that no variables
can be injected?

bye

Ronald

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



[PHP] file_exists

2007-11-13 Thread Ronald Wiplinger
I am having troubles with the function  file_exists()

I tried the full path like:

if (file_exists('/srv/www/../images/pic412.jpg') {
echo IMG SRC='images/pic412.jpg';
} else {
echo nbsp;   //picture is missing!
}

No matter if I use the full path or just images/pic412.jpg, it always
shows the picture is missing!
The file exist there!

How can I do it?
I want that in case the picture is really missing, a blank will be shown.

bye

Ronald

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



Re: [PHP] Need a hint how to track an error

2007-11-12 Thread Ronald Wiplinger
Chris wrote:
 Ronald Wiplinger wrote:
 My php program is working with Firefox, but not with Internet Explorer.

 Nothing to do with php, your problem is javascript.

 Is there a tool to find the problem?

 For IE, try

 http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038displaylang=en



Why do you guys assume javascript

I am disappointed that after switching totally from XP to Ubuntu to
suggest me a Windows tool! I installed in a VirtualBox XP again and
above tool helped me to find the mistake:

?php echo $S_VALUEp/FONT;
}
?
form . 

The tool helped me to find the missing ``'' after /FONT   since it
showed me no value for the submit buttons.

Is there no other tool available that can find such errors? tool
webpage  error.list

bye

Ronald

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



[PHP] My first xml try

2007-11-09 Thread Ronald Wiplinger
I must use php 4 and mysql 4.x !

I tried an example I found on the net and modified it so that it should
work with php4 and mysql 4. The code is below.
I need to access a database and get an xml feed output.
I tried to use echo statements for debugging and found that it seems I
do not get the information of require().

What do I need to change?

bye

Ronald

|?
header(Content-Type: application/xml; charset=ISO-8859-1);

class RSS
{
function RSS()
{
require(../mysyql-config);
}

function GetFeed()
{
return $this-getDetails() . $this-getItems();
}


function getDetails()
{
$detailsTable = webref_rss_details;
$query = SELECT * FROM . $detailsTable;
$db = mysql_connect($dbhost, $dbuname, $dbpass);
mysql_select_db($dbname,$db);
$result = mysql_query($query, $db);
//echo dbhost=$dbhostbrdbuname=$dbuname;
while($myrow = mysql_fetch_array($result))
{
$details = '?xml version=1.0 encoding=utf-8 ?
rss version=2.0
channel
title'. $myrow['title'] .'/title
link'. $myrow['link'] .'/link
description'. $myrow['description']
.'/description
language'. $myrow['language'] .'/language
image
title'. $myrow['image_title'] .'/title
url'. $myrow['image_url'] .'/url
link'. $myrow['image_link'] .'/link
width'. $myrow['image_width'] .'/width
height'. $myrow['image_height']
.'/height
/image';
}
return $details;
}

function getItems()
{
$itemsTable = webref_rss_items;
$query = SELECT * FROM . $itemsTable;
$db = mysql_connect($dbhost, $dbuname, $dbpass);
mysql_select_db($dbname,$db);
$result = mysql_query ($query, $db);
$items = '';
while($myrow = mysql_fetch_array($result))
{
$items .= 'item
 title'. $myrow[title] .'/title
 link'. $myrow[link] .'/link
 description![CDATA['. $myrow[description]
.']]/description
 /item';
}
$items .= '/channel
 /rss';
return $items;
}

}

$rss = new RSS();
echo $rss-GetFeed();
?
|

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



Re: [PHP] Re: Sessionvariable

2007-11-07 Thread Ronald Wiplinger
Sebastian Hopfe wrote:
 Dear Ronald,

 I would like to ask you, want kind of session you use in you application.


I get information and put these information into a session variable,
like which language the page should be displayed. I have two frames on
that web page. One is the main page and one is a disclaimer. After a
while the disclaimer and then the main frame starts to fall back to the
default language.

I try from my desktop several browsers and so the information is in
different sessions almost the same.

I am doubting if the frames are the cause of vanishing SESSION information.

bye

Ronald

 regards
 Sebastian

 Ronald Wiplinger [EMAIL PROTECTED] schrieb im Newsbeitrag
 news:[EMAIL PROTECTED]
 I use at the first page a session variable to set a flag.

 After a few pages, or if somebody wait too long, the pages have another
 flag.

 I noticed that there are often more than one session file exist.

 How can I avoid that?
 How can I make sure that for one user is only one session file?

 bye

 Ronald 



-- 
Ronald Wiplinger  (CEO of ELMIT)
http://www.elmit.com  http://voip.elmit.com  http://ads.elmit.com 
Tel. (M) +886.939.775.516 (O) +886.2.2835.7765 (ENUM) 601*681 or FWD 511208
- I'm a SpamCon Foundation Member, #694, Verify it at http://www.spamcon.org

PS: Spam prevention!
Our system is protected with a spam prevention program. 
If you send us an e-mail, our system will send you a confirmation message back. 
Just reply to this confirmation message please. 
After receiving this confirmation message, our system will send the hold 
message (one) and all future messages (after the received confirmation message) 
to me without asking you again.

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



[PHP] Sessionvariable

2007-11-06 Thread Ronald Wiplinger
I use at the first page a session variable to set a flag.

After a few pages, or if somebody wait too long, the pages have another
flag.

I noticed that there are often more than one session file exist.

How can I avoid that?
How can I make sure that for one user is only one session file?

bye

Ronald

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



[PHP] Chinese input character count

2007-11-05 Thread Ronald Wiplinger
I thought I did it correct to define in the header:
meta http-equiv=Content-Type content=text/html; charset=utf-8
to display chinese characters correct. It works.

However, if you type in a form directly, than each character will be
translated to UTF-8 with a sequence of #; 
I could then count the numbers of # and had the amount of Chinese
characters.

Now I found that there are other Chinese characters in my database,
which I cannot read, but on the web they are displayed correct Chinesse.

How can I count these Chinese characters?

bye

Ronald

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



Re: [PHP] How to replace define in a require file with mysql?

2007-11-04 Thread Ronald Wiplinger
Jim Lucas wrote:
 Ronald Wiplinger wrote:
 I have a file linked with require into my program with statements like:

 define(_ADDRESS,Address);
 define(_CITY,City);

 I would like to replace this with a mysql table with these two fields
 (out of many other fields).

 How can I do that?

 bye

 Ronald

 Well, if you have all the settings in a DB already, then what I would
 do is this.

 SELECT param_name, param_value FROM yourTable;

 then

 while ( list($name, $value) = mysql_fetch_row($results_handler) ) {
 define($name, $value);
 }

 put this in place of your existing defines and you should be good.


Thanks! Works fine!
I need now a modification for that.

Two values:
SELECT param_name, param_value1, param_value2 FROM yourTable;

IF param_value1 is empty, than it should use param_value2

How can I add this?

Thank you again.

bye

Ronald

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



Re: [PHP] system command

2007-10-26 Thread Ronald Wiplinger

Instruct ICC wrote:

Use double quotes to get the value of $a or else you get the literal string 
$a.

$aa=system(lynx -dump http://api.hostip.info/country.php?ip=$a,$location);
or
$aa=system('lynx -dump http://api.hostip.info/country.php?ip='.$a,$location);


  

Thanks! 1st solution did not work for me, but the second one did.

I still have a problem with it. It prints the info to the page. Can I
suppress this somehow?



man lynx
?

I don't use lynx and I don't know what you mean by info to the page.
I tried
lynx -dump http://www.google.com
to try to see what you mean.

Maybe something to do with the last line (but I get several lines)
Return Values

Returns the last line of the command output on success, and FALSE on failure.

  


I have within a web page:
?php
$a=system('/usr/bin/lynx -dump http://api.hostip.info/country.php?ip='.$aa);
?
H1 .

later I pickup the variable $a again ...

The problem for me is that the line $a=system('/usr/bin/lynx -dump 
http://api.hostip.info/country.php?ip='.$aa);  prints (before H1) the 
result ($a). I need the variable within the program, but do not want to 
display it. It seems that 'system' includes an 'echo'


bye

Ronald

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



Re: [PHP] system command

2007-10-25 Thread Ronald Wiplinger

Instruct ICC wrote:


  

Date: Thu, 25 Oct 2007 09:43:14 +0800
From: [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: [PHP] system command

I tried:

$a=$_SERVER[REMOTE_ADDR];
echo pREMOTE_ADDR=$abr;
if($a=192.168.250.108) {
$a=61.64.101.101;
}


$aa=system('lynx -dump http://api.hostip.info/country.php?ip=$a',$location);
echo pa=$abraa=$aabrlocation=$locationbr;

$aa=system('lynx -dump 
http://api.hostip.info/country.php?ip=61.64.101.101',$location);

echo pa=$abraa=$aabrlocation=$locationbr;


I get:

REMOTE_ADDR=192.168.250.108
XX

a=61.64.101.101
aa=XX
location=0
TW

a=61.64.101.101
aa=TW
location=0


as you can see, if I put the IP address in, I get the right answer (TW).

What am I doing wrong?

bye

Ronald


Use double quotes to get the value of $a or else you get the literal string 
$a.

$aa=system(lynx -dump http://api.hostip.info/country.php?ip=$a,$location);
or
$aa=system('lynx -dump http://api.hostip.info/country.php?ip='.$a,$location);

  

Thanks! 1st solution did not work for me, but the second one did.

I still have a problem with it. It prints the info to the page. Can I 
suppress this somehow?


bye

Ronald

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



[PHP] system command

2007-10-24 Thread Ronald Wiplinger

I tried:

$a=$_SERVER[REMOTE_ADDR];
echo pREMOTE_ADDR=$abr;
if($a=192.168.250.108) {
   $a=61.64.101.101;
}


$aa=system('lynx -dump http://api.hostip.info/country.php?ip=$a',$location);
echo pa=$abraa=$aabrlocation=$locationbr;

$aa=system('lynx -dump 
http://api.hostip.info/country.php?ip=61.64.101.101',$location);

echo pa=$abraa=$aabrlocation=$locationbr;


I get:

REMOTE_ADDR=192.168.250.108
XX

a=61.64.101.101
aa=XX
location=0
TW

a=61.64.101.101
aa=TW
location=0


as you can see, if I put the IP address in, I get the right answer (TW).

What am I doing wrong?

bye

Ronald

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



[PHP] Thoughts on multiple servers

2007-10-22 Thread Ronald Wiplinger
At current stage I have two servers installed, whereby the first one 
does all, but the second is a database server.


I need to install on different location a server pair, which should work 
together, fail-fall-over, ...


The idea is to have in the dns for the servers:

abc.example.com == general term
tw.abc.example.com== redirected to, if the user is closer to Taiwan
de.abc.example.com== redirected to, if the user is closer to Germany

abc will be in my office (10Mbps), tw.abc  de.abc are server 
co-location with each 150 Mbps.


The database server is connected to the web server via second Ethernet 
port and a private IP (192.168.x.x) via cross over cable.
The other ethernet port of the web server is connected to the Internet 
(either through another ADSL, like at my office) or to like the web 
server directly to the Internet HUB.
The mySQL servers should be set-up as a cluster server and should work 
together within a VPN.


Questions:
1. Any hints on above configuration?
2. Has anybody experience with a cluster mysql?
3. How to get the web servers working with the closest connection 
(according to the users IP) ?
4. How do I get info about the users IP (within the web server) to 
provide startup settings, like Time zone  so time of the user, 
language, country, ... ?
5. How to make it fail-fall-over if one of the server (web and/or 
database server!) is not working?


Thanks for you input!

bye

Ronald

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



[PHP] Php generated html email

2007-10-22 Thread Ronald Wiplinger

How can I create a html email directly from a web page via Php?
The page will include tables, background colors and pictures within the 
tables. The received email should be readable without Internet 
connection (pictures, must be sent with the email)



bye

Ronald

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



[PHP] picture upload within a form

2007-10-19 Thread Ronald Wiplinger

I have a form, where I upload a picture and a corresponding text.

Is it possible to have a form (upload picture) within a form (text)?
As I have it now, the submit button just does nothing.

bye

Ronald  


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



[PHP] How to display ALL session variables?

2007-10-18 Thread Ronald Wiplinger
Is there a simple way to display all session variables? Like the code 
below I use in debug for all posted variables:


echo h3posted variables/h3;
 while (list($name, $value) = each($HTTP_POST_VARS)) {
   echo $name = $valuebr\n;
 }

bye

Ronald

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



Re: [PHP] How to display ALL session variables?

2007-10-18 Thread Ronald Wiplinger

[EMAIL PROTECTED] wrote:



2007/10/18, Nathan Nobbe [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]:


On 10/18/07, Ronald Wiplinger [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:

 Is there a simple way to display all session variables? Like the
code
 below I use in debug for all posted variables:


echo 'pre';
var_dump($_SESSION);
echo '/pre';

-nathan


or use print_r($_SESSION);




I tried:
?php
echo 'pre';
var_dump($_SESSION);
echo '/pre';
echo 'pabove as var_dump(D_SESSION) - below as print_r(D_SESSION)';
print_r($_SESSION);

...

However, I only see:

above as var_dump(D_SESSION) - below as print_r(D_SESSION)

What is the obviously part I am missing?

bye

Ronald

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



Re: [PHP] How to display ALL session variables? - solved

2007-10-18 Thread Ronald Wiplinger

Ronald Wiplinger wrote:

[EMAIL PROTECTED] wrote:



2007/10/18, Nathan Nobbe [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]:


On 10/18/07, Ronald Wiplinger [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:

 Is there a simple way to display all session variables? Like the
code
 below I use in debug for all posted variables:


echo 'pre';
var_dump($_SESSION);
echo '/pre';

-nathan


or use print_r($_SESSION);




I tried:
?php
echo 'pre';
var_dump($_SESSION);
echo '/pre';
echo 'pabove as var_dump(D_SESSION) - below as print_r(D_SESSION)';
print_r($_SESSION);

...

However, I only see:

above as var_dump(D_SESSION) - below as print_r(D_SESSION)

What is the obviously part I am missing?


Found it:   The session was at that moment not open!

bye

Ronald

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



Re: [PHP] How to display ALL session variables?

2007-10-18 Thread Ronald Wiplinger

Nathan Nobbe wrote:

this is a nice little tool as well;
it would be pretty decent for spitting out the session;

http://dbug.ospinto.com/

new dBug($_SESSION);

-nathan
  


That is really cool!   I like that one!

bye

Ronald

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



[PHP] I am looking for a color picker working also in Firefox

2007-10-18 Thread Ronald Wiplinger
I found many nice color picker (True color), which are working fine in 
IE, but I need one, which works also in Firefox.

Can you give me a recommendation, please?

bye

Ronald

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



Re: [PHP] Re: I am looking for a color picker working also in Firefox

2007-10-18 Thread Ronald Wiplinger

Colin Guthrie wrote:

Ronald Wiplinger wrote:
  

I found many nice color picker (True color), which are working fine in
IE, but I need one, which works also in Firefox.
Can you give me a recommendation, please?



http://www.iosart.com/firefox/colorzilla/

I couldn't get it to work on my Linux FF tho', but I'm guessing it
shoudl work OK on linux.

Col

  


Sorry, I did not ask clear!

I need a color picker within my php web page. The user should be able to 
pick a color, which is then entered into a form field. All Java color 
picker I found do nothing under Firefox and also says so, that they only 
work with Internet Explorer.


bye

Ronald

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



[PHP] Need a hint how to use an anker on the next page

2007-10-18 Thread Ronald Wiplinger
I have a long page (form), where the user has to return to the place he 
left last time, or where in that page a question has not been answered.


Example:

Tell me the German word for: Your answer:

1. dogHund
2. cat  Katze
3. rose
4. car Auto


in the example the third one has not been answered, by returning to that 
page the display start nearby 3. rose.


bye

Ronald

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



[PHP] How to replace define in a require file with mysql?

2007-10-17 Thread Ronald Wiplinger

I have a file linked with require into my program with statements like:

define(_ADDRESS,Address);
define(_CITY,City);

I would like to replace this with a mysql table with these two fields 
(out of many other fields).


How can I do that?

bye

Ronald

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



[PHP] How to replace define in a require file with mysql?

2007-10-17 Thread Ronald Wiplinger

I have a file linked with require into my program with statements like:

define(_ADDRESS,Address);
define(_CITY,City);

I would like to replace this with a mysql table with these two fields
(out of many other fields).

How can I do that?

bye

Ronald

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



Re: [PHP] Re: Opening a file

2007-09-06 Thread Ronald Wiplinger
On Wed, 2007-09-05 at 10:29 -0400, Dan Shirah wrote:
 Correction, I am now getting this error:
 
 PHP Warning: file(fruits.txt)
 [function.filehttp://develop1/credit%20card%20processing/function.file]:
 failed to open stream: No such file or directory
 PHP Warning: in_array()
 [function.in-arrayhttp://develop1/credit%20card%20processing/function.in-array]:
 Wrong datatype for second argument
 
 But the file IS in the same folder.

does ls -l   give  you the answer?  (Does your web server has permission
to read the file?)

bye

Ronald

 
 
 On 9/5/07, Dan Shirah [EMAIL PROTECTED] wrote:
 
  Good Morning!
 
  Opening this file is proving to be a pain. I have a folder that contains a
  PHP page and a text file. I am trying to open the contents of the txt file
  using file() but it keeps erroring out. Below is the code I'm using to try
  and open it:
 
  ?php
  $fruit = apple);
  $lines = file(fruits.txt);
  if (in_array($fruit,$lines))
{
$a = Y;
}
  ?
 
  So, I'm setting my variable, opening my file as an array in $lines, then
  checking to see if my variable is in the array, and if it is, assign a value
  ot a new variable.  However, I am getting the following error:
 
  PHP Warning: in_array() 
  [function.in-arrayhttp://develop1/credit%20card%20processing/function.in-array]:
  Wrong datatype for second argument
 
  Any ideas?
 

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



Re: [PHP] Re: Which CAPTCHA is the besta?

2007-09-01 Thread Ronald Wiplinger

Hamza Saglam wrote:
Not a script you can install/hack but why don't you have a look at: 
http://recaptcha.net/ ?


  


I am going to try that one. It sounds good and gives me a feeling to do 
something good to the community as well.

Which version have you tried? Java or PHP? How to set-up PHP?

Some people say that captcha is just to bother humans, while the robots 
are learning faster to deal with it!


bye

Ronald

Regards,
Hamza.


Tony Di Croce [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
  

I need a CAPTCHA script Which one is the best? (I dont mind if its
somewhat difficult).




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



[PHP] How to implement Open-ID on my web server?

2007-08-31 Thread Ronald Wiplinger

Hi,

I am looking for a way to implement OpenID on my webserver. Can anybody 
point me on ONE place that describes ONE way, please!


I found many links, but I am now confused what I really need ;-(

I want that the customer can use his/her openid to login to signup/login 
to our web sites. Herby the user should get the choice to use some of 
the Open-ID preset field values to complete the signup process faster.


Thanks!

bye

Ronald

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