php-general Digest 9 Feb 2002 21:25:49 -0000 Issue 1162

Topics (messages 84092 through 84138):

Dll on Visual Basic
        84092 by: Edgardo Rossetto

Script breaks connection?
        84093 by: Cedric Ancellin

file upload and change name
        84094 by: will hives

Help with query
        84095 by: Daniel Alsén
        84096 by: Bas Jobsen
        84097 by: val petruchek
        84098 by: Daniel Alsén

One more quickie
        84099 by: Daniel Alsén
        84100 by: val petruchek
        84101 by: Edward van Bilderbeek - Bean IT
        84102 by: Dennis Moore

Re: attachment problem
        84103 by: Analysis and Solutions

Well I made it work...but
        84104 by: cyberskydive

Any way to protect cookies?
        84105 by: Leif K-Brooks
        84107 by: Arik Ashepa

Re: Exact string replacement...
        84106 by: cyberskydive
        84120 by: liljim

I'm new here is there.....
        84108 by: cyberskydive
        84124 by: CC Zona

Modifying a record works but not in actual database?
        84109 by: lmlweb.mybc.com
        84113 by: Jason Wong
        84116 by: lmlweb.mybc.com
        84121 by: Jason Wong
        84136 by: Paul Roberts

Console, colors and stuff
        84110 by: Richard
        84125 by: Alan McFarlane
        84133 by: Richard

ok still want to join a project...
        84111 by: Arik Ashepa
        84112 by: Jason Wong
        84114 by: Arik Ashepa
        84119 by: Nick Wilson
        84137 by: DL Neil

Age
        84115 by: André Felix Miertschink
        84127 by: Edward van Bilderbeek - Bean IT

forms page
        84117 by: Ronald D Wahlen

free usefull piece of code for everybody!
        84118 by: Arik Ashepa
        84123 by: Jason Wong

Table exists?
        84122 by: Nick Wilson
        84126 by: Martin C. Petersen
        84128 by: Nick Wilson
        84131 by: CC Zona
        84134 by: Nick Wilson

rating system
        84129 by: Wolfram Kriesing

mysql_select_db() problem
        84130 by: Nick Wilson
        84132 by: Jeff Sheltren
        84135 by: Nick Wilson

Re: ssl
        84138 by: Frank Hertogs

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi,

Basically, what I want to do is call php4ts.dll (or whatever) to use
highlight_string/file function on Visual Basic and return it on a
ritchtextbox.

Is this possible?

Help!

Regards,

Edgardo Rossetto



--- End Message ---
--- Begin Message ---
I have a scripts, which, when runs, breaks the connection to Apache and I 
have no idea why.
This script has lots of function calls, some return large arrays.

After I've trim the scripts to the point where it connects and run, if I 
add a printf("Hello World") or any custom function I get this error:

>>
Connection to host 
localhost
is broken
<<

Is there a max number of functions that can be called or some other kind of 
limit that can affect it?
I've compiled php 4 into apache on Linux.

This is not the first time it happens, it happened before when I transfered 
a php file from another server to this one. It worked fine on the other 
server but I got connection broken when ran a specific file on this server.

Please help
--- End Message ---
--- Begin Message ---
Hi,

Does anyone know how to change the name of and image and save the new name
to the database?

I know how to do a standard file upload, but can't seem to get the new new
to be saved into the database....any pointers would be fantastic.

Cheers
Will

--- End Message ---
--- Begin Message ---
Hi,

i can´t seem to get my head to wake up...

How would i do to count how many different values that exists in a mysql
field? Ie i have a date-field and need to know how many different dates that
exists in the table.

Regards
# Daniel Alsén    | www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #

--- End Message ---
--- Begin Message ---
$number=mysql_num_rows(mysql_query("SELECT DISTINCT date FROM $table"));
Op zaterdag 09 februari 2002 13:41, schreef Daniel Alsén:
> Hi,
>
> i can´t seem to get my head to wake up...
>
> How would i do to count how many different values that exists in a mysql
> field? Ie i have a date-field and need to know how many different dates
> that exists in the table.
>
> Regards
> # Daniel Alsén    | www.mindbash.com #
> # [EMAIL PROTECTED]  | +46 704 86 14 92 #
> # ICQ: 63006462   | +46 8 694 82 22  #
> # PGP: http://www.mindbash.com/pgp/  #
--- End Message ---
--- Begin Message ---
> Hi,
>
> i can?t seem to get my head to wake up...
>
> How would i do to count how many different values that exists in a mysql
> field? Ie i have a date-field and need to know how many different dates
that
> exists in the table.

select count(distinct name) from site; in Mysql

Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]





--- End Message ---
--- Begin Message ---
Thanks guys!

- Daniel
--- End Message ---
--- Begin Message ---
Don´t really want to bother you with these quickies - but:

If i have a result from mysql that is a date (2002-02-09) - how do i change
that into a variable with only the first 7 characters (2002-02)?

Thanks
# Daniel Alsén    | www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #

--- End Message ---
--- Begin Message ---
> Don?t really want to bother you with these quickies - but:
>
> If i have a result from mysql that is a date (2002-02-09) - how do i
change
> that into a variable with only the first 7 characters (2002-02)?
>

SELECT year(data), month (data) from table;

Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]




--- End Message ---
--- Begin Message ---
or:

SELECT LEFT(date, 7) as YearAndMonth FROM table;

Edward


----- Original Message ----- 
From: "val petruchek" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, February 09, 2002 2:28 PM
Subject: Re: [PHP] One more quickie


> > Don?t really want to bother you with these quickies - but:
> >
> > If i have a result from mysql that is a date (2002-02-09) - how do i
> change
> > that into a variable with only the first 7 characters (2002-02)?
> >
> 
> SELECT year(data), month (data) from table;
> 
> Valentin Petruchek (aki Zliy Pes)
> *** Cut the beginning ***
> http://zliypes.com.ua
> mailto:[EMAIL PROTECTED]
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
$qr="select DATE_FORMAT(date_field,\"%Y-%d\") as fmt_date from table
$whereclause";

then grab 'fmt_date' from the results...



> Don´t really want to bother you with these quickies - but:
>
> If i have a result from mysql that is a date (2002-02-09) - how do i
change
> that into a variable with only the first 7 characters (2002-02)?
>



--- End Message ---
--- Begin Message ---
Hi Olev:

There are several threads on this in the archives.  In fact it was discussed
just the other day.

http://groups.google.com/groups?hl=en&group=php.general

Put "mime email" into the search criteria and that discussion is the third
one down.

Enjoy,

--Dan

-- 
                PHP scripts that make your job easier
              http://www.analysisandsolutions.com/code/
         SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232    v: 718-854-0335    f: 718-854-0409
--- End Message ---
--- Begin Message ---
hi! I was unable to find any pre-written php code for a survey without a
database and using text files. So I was faced with the challenge of writing
my first script! -lol

What I eventually ended up with was a 3 answer poll, that will be called for
as many questions as I need, then I wil display the total results at the end
of the survey.

The problem is that the only way I was able to get it to work was to create
a seperate text file for each available answer, (eg, yes.txt, no.txt
notsure.txt) Which fir multiple questions can get kinda filey-lol

This is what I WANTED to do, but was unable so far to find the way if there
is one.

I wanted to have one text file for answer storage, possibly writing the
values for each answer on a seperate line, or a comma seperated list on one
line.

I was never able to extract values from a specific area in the text file. I
tried to use fseek() to move the file pointer, but all I could get was 1 or
0. As I write this I thtink I remember reading of a function that allows you
to read part of a file, and print the rest or something, but I need to able
to first read a specific line, or value in the file, then extract just that
value, and then update that value acording to the users answer, and then
replace the updated value back in its respective place. All without touching
the other values.

Can anyone guide me to the proper way of figuring this out?

Also, I wanted to create a IP log to prevent anyone from taking the poll /
survey. The way I did it was to simply write the users "REMOTE_ADDR" to a
text file, and then I used strstr($firstvalue, $second) to search for it and
display the appropriate content.

Is this appropriate>?

thanks for reading this far-lol


--- End Message ---
--- Begin Message ---
I have a website with logins, personal profiles, and stuff.  I'd like to
allow people to have htmlin their profiles, but if I did, they could use
javascript to get people's cookies and hack their accounts!  What can I do? 
--- End Message ---
--- Begin Message ---
Well, I guess using session instead of cookies for start and using a 
database, text-file whatever to store their html code, each user his own 
code...

hope this helps
Arik

Leif K-Brooks wrote:

> I have a website with logins, personal profiles, and stuff.  I'd like to
> allow people to have htmlin their profiles, but if I did, they could use
> javascript to get people's cookies and hack their accounts!  What can I do? 
> 

--- End Message ---
--- Begin Message ---
use substr_replace

string substr_replace(string text, string replacement, integer start,
integer length)

EG:

<?
$text = "Wow! This is neat, yes it is!";
print($text);
print('<br>');
print(substr_replace($text, "are", 10, 2));

?>
10 is the place where you want it to start replacement, 2 (is) more forward
it ends.


"Desikan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi there,
>
> Please help me out in the following...
>
> <?php
> $is='is';
> echo eregi_replace(" ".$is." "," ","This is a test string which contains
> is in dismissal");
> ?>
>
>
> Actually I want to replace "is" alone from the string and not all the
> words that contains is...
>
> I have tried with "^".$is."$" ---> but yields nothing....
>
> Also tried with "\b"...
>
>
> thanks and regards,
> Desikan
>
> --
>   Desikan
>   [EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Hello Desikan,

this should suit your needs.

<?

$string = "Is this is a way of getting strings containing \"is\" dismissed
from the string? It IS";

$pattern = "is";

$string = preg_replace("/(^|\s|[^a-z])" . $pattern . "($|\s|[^a-z])/is",
"$1$2", $string);

echo $string;

?>

~James

> Please help me out in the following...
>
> <?php
> $is='is';
> echo eregi_replace(" ".$is." "," ","This is a test string which contains
> is in dismissal");
> ?>
>
>
> Actually I want to replace "is" alone from the string and not all the
> words that contains is...



--- End Message ---
--- Begin Message ---
I know this php.general -  is there another newsgroup which specifically
deals with help issues?


--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Cyberskydive) wrote:

> I know this php.general -  is there another newsgroup which specifically
> deals with help issues?

PHP General does deal with help issues.  Alternatively, you can post to 
<news:alt.php>.

-- 
CC
--- End Message ---
--- Begin Message ---
I'm trying to set up a "modify record" page, and after testing and triple-checking
the syntax and form, and even running the query in the phpMyAdmin interface
to make sure the query is correct.

This is just a snippet of what I've done:

<?php

// open connection
include ("connectdatabase.inc");

// format names to protects the O'Haras etc.
$esc_fname = addslashes($fname);
$esc_lname = addslashes($lname);
$esc_email = addslashes($email);
$esc_web = addslashes($web);

// set up query 
$sql = 'UPDATE thistable
                SET FNAME = "$esc_fname", LNAME = "$esc_lname", EMAIL
= "$esc_email", WEB = "$esc_web"
                WHERE ID = "$id"';

// perform query
$sql_result = mysql_query($sql);
if (!$sql_result) {
   echo "Can't execute $sql " . mysql_error();
   exit;
        }

// close connection
mysql_close($connection);
?>

The problem? On the PHP front (my "mofidy record" page) says it's performed
without a problem. However, if I were to do a "view all records" - I
can see that none of the changes has actually been made to the database.

Adding a record is not a problem; nor is deleting a record.

Can someone point me into the right direction as to what I might be doing
wrong?

Thanks!

Laurie Landry
--- End Message ---
--- Begin Message ---
On Sunday 10 February 2002 00:47, [EMAIL PROTECTED] wrote:
> I'm trying to set up a "modify record" page, and after testing and
> triple-checking the syntax and form, and even running the query in the
> phpMyAdmin interface to make sure the query is correct.
>
> This is just a snippet of what I've done:
>
> <?php
>
> // open connection
> include ("connectdatabase.inc");
>
> // format names to protects the O'Haras etc.
> $esc_fname = addslashes($fname);
> $esc_lname = addslashes($lname);
> $esc_email = addslashes($email);
> $esc_web = addslashes($web);
>
> // set up query
> $sql = 'UPDATE thistable
>               SET FNAME = "$esc_fname", LNAME = "$esc_lname", EMAIL
> = "$esc_email", WEB = "$esc_web"
>               WHERE ID = "$id"';

If you print/echo $sql at this point you'll (hopefully) see where you're 
going wrong.


If you don't see what you're doing wrong then swap your single quotes for 
double quotes and vice-versa.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
The Killer Ducks are coming!!!
*/
--- End Message ---
--- Begin Message ---
Thanks Jason, switching the single and double quotes did the trick!

Now, I'm curious - what's the rule of thumb for when using single quotes
and double quotes?

Thanks!

-- 
Laurie Landry
[EMAIL PROTECTED] - email
(604) 693-1120 - voicemail/fax



---- Jason Wong <[EMAIL PROTECTED]> wrote:
> On Sunday 10 February 2002 00:47, [EMAIL PROTECTED] wrote:
> > I'm trying to set up a "modify record" page, and after testing and
> > triple-checking the syntax and form, and even running the query in
> the
> > phpMyAdmin interface to make sure the query is correct.
> >
> > This is just a snippet of what I've done:
> >
> > <?php
> >
> > // open connection
> > include ("connectdatabase.inc");
> >
> > // format names to protects the O'Haras etc.
> > $esc_fname = addslashes($fname);
> > $esc_lname = addslashes($lname);
> > $esc_email = addslashes($email);
> > $esc_web = addslashes($web);
> >
> > // set up query
> > $sql = 'UPDATE thistable
> >             SET FNAME = "$esc_fname", LNAME = "$esc_lname", EMAIL
> > = "$esc_email", WEB = "$esc_web"
> >             WHERE ID = "$id"';
> 
> If you print/echo $sql at this point you'll (hopefully) see where you're
> 
> going wrong.
> 
> 
> If you don't see what you're doing wrong then swap your single quotes
> for 
> double quotes and vice-versa.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> 
> /*
> The Killer Ducks are coming!!!
> */
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
--- End Message ---
--- Begin Message ---
On Sunday 10 February 2002 02:10, [EMAIL PROTECTED] wrote:
> Thanks Jason, switching the single and double quotes did the trick!
>
> Now, I'm curious - what's the rule of thumb for when using single quotes
> and double quotes?

Basically:

Anything inside single quotes stays exactly as it is.

Anything inside double quotes which starts with $ gets evaluated where 
possible.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Culture is the habit of being pleased with the best and knowing why.
*/
--- End Message ---
--- Begin Message ---
try using

// set up query 
$sql = "UPDATE thistable
SET FNAME = \"$esc_fname\", LNAME = \"$esc_lname\", EMAIL
= \"$esc_email\", WEB = \"$esc_web\"
WHERE ID = \"$id\"
";

variables aren't expanded inside ' so you need to use "


Paul Roberts
[EMAIL PROTECTED]
++++++++++++++++++++++++

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 09, 2002 4:47 PM
Subject: [PHP] Modifying a record works but not in actual database?


> I'm trying to set up a "modify record" page, and after testing and triple-checking
> the syntax and form, and even running the query in the phpMyAdmin interface
> to make sure the query is correct.
> 
> This is just a snippet of what I've done:
> 
> <?php
> 
> // open connection
> include ("connectdatabase.inc");
> 
> // format names to protects the O'Haras etc.
> $esc_fname = addslashes($fname);
> $esc_lname = addslashes($lname);
> $esc_email = addslashes($email);
> $esc_web = addslashes($web);
> 
> // set up query 
> $sql = 'UPDATE thistable
> SET FNAME = "$esc_fname", LNAME = "$esc_lname", EMAIL
> = "$esc_email", WEB = "$esc_web"
> WHERE ID = "$id"';
> 
> // perform query
> $sql_result = mysql_query($sql);
> if (!$sql_result) {
>    echo "Can't execute $sql " . mysql_error();
>    exit;
> }
> 
> // close connection
> mysql_close($connection);
> ?>
> 
> The problem? On the PHP front (my "mofidy record" page) says it's performed
> without a problem. However, if I were to do a "view all records" - I
> can see that none of the changes has actually been made to the database.
> 
> Adding a record is not a problem; nor is deleting a record.
> 
> Can someone point me into the right direction as to what I might be doing
> wrong?
> 
> Thanks!
> 
> Laurie Landry
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

--- End Message ---
--- Begin Message ---
Hey Boys,

I'm using PHP CGI version on Win32 to write some scripts. Not for a website
or anything, just some scripting at the console window. So now I want to
change the text color, clear the screen, and the other usual stuff. Just
like I can do with ncursus on the Linux version of PHP. Only, I can't find
something similar on Win32. It's pretty boring this way. Does anyone know
how to do it?

Richard


--- End Message ---
--- Begin Message ---
Try 'echo'ing ansi control sequences?

--
Alan

Richard <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey Boys,
>
> I'm using PHP CGI version on Win32 to write some scripts. Not for a
website
> or anything, just some scripting at the console window. So now I want to
> change the text color, clear the screen, and the other usual stuff. Just
> like I can do with ncursus on the Linux version of PHP. Only, I can't find
> something similar on Win32. It's pretty boring this way. Does anyone know
> how to do it?
>
> Richard
>
>


--- End Message ---
--- Begin Message ---
I thought about it, but in Windows 2000 and NT, you can't use ansi.sys from
Win32 executables, only from Dos16 exe's.

Richard

"Alan McFarlane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Try 'echo'ing ansi control sequences?
>
> --
> Alan
>
> Richard <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hey Boys,
> >
> > I'm using PHP CGI version on Win32 to write some scripts. Not for a
> website
> > or anything, just some scripting at the console window. So now I want to
> > change the text color, clear the screen, and the other usual stuff. Just
> > like I can do with ncursus on the Linux version of PHP. Only, I can't
find
> > something similar on Win32. It's pretty boring this way. Does anyone
know
> > how to do it?
> >
> > Richard
> >
> >
>
>


--- End Message ---
--- Begin Message ---
any offers? or start one...

Arik

--- End Message ---
--- Begin Message ---
On Sunday 10 February 2002 01:42, Arik Ashepa wrote:
> any offers? or start one...

If you're still stuck for ideas, how about a jobs board, something like 
monster.com?


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Kaufman's First Law of Party Physics:
        Population density is inversely proportional
        to the square of the distance from the keg.
*/
--- End Message ---
--- Begin Message ---
nice... anyone else has an idea?

Jason Wong wrote:

> On Sunday 10 February 2002 01:42, Arik Ashepa wrote:
> 
>>any offers? or start one...
>>
> 
> If you're still stuck for ideas, how about a jobs board, something like 
> monster.com?
> 
> 
> 

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* and then Arik Ashepa declared....
> nice... anyone else has an idea?

How about a Haiku db?

The php list
a place for conversation
with other nutters



Hehe,.

- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZWlsHpvrrTa6L5oRAriVAJ9GR95YAg98CIspv2X4Zjom2K3T3gCfT1AM
vZOV12HCCE89gRjMfgVs/cM=
=wbyf
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Emphasis on the second-last word?
=dn

----- Original Message ----- 
From: "Nick Wilson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 09 February 2002 18:24
Subject: Re: [PHP] ok still want to join a project...


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> * and then Arik Ashepa declared....
> > nice... anyone else has an idea?
> 
> How about a Haiku db?
> 
> The php list
> a place for conversation
> with other nutters
> 
> 
> 
> Hehe,.
> 
> - -- 
> 
> Nick Wilson
> 
> Tel: +45 3325 0688
> Fax: +45 3325 0677
> Web: www.explodingnet.com
> 
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> 
> iD8DBQE8ZWlsHpvrrTa6L5oRAriVAJ9GR95YAg98CIspv2X4Zjom2K3T3gCfT1AM
> vZOV12HCCE89gRjMfgVs/cM=
> =wbyf
> -----END PGP SIGNATURE-----
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Could anybody find out the simplest method of calculating the age?
The date of birth is in the format string ('01/01/1977').

André

--- End Message ---
--- Begin Message ---
don't know if there is some "date_diff" -like function, but you can do it
this way:

$now = getdate();
$nw_year = $now["year"];
$nw_month = $now["mon"];
$nw_day = $now["mday"];

$chk_date = "09/02/1977";
list ($chk_day, $chk_month, $chk_year) = explode("/", $chk_date);

print $nw_year;
$age = $nw_year - $chk_year;
if ($nw_month<$chk_month) $age--;
if ($nw_month==$chk_month && $nw_day<$chkday) $age--;

print "<BR>age: ".$age;



assuming that the date : "dd/mm/yyyy"

greets,

edward


----- Original Message -----
From: "André Felix Miertschink" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 09, 2002 8:08 PM
Subject: [PHP] Age


> Could anybody find out the simplest method of calculating the age?
> The date of birth is in the format string ('01/01/1977').
>
> André
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
Hello PHP Group,

Thanks for the information on the books. I have a questions about a forms
page.
I wish to create a page using PHP to create a page that is submitted to my
email
address. Is this similar to HTML? Also, if you have any good examples out
there
on the web - I'd like to take a look.

Thanks,
Ron
--- End Message ---
--- Begin Message ---
a random image maker based on the gd library (PNG)...
<?php
function setPenColors($theimage) {
        global $redpen, $greenpen, $bluepen, $blackpen, $whitepen, $yellowpen, 
$aquapen, $fuschiapen, $greypen, $silverpen, $tealpen, $limepen, $navypen, $purplepen, 
$maroonpen, $olivepen;
        $redpen = ImageColorAllocate($theimage, 255, 0, 0);
        $greenpen = ImageColorAllocate($theimage, 0, 153, 0);
        $bluepen = ImageColorAllocate($theimage, 0, 0, 255);
        $blackpen = ImageColorAllocate($theimage, 0, 0, 0);
        $whitepen = ImageColorAllocate($theimage, 255, 255, 255);
        $yellowpen = ImageColorAllocate($theimage, 255, 255, 0);
        $aquapen = ImageColorAllocate($theimage, 0, 255, 255);
        $fuschiapen = ImageColorAllocate($theimage, 255, 0, 255);
        $greypen = ImageColorAllocate($theimage, 153, 153, 153);
        $silverpen = ImageColorAllocate($theimage, 204, 204, 204);
        $tealpen = ImageColorAllocate($theimage, 0, 153, 153);
        $limepen = ImageColorAllocate($theimage, 0, 255, 0);
        $navypen = ImageColorAllocate($theimage, 0, 0, 153);
        $purplepen = ImageColorAllocate($theimage, 153, 0, 153);
        $maroonpen = ImageColorAllocate($theimage, 153, 0, 0);
        $olivepen = ImageColorAllocate($theimage, 153, 153, 0);
}
$servername = getenv("SERVER_NAME");

// set the content type
header("Content-type:  image/png");

$imageWidth = 118;
$imageHeight = 136;

// create image
$image = imageCreate($imageWidth, $imageHeight);

$bgcolor = ImageColorAllocate($image, 0, 0, 0);
$fgcolor = ImageColorAllocate($image, 255, 255, 255);
setPenColors($image);

srand ((double) microtime() * 1000000);
$rndnum = rand(10,60);
$oldx = rand(1,$imageWidth-2);
$oldy = rand(1,$imageHeight-18);
$pencolor = array 
($redpen,$greenpen,$bluepen,blackpen,$whitepen,$yellowpen,$aquapen,$fuschiapen,$greypen,$silverpen,$tealpen,$limepen,$navypen,$purplepen,$maroonpen,$olivepen);

$rndpen = rand(0,15);
ImageRectangle($image, 0, 0, $imageWidth-1, $imageHeight-17, $pencolor[$rndpen]);

for ($i=0; $i<$rndnum; $i++) {
        $rndpen = rand(0,15);
        $newx = rand(1,$imageWidth-2);
        $newy = rand(1,$imageHeight-18);
        ImageLine ($image, $oldx, $oldy, $newx, $newy, $pencolor[$rndpen]);
        $oldx = $newx;
        $oldy = $newy;
}

ImageString($image,2, 4, $imageHeight-14,  "Random Image Maker", $limepen);

// create an interlaced image for better loading in the browser
imageInterlace($image, 1);

// mark background color as being transparent
imageColorTransparent($image, $bgcolor);

// now send the picture to the client (this outputs all image data directly)
imagePNG($image);


?>
--- End Message ---
--- Begin Message ---
On Sunday 10 February 2002 02:19, Arik Ashepa wrote:

[snip]


> // now send the picture to the client (this outputs all image data
> directly) imagePNG($image);

Very nice! Hey someone give this guy a project to work on :)


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Never ask the barber if you need a haircut.
*/
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, 
What would be the easiest way to see if a MySQL table exists with PHP?
I can do it by checking against mysql_list_tables() but that seems a
little clumsy. Is there a better way?
- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZWpZHpvrrTa6L5oRAtJwAJ44JTLEU1kgAyXS8fBNawLocpsJPQCeJpwW
2xELNyaALyoYZv60kJeLU5k=
=riQB
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Nick Wilson wrote:
> What would be the easiest way to see if a MySQL table exists with PHP?
> I can do it by checking against mysql_list_tables() but that seems a
> little clumsy. Is there a better way?
Do a select on the table - if the query returns true the table exists 
otherwise the test is inconclusive..

Best regards 
Martin Petersen
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* and then Martin C. Petersen declared....
> Do a select on the table - if the query returns true the table exists 
> otherwise the test is inconclusive..

Yep, that'l do it. cheers.

- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZYQEHpvrrTa6L5oRAnT2AKCxXgZv9C5+4RCu/Atn5sLCOF7pmACfbgAc
Trt749MnUo6/GJsU+D6ykyg=
=QXfl
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Nick Wilson) wrote:

> What would be the easiest way to see if a MySQL table exists with PHP?
> I can do it by checking against mysql_list_tables() but that seems a
> little clumsy. Is there a better way?

See MySQL's documentation of the "CREATE TABLE" and "DROP TABLE" syntax: 
both support table existance checks.

create table if not exists mytablename...
drop table if exists mytablename...

-- 
CC
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* and then CC Zona declared....
> In article <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] (Nick Wilson) wrote:
> 
> > What would be the easiest way to see if a MySQL table exists with PHP?
> > I can do it by checking against mysql_list_tables() but that seems a
> > little clumsy. Is there a better way?
> 
> See MySQL's documentation of the "CREATE TABLE" and "DROP TABLE" syntax: 
> both support table existance checks.
> 
> create table if not exists mytablename...
> drop table if exists mytablename...

Yeah, but I don't want to create or drop the table, I just want to check
it exists. Thanks anyway.

- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZYtKHpvrrTa6L5oRAstZAKCbKPBSjja+WkBB6xuV3p/CL5+u3ACgrHVS
HzIhSNIpfVAVtEtOnLpvYMU=
=D7Ja
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
does anyone know a very flexible rating system, written in php of
course?
i have an application where i want to rate different data that the
application saves and may relate the data to each other.
I.e. a very active/known/famous/any-attribute user rates an item,
then this vote might weigh more than one who is "unknown" to the
system.
This means you might also be able to rate a user and have some
algorithm to show the result in a weighed way.
And besides it should also do things like: let every user only vote
once a day/month/hour/..., and all this common stuff.

thanks for the help

--
Wolfram

 ... translating template system ...
http://freshmeat.net/projects/simpletemplateii
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all, 
I just can't see what could possibly be wrong with my php here:

        $sel_db=mysql_select_db("mydb") or die 
        ("could not get the bugger");
        exit;

I can 'USE mydb' just fine from the command line so what's the problem?
    (returns the die statement)

Much thanks..
- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZYWRHpvrrTa6L5oRArthAJ9Vew5DIKSR7qzc4M2abhxJfpz5TwCfRmZJ
ZBn2oUXT4UgsH1hM/UyyNGs=
=ajT+
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
It may be having a problem because you are not specifying which connection 
to use.

perhaps try something like this:

if(!$db = @mysql_connect("$dbhost", "$dbuser", "$dbpasswd"))
     die("An Error Occured. Unable to connect to the database.");
if(!@mysql_select_db("$dbname",$db))
     die("An Error Occured. Unable to find the database $dbname on the 
MySQL server.");

Hope that helps.

Jeff

At 09:24 PM 2/9/2002 +0100, Nick Wilson wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hi all,
>I just can't see what could possibly be wrong with my php here:
>
>         $sel_db=mysql_select_db("mydb") or die
>         ("could not get the bugger");
>         exit;
>
>I can 'USE mydb' just fine from the command line so what's the problem?
>     (returns the die statement)
>
>Much thanks..
>- --
>
>Nick Wilson
>
>Tel:    +45 3325 0688
>Fax:    +45 3325 0677
>Web:    www.explodingnet.com
>
>
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.0.6 (GNU/Linux)
>
>iD8DBQE8ZYWRHpvrrTa6L5oRArthAJ9Vew5DIKSR7qzc4M2abhxJfpz5TwCfRmZJ
>ZBn2oUXT4UgsH1hM/UyyNGs=
>=ajT+
>-----END PGP SIGNATURE-----
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* and then Jeff Sheltren declared....
> It may be having a problem because you are not specifying which 
> connection to use.
> 
> perhaps try something like this:
> 
> if(!$db = @mysql_connect("$dbhost", "$dbuser", "$dbpasswd"))
>     die("An Error Occured. Unable to connect to the database.");
> if(!@mysql_select_db("$dbname",$db))
>     die("An Error Occured. Unable to find the database $dbname on the 
> MySQL server.");

No, that's not it. If you don't specify a link id then it assumes the
last connection or trys to establish one. (I've tried it anyway :-)

Come on guys, someone must be able to spot the 'gotcha'!
- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZYz6HpvrrTa6L5oRAtwcAJ9FTvFFc57I7lUs8euOPp42nc6dZwCeMmis
UK+HqUaQ6fJlMUFWOlVsMZ8=
=ymec
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
James,

The problem has, in my case, nothing to do with switching from SSL to
non SSL. On my non SSL test machine everything works 100% but when I run
the same script on a different machine with SSL it doesn't work. 


I think I know where the problem I'm having is coming from; 

My non SSL connection runs on apache with php, the SSL server is running
Win2K with PHP as CGI (I am testing this soon on a cobalt; keep you
posted on the issue). 

Please correct me if I'm wrong, but I think the CGI version of PHP
doesn't support the WWW authentication method. So I'm guessing my
subject was a little off.

Maybe a good solution for you is creating a form on the page just before
leaving SSL with the variables you want to transfer in hidden fields,
and re-registering them in the non SSL environment.

Frank.

-----Oorspronkelijk bericht-----
Van: James Arthur [mailto:[EMAIL PROTECTED]] 
Verzonden: zaterdag 9 februari 2002 22:03
Aan: Frank Hertogs
Onderwerp: Re: [PHP] ssl

On Friday 01 Feb 2002 22:25, Frank Hertogs wrote:
> Anyone have experience with authentication on ssl connections, I have
a
> (working) script to authenticate a user but as soon as I put it on my
> ssl it just stops working.

Frank, can you elaborate a little? Are you using cookies, sessions etc?

I have a problem where I send my user to a https page which allows them
to 
enter username and password. They then get given a session cookie. When
they 
are redirected to the non-SSL page the session variables are not
transferred. 

Is this a little like the problem you have? Have you found a way around
it 
yet?

--jaa

--- End Message ---

Reply via email to