From 91848c237f6856eeeebf6065d48f6338c23cf1a2 Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Tue, 20 Nov 2001 23:58:47 +0000 Subject: [PATCH] more CDATA additions to examples git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@62898 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/mcrypt.xml | 141 +++-- functions/mhash.xml | 46 +- functions/ming.xml | 1048 +++++++++++++++++++------------------ functions/misc.xml | 153 +++--- functions/mnogosearch.xml | 8 +- functions/msql.xml | 10 +- functions/mssql.xml | 8 +- functions/mysql.xml | 211 +++++--- functions/network.xml | 48 +- functions/nis.xml | 30 +- functions/oci8.xml | 312 ++++++----- functions/openssl.xml | 37 +- 12 files changed, 1156 insertions(+), 896 deletions(-) diff --git a/functions/mcrypt.xml b/functions/mcrypt.xml index 444ebaddaa..6fd6f4a07c 100644 --- a/functions/mcrypt.xml +++ b/functions/mcrypt.xml @@ -1,5 +1,5 @@ - + Mcrypt Encryption Functions mcrypt @@ -41,12 +41,14 @@ Encrypt an input value with TripleDES under 2.2.x in ECB mode -<?php + +]]> This example will give you the encrypted data as a string in @@ -58,7 +60,8 @@ $encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT); Encrypt an input value with TripleDES under 2.4.x in ECB mode -<?php + +]]> This example will give you the encrypted data as a string in @@ -397,19 +401,23 @@ mcrypt_generic_end ($td); <function>mcrypt_get_cipher_name</function> Example -<?php + +]]> - - - - The above example will produce: - + + The above example will produce: + + +]]> + + + @@ -524,11 +532,13 @@ print mcrypt_get_cipher_name ($cipher); <function>mcrypt_create_iv</function> example -<?php + +]]> @@ -744,7 +754,7 @@ $iv = mcrypt_create_iv ($block_size, MCRYPT_DEV_RANDOM); int mode string iv - + string mcrypt_ofb @@ -804,10 +814,10 @@ $iv = mcrypt_create_iv ($block_size, MCRYPT_DEV_RANDOM); array mcrypt_list_algorithms string - - lib_dir - - + + lib_dir + + @@ -819,26 +829,28 @@ $iv = mcrypt_create_iv ($block_size, MCRYPT_DEV_RANDOM); mcrypt_list_algorithms takes as optional parameter a directory which specifies the directory where all algorithms are located. If not specifies, the value of the - mcrypt.algorithms_dir php.ini directive is used. + mcrypt.algorithms_dir php.ini directive is used. <function>mcrypt_list_algorithms</function> Example -<?php + +]]> + + The above example will produce a list with all supported + algorithms in the "/usr/local/lib/libmcrypt" directory. + - - The above example will produce a list with all supported - algorithms in the "/usr/local/lib/libmcrypt" directory. - @@ -853,10 +865,10 @@ foreach ($algorithms as $cipher) { array mcrypt_list_modes string - - lib_dir - - + + lib_dir + + @@ -868,28 +880,30 @@ foreach ($algorithms as $cipher) { mcrypt_list_modes takes as optional parameter a directory which specifies the directory where all modes are located. If not specifies, the value of the - mcrypt.modes_dir php.ini directive is used. + mcrypt.modes_dir php.ini directive is used. <function>mcrypt_list_modes</function> Example -<?php +"; } -?> +?> +]]> + + The above example will produce a list with all supported + algorithms in the default mode directory. If it is not set + with the ini directive mcrypt.modes_dir, the default directory + of mcrypt is used (which is /usr/local/lib/libmcrypt). + - - The above example will produce a list with all supported - algorithms in the default mode directory. If it is not set - with the ini directive mcrypt.modes_dir, the default directory - of mcrypt is used (which is /usr/local/lib/libmcrypt). - @@ -995,7 +1009,8 @@ foreach ($modes as $mode) { <function>mcrypt_encrypt</function> Example -<?php + +]]> - - The above example will print out: - + + The above example will print out: + + +]]> + + + @@ -1109,13 +1129,18 @@ echo strlen ($crypttext)."\n"; <function>mcrypt_module_open</function> Example -<?php + +]]> + + The above example will try to open the DES cipher + from the default directory and the EBC mode from the directory + /usr/lib/mcrypt-modes. + - The above example will try to open the DES cipher from the default - directory and the EBC mode from the directory /usr/lib/mcrypt-modes. @@ -1202,7 +1227,8 @@ $td = mcrypt_module_open (MCRYPT_DES, "", MCRYPT_MODE_ECB, "/usr/lib/mcrypt-mode <function>mdecrypt_generic</function> Example -<?php + +]]> + + The above example shows how to check if the data before the + encryption is the same as the data after the decryption. + - The above example shows how to check if the data before the - encryption is the same as the data after the decryption. diff --git a/functions/mhash.xml b/functions/mhash.xml index acad8eab26..51553980e0 100644 --- a/functions/mhash.xml +++ b/functions/mhash.xml @@ -1,5 +1,5 @@ - + Mhash Functions mhash @@ -28,20 +28,26 @@ Compute the MD5 digest and hmac and print it out as hex -<?php +"; $hash = mhash (MHASH_MD5, $input, "Jefe"); print "The hmac is ".bin2hex ($hash)."\n<br>"; -?> +?> +]]> - - This will produce: - + + This will produce: + + +]]> + + + For a complete list of supported hashes, refer to the documentation of mhash. The general rule is that you can access the hash algorithm from PHP with MHASH_HASHNAME. For example, to @@ -137,17 +143,23 @@ The hmac is 750c783e6ab0b503eaa86e310a5db738 <function>mhash_get_hash_name</function> Example -<?php + +]]> + + The above example will print out: + + + + - The above example will print out: - -MD5 - @@ -198,16 +210,18 @@ MD5 Traversing all hashes -<?php + +]]> diff --git a/functions/ming.xml b/functions/ming.xml index 9eae22eae3..2a2e7d0cae 100755 --- a/functions/ming.xml +++ b/functions/ming.xml @@ -1,5 +1,5 @@ - + Ming functions for Flash Ming (flash) @@ -60,13 +60,17 @@ built into php (unix) + - mkdir <phpdir>/ext/ming - cp php_ext/* <phpdir>/ext/ming - cd <phpdir> +/ext/ming + cp php_ext/* /ext/ming + cd ./buildconf - ./configure --with-ming <other config options> - + ./configure --with-ming +]]> + + Build and install php as usual, Restart web server if necessary @@ -217,9 +221,11 @@ swfmovie->output dumps your lovingly prepared movie out. In PHP, preceding this with the command -<?php + +]]> convinces the browser to display this as a flash movie. @@ -473,18 +479,20 @@ header('Content-type: application/x-shockwave-flash'); <function>swfmovie->streammp3</function> example -<?php +setRate(12.0); + $m->streamMp3("distortobass.mp3"); + // use your own MP3 // 11.85 seconds at 12.0 fps = 142 frames - $m->setFrames(142); + $m->setFrames(142); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -689,15 +697,16 @@ header('Content-type: application/x-shockwave-flash'); <function>swfdisplayitem->rotateto</function> example -<?php +setRate(24.0); + $m->setDimension(2400, 1600); + $m->setBackground(0xff, 0xff, 0xff); // functions with huge numbers of arbitrary // arguments are always a good idea! Really! @@ -707,23 +716,23 @@ header('Content-type: application/x-shockwave-flash'); global $f, $m; $t = new SWFText(); - $t->setFont($f); - $t->setColor($r, $g, $b, $a); - $t->setHeight(960); - $t->moveTo(-($f->getWidth($string))/2, $f->getAscent()/2); - $t->addString($string); + $t->setFont($f); + $t->setColor($r, $g, $b, $a); + $t->setHeight(960); + $t->moveTo(-($f->getWidth($string))/2, $f->getAscent()/2); + $t->addString($string); // we can add properties just like a normal php var, // as long as the names aren't already used. - // e.g., we can't set $i->scale, because that's a function + // e.g., we can't set $i->scale, because that's a function - $i = $m->add($t); - $i->x = $x; - $i->y = $y; - $i->rot = $rot; - $i->s = $scale; - $i->rotateTo($rot); - $i->scale($scale, $scale); + $i = $m->add($t); + $i->x = $x; + $i->y = $y; + $i->rot = $rot; + $i->s = $scale; + $i->rotateTo($rot); + $i->scale($scale, $scale); // but the changes are local to the function, so we have to // return the changed object. kinda weird.. @@ -733,15 +742,15 @@ header('Content-type: application/x-shockwave-flash'); function step($i) { - $oldrot = $i->rot; - $i->rot = 19*$i->rot/20; - $i->x = (19*$i->x + 1200)/20; - $i->y = (19*$i->y + 800)/20; - $i->s = (19*$i->s + 1.0)/20; + $oldrot = $i->rot; + $i->rot = 19*$i->rot/20; + $i->x = (19*$i->x + 1200)/20; + $i->y = (19*$i->y + 800)/20; + $i->s = (19*$i->s + 1.0)/20; - $i->rotateTo($i->rot); - $i->scaleTo($i->s, $i->s); - $i->moveTo($i->x, $i->y); + $i->rotateTo($i->rot); + $i->scaleTo($i->s, $i->s); + $i->moveTo($i->x, $i->y); return $i; } @@ -752,18 +761,19 @@ header('Content-type: application/x-shockwave-flash'); $i2 = text(0x00, 0x33, 0xff, 0x7f, -560, 1200, 800, 0.04, $thetext); $i3 = text(0xff, 0xff, 0xff, 0x9f, 180, 1200, 800, 0.001, $thetext); - for($i=1; $i<=100; ++$i) + for($i=1; $i<=100; ++$i) { $i1 = step($i1); $i2 = step($i2); $i3 = step($i3); - $m->nextFrame(); + $m->nextFrame(); } header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1059,63 +1069,65 @@ header('Content-type: application/x-shockwave-flash'); <function>swfdisplayitem->setname</function> example -<?php +addEntry(0.0, 0, 0, 0); + $g->addEntry(0.16, 0xff, 0xff, 0xff); + $g->addEntry(0.32, 0, 0, 0); + $g->addEntry(0.48, 0xff, 0xff, 0xff); + $g->addEntry(0.64, 0, 0, 0); + $g->addEntry(0.80, 0xff, 0xff, 0xff); + $g->addEntry(1.00, 0, 0, 0); - $s = $p->getShape1(); - $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); - $f->scaleTo(0.05); - $s->setLeftFill($f); - $s->movePenTo(-160, -120); - $s->drawLine(320, 0); - $s->drawLine(0, 240); - $s->drawLine(-320, 0); - $s->drawLine(0, -240); + $s = $p->getShape1(); + $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); + $f->scaleTo(0.05); + $s->setLeftFill($f); + $s->movePenTo(-160, -120); + $s->drawLine(320, 0); + $s->drawLine(0, 240); + $s->drawLine(-320, 0); + $s->drawLine(0, -240); $g = new SWFGradient(); - $g->addEntry(0.0, 0, 0, 0); - $g->addEntry(0.16, 0xff, 0, 0); - $g->addEntry(0.32, 0, 0, 0); - $g->addEntry(0.48, 0, 0xff, 0); - $g->addEntry(0.64, 0, 0, 0); - $g->addEntry(0.80, 0, 0, 0xff); - $g->addEntry(1.00, 0, 0, 0); + $g->addEntry(0.0, 0, 0, 0); + $g->addEntry(0.16, 0xff, 0, 0); + $g->addEntry(0.32, 0, 0, 0); + $g->addEntry(0.48, 0, 0xff, 0); + $g->addEntry(0.64, 0, 0, 0); + $g->addEntry(0.80, 0, 0, 0xff); + $g->addEntry(1.00, 0, 0, 0); - $s = $p->getShape2(); - $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); - $f->scaleTo(0.05); - $f->skewXTo(1.0); - $s->setLeftFill($f); - $s->movePenTo(-160, -120); - $s->drawLine(320, 0); - $s->drawLine(0, 240); - $s->drawLine(-320, 0); - $s->drawLine(0, -240); + $s = $p->getShape2(); + $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); + $f->scaleTo(0.05); + $f->skewXTo(1.0); + $s->setLeftFill($f); + $s->movePenTo(-160, -120); + $s->drawLine(320, 0); + $s->drawLine(0, 240); + $s->drawLine(-320, 0); + $s->drawLine(0, -240); $m = new SWFMovie(); - $m->setDimension(320, 240); - $i = $m->add($p); - $i->moveTo(160, 120); + $m->setDimension(320, 240); + $i = $m->add($p); + $i->moveTo(160, 120); - for($n=0; $n<=1.001; $n+=0.01) + for($n=0; $n<=1.001; $n+=0.01) { - $i->setRatio($n); - $m->nextFrame(); + $i->setRatio($n); + $m->nextFrame(); } header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1185,32 +1197,34 @@ header('Content-type: application/x-shockwave-flash'); <function>swfdisplayitem->multcolor</function> example -<?php +setRightFill($s->addFill($b)); + $s->drawLine($b->getWidth(), 0); + $s->drawLine(0, $b->getHeight()); + $s->drawLine(-$b->getWidth(), 0); + $s->drawLine(0, -$b->getHeight()); $m = new SWFMovie(); - $m->setDimension($b->getWidth(), $b->getHeight()); + $m->setDimension($b->getWidth(), $b->getHeight()); - $i = $m->add($s); + $i = $m->add($s); - for($n=0; $n<=20; ++$n) + for($n=0; $n<=20; ++$n) { - $i->multColor(1.0-$n/10, 1.0, 1.0); - $i->addColor(0xff*$n/20, 0, 0); - $m->nextFrame(); + $i->multColor(1.0-$n/10, 1.0, 1.0); + $i->addColor(0xff*$n/20, 0, 0); + $m->nextFrame(); } header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1249,24 +1263,26 @@ header('Content-type: application/x-shockwave-flash'); <function>swfshape</function> example -<?php +setLine(40, 0x7f, 0, 0); + $s->setRightFill($s->addFill(0xff, 0, 0)); + $s->movePenTo(200, 200); + $s->drawLineTo(6200, 200); + $s->drawLineTo(6200, 4600); + $s->drawCurveTo(200, 4600, 200, 200); $m = new SWFMovie(); - $m->setDimension(6400, 4800); - $m->setRate(12.0); - $m->add($s); - $m->nextFrame(); + $m->setDimension(6400, 4800); + $m->setRate(12.0); + $m->add($s); + $m->nextFrame(); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1312,56 +1328,58 @@ header('Content-type: application/x-shockwave-flash'); <function>swfshape->setline</function> example -<?php +addFill(0xff, 0, 0); + $f2 = $s->addFill(0xff, 0x7f, 0); + $f3 = $s->addFill(0xff, 0xff, 0); + $f4 = $s->addFill(0, 0xff, 0); + $f5 = $s->addFill(0, 0, 0xff); // bug: have to declare all line styles before you use them - $s->setLine(40, 0x7f, 0, 0); - $s->setLine(40, 0x7f, 0x3f, 0); - $s->setLine(40, 0x7f, 0x7f, 0); - $s->setLine(40, 0, 0x7f, 0); - $s->setLine(40, 0, 0, 0x7f); + $s->setLine(40, 0x7f, 0, 0); + $s->setLine(40, 0x7f, 0x3f, 0); + $s->setLine(40, 0x7f, 0x7f, 0); + $s->setLine(40, 0, 0x7f, 0); + $s->setLine(40, 0, 0, 0x7f); $f = new SWFFont('Techno.fdb'); - $s->setRightFill($f1); - $s->setLine(40, 0x7f, 0, 0); - $s->drawGlyph($f, '!'); - $s->movePen($f->getWidth('!'), 0); + $s->setRightFill($f1); + $s->setLine(40, 0x7f, 0, 0); + $s->drawGlyph($f, '!'); + $s->movePen($f->getWidth('!'), 0); - $s->setRightFill($f2); - $s->setLine(40, 0x7f, 0x3f, 0); - $s->drawGlyph($f, '#'); - $s->movePen($f->getWidth('#'), 0); + $s->setRightFill($f2); + $s->setLine(40, 0x7f, 0x3f, 0); + $s->drawGlyph($f, '#'); + $s->movePen($f->getWidth('#'), 0); - $s->setRightFill($f3); - $s->setLine(40, 0x7f, 0x7f, 0); - $s->drawGlyph($f, '%'); - $s->movePen($f->getWidth('%'), 0); + $s->setRightFill($f3); + $s->setLine(40, 0x7f, 0x7f, 0); + $s->drawGlyph($f, '%'); + $s->movePen($f->getWidth('%'), 0); - $s->setRightFill($f4); - $s->setLine(40, 0, 0x7f, 0); - $s->drawGlyph($f, '*'); - $s->movePen($f->getWidth('*'), 0); + $s->setRightFill($f4); + $s->setLine(40, 0, 0x7f, 0); + $s->drawGlyph($f, '*'); + $s->movePen($f->getWidth('*'), 0); - $s->setRightFill($f5); - $s->setLine(40, 0, 0, 0x7f); - $s->drawGlyph($f, '@'); + $s->setRightFill($f5); + $s->setLine(40, 0, 0, 0x7f); + $s->drawGlyph($f, '@'); $m = new SWFMovie(); - $m->setDimension(3000,2000); - $m->setRate(12.0); - $i = $m->add($s); - $i->moveTo(1500-$f->getWidth("!#%*@")/2, 1000+$f->getAscent()/2); + $m->setDimension(3000,2000); + $m->setRate(12.0); + $i = $m->add($s); + $i->moveTo(1500-$f->getWidth("!#%*@")/2, 1000+$f->getAscent()/2); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1441,54 +1459,56 @@ header('Content-type: application/x-shockwave-flash'); <function>swfshape->addfill</function> example -<?php +getWidth(); + $height = $b->getHeight(); - $s = $p->getShape1(); - $f = $s->addFill($b, SWFFILL_TILED_BITMAP); - $f->moveTo(-$width/2, -$height/4); - $f->scaleTo(1.0, 0.5); - $s->setLeftFill($f); - $s->movePenTo(-$width/2, -$height/4); - $s->drawLine($width, 0); - $s->drawLine(0, $height/2); - $s->drawLine(-$width, 0); - $s->drawLine(0, -$height/2); + $s = $p->getShape1(); + $f = $s->addFill($b, SWFFILL_TILED_BITMAP); + $f->moveTo(-$width/2, -$height/4); + $f->scaleTo(1.0, 0.5); + $s->setLeftFill($f); + $s->movePenTo(-$width/2, -$height/4); + $s->drawLine($width, 0); + $s->drawLine(0, $height/2); + $s->drawLine(-$width, 0); + $s->drawLine(0, -$height/2); - $s = $p->getShape2(); - $f = $s->addFill($b, SWFFILL_TILED_BITMAP); + $s = $p->getShape2(); + $f = $s->addFill($b, SWFFILL_TILED_BITMAP); // these two have no effect! - $f->moveTo(-$width/4, -$height/2); - $f->scaleTo(0.5, 1.0); + $f->moveTo(-$width/4, -$height/2); + $f->scaleTo(0.5, 1.0); - $s->setLeftFill($f); - $s->movePenTo(-$width/4, -$height/2); - $s->drawLine($width/2, 0); - $s->drawLine(0, $height); - $s->drawLine(-$width/2, 0); - $s->drawLine(0, -$height); + $s->setLeftFill($f); + $s->movePenTo(-$width/4, -$height/2); + $s->drawLine($width/2, 0); + $s->drawLine(0, $height); + $s->drawLine(-$width/2, 0); + $s->drawLine(0, -$height); $m = new SWFMovie(); - $m->setDimension($width, $height); - $i = $m->add($p); - $i->moveTo($width/2, $height/2); + $m->setDimension($width, $height); + $i = $m->add($p); + $i->moveTo($width/2, $height/2); - for($n=0; $n<1.001; $n+=0.03) + for($n=0; $n<1.001; $n+=0.03) { - $i->setRatio($n); - $m->nextFrame(); + $i->setRatio($n); + $m->nextFrame(); } header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1804,50 +1824,52 @@ header('Content-type: application/x-shockwave-flash'); <function>swfgradient</function> example -<?php +setDimension(320, 240); $s = new SWFShape(); // first gradient- black to white $g = new SWFGradient(); - $g->addEntry(0.0, 0, 0, 0); - $g->addEntry(1.0, 0xff, 0xff, 0xff); + $g->addEntry(0.0, 0, 0, 0); + $g->addEntry(1.0, 0xff, 0xff, 0xff); - $f = $s->addFill($g, SWFFILL_LINEAR_GRADIENT); - $f->scaleTo(0.01); - $f->moveTo(160, 120); - $s->setRightFill($f); - $s->drawLine(320, 0); - $s->drawLine(0, 240); - $s->drawLine(-320, 0); - $s->drawLine(0, -240); + $f = $s->addFill($g, SWFFILL_LINEAR_GRADIENT); + $f->scaleTo(0.01); + $f->moveTo(160, 120); + $s->setRightFill($f); + $s->drawLine(320, 0); + $s->drawLine(0, 240); + $s->drawLine(-320, 0); + $s->drawLine(0, -240); - $m->add($s); + $m->add($s); $s = new SWFShape(); // second gradient- radial gradient from red to transparent $g = new SWFGradient(); - $g->addEntry(0.0, 0xff, 0, 0, 0xff); - $g->addEntry(1.0, 0xff, 0, 0, 0); + $g->addEntry(0.0, 0xff, 0, 0, 0xff); + $g->addEntry(1.0, 0xff, 0, 0, 0); - $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); - $f->scaleTo(0.005); - $f->moveTo(160, 120); - $s->setRightFill($f); - $s->drawLine(320, 0); - $s->drawLine(0, 240); - $s->drawLine(-320, 0); - $s->drawLine(0, -240); + $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); + $f->scaleTo(0.005); + $f->moveTo(160, 120); + $s->setRightFill($f); + $s->drawLine(320, 0); + $s->drawLine(0, 240); + $s->drawLine(-320, 0); + $s->drawLine(0, -240); - $m->add($s); + $m->add($s); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1925,23 +1947,25 @@ header('Content-type: application/x-shockwave-flash'); Import PNG files -<?php +addFill(new SWFBitmap("png.dbl")); + $s->setRightFill($f); - $s->drawLine(32, 0); - $s->drawLine(0, 32); - $s->drawLine(-32, 0); - $s->drawLine(0, -32); + $s->drawLine(32, 0); + $s->drawLine(0, 32); + $s->drawLine(-32, 0); + $s->drawLine(0, -32); $m = new SWFMovie(); - $m->setDimension(32, 32); - $m->add($s); + $m->setDimension(32, 32); + $m->add($s); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -1950,53 +1974,55 @@ header('Content-type: application/x-shockwave-flash'); <function>swfbitmap</function> example -<?php +addFill(new SWFBitmap("alphafill.jpg", "alphafill.msk")); + $s->setRightFill($f); - $s->drawLine(640, 0); - $s->drawLine(0, 480); - $s->drawLine(-640, 0); - $s->drawLine(0, -480); + $s->drawLine(640, 0); + $s->drawLine(0, 480); + $s->drawLine(-640, 0); + $s->drawLine(0, -480); $c = new SWFShape(); - $c->setRightFill($c->addFill(0x99, 0x99, 0x99)); - $c->drawLine(40, 0); - $c->drawLine(0, 40); - $c->drawLine(-40, 0); - $c->drawLine(0, -40); + $c->setRightFill($c->addFill(0x99, 0x99, 0x99)); + $c->drawLine(40, 0); + $c->drawLine(0, 40); + $c->drawLine(-40, 0); + $c->drawLine(0, -40); $m = new SWFMovie(); - $m->setDimension(640, 480); - $m->setBackground(0xcc, 0xcc, 0xcc); + $m->setDimension(640, 480); + $m->setBackground(0xcc, 0xcc, 0xcc); // draw checkerboard background - for($y=0; $y<480; $y+=40) + for($y=0; $y<480; $y+=40) { - for($x=0; $x<640; $x+=80) + for($x=0; $x<640; $x+=80) { - $i = $m->add($c); - $i->moveTo($x, $y); + $i = $m->add($c); + $i->moveTo($x, $y); } $y+=40; - for($x=40; $x<640; $x+=80) + for($x=40; $x<640; $x+=80) { - $i = $m->add($c); - $i->moveTo($x, $y); + $i = $m->add($c); + $i->moveTo($x, $y); } } - $m->add($s); + $m->add($s); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -2224,47 +2250,49 @@ header('Content-type: application/x-shockwave-flash'); <function>swfmorph</function> example -<?php +getShape1(); + $s->setLine(0,0,0,0); /* Note that this is backwards from normal shapes (left instead of right). I have no idea why, but this seems to work.. */ - $s->setLeftFill($s->addFill(0xff, 0, 0)); - $s->movePenTo(-1000,-1000); - $s->drawLine(2000,0); - $s->drawLine(0,2000); - $s->drawLine(-2000,0); - $s->drawLine(0,-2000); + $s->setLeftFill($s->addFill(0xff, 0, 0)); + $s->movePenTo(-1000,-1000); + $s->drawLine(2000,0); + $s->drawLine(0,2000); + $s->drawLine(-2000,0); + $s->drawLine(0,-2000); - $s = $p->getShape2(); - $s->setLine(60,0,0,0); - $s->setLeftFill($s->addFill(0, 0, 0xff)); - $s->movePenTo(0,-1000); - $s->drawLine(1000,1000); - $s->drawLine(-1000,1000); - $s->drawLine(-1000,-1000); - $s->drawLine(1000,-1000); + $s = $p->getShape2(); + $s->setLine(60,0,0,0); + $s->setLeftFill($s->addFill(0, 0, 0xff)); + $s->movePenTo(0,-1000); + $s->drawLine(1000,1000); + $s->drawLine(-1000,1000); + $s->drawLine(-1000,-1000); + $s->drawLine(1000,-1000); $m = new SWFMovie(); - $m->setDimension(3000,2000); - $m->setBackground(0xff, 0xff, 0xff); + $m->setDimension(3000,2000); + $m->setBackground(0xff, 0xff, 0xff); - $i = $m->add($p); - $i->moveTo(1500,1000); + $i = $m->add($p); + $i->moveTo(1500,1000); - for($r=0.0; $r<=1.0; $r+=0.1) + for($r=0.0; $r<=1.0; $r+=0.1) { - $i->setRatio($r); - $m->nextFrame(); + $i->setRatio($r); + $m->nextFrame(); } header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -2347,23 +2375,25 @@ header('Content-type: application/x-shockwave-flash'); <function>swftext</function> example -<?php +setFont($f); + $t->moveTo(200, 2400); + $t->setColor(0xff, 0xff, 0); + $t->setHeight(1200); + $t->addString("PHP generates Flash with Ming!!"); $m = new SWFMovie(); - $m->setDimension(5400, 3600); + $m->setDimension(5400, 3600); - $m->add($t); + $m->add($t); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -2564,9 +2594,11 @@ header('Content-type: application/x-shockwave-flash'); the movie player. The fonts _serif, _sans, and _typewriter should always be available. For example: -<?php + +]]> will give you the standard sans-serif font, probably the same as what you'd get with <font name="sans-serif"> in HTML. @@ -2665,9 +2697,11 @@ $f = newSWFFont("_sans"); Flags are combined with the bitwise OR operation. For example, -<?php + +]]> creates a totally useless non-editable password field. @@ -2978,40 +3012,42 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); <function>swfsprite</function> example -<?php +setRightFill($s->addFill(0xff, 0, 0)); + $s->movePenTo(-500,-500); + $s->drawLineTo(500,-500); + $s->drawLineTo(500,500); + $s->drawLineTo(-500,500); + $s->drawLineTo(-500,-500); $p = new SWFSprite(); - $i = $p->add($s); - $p->nextFrame(); - $i->rotate(15); - $p->nextFrame(); - $i->rotate(15); - $p->nextFrame(); - $i->rotate(15); - $p->nextFrame(); - $i->rotate(15); - $p->nextFrame(); - $i->rotate(15); - $p->nextFrame(); + $i = $p->add($s); + $p->nextFrame(); + $i->rotate(15); + $p->nextFrame(); + $i->rotate(15); + $p->nextFrame(); + $i->rotate(15); + $p->nextFrame(); + $i->rotate(15); + $p->nextFrame(); + $i->rotate(15); + $p->nextFrame(); $m = new SWFMovie(); - $i = $m->add($p); - $i->moveTo(1500,1000); - $i->setName("blah"); + $i = $m->add($p); + $i->moveTo(1500,1000); + $i->setName("blah"); - $m->setBackground(0xff, 0xff, 0xff); - $m->setDimension(3000,2000); + $m->setBackground(0xff, 0xff, 0xff); + $m->setDimension(3000,2000); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -3144,7 +3180,8 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); <function>swfbutton</function> example -<?php +setFont($f); + $t->addString($string); + $t->setHeight(200); + $t->setBounds(3200,200); return $t; } function addLabel($string) { global $p; - $i = $p->add(label($string)); - $p->nextFrame(); - $p->remove($i); + $i = $p->add(label($string)); + $p->nextFrame(); + $p->remove($i); } - $p->add(new SWFAction("stop();")); + $p->add(new SWFAction("stop();")); addLabel("NO ACTION"); addLabel("SWFBUTTON_MOUSEUP"); addLabel("SWFBUTTON_MOUSEDOWN"); @@ -3183,54 +3220,55 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); function rect($r, $g, $b) { $s = new SWFShape(); - $s->setRightFill($s->addFill($r, $g, $b)); - $s->drawLine(600,0); - $s->drawLine(0,600); - $s->drawLine(-600,0); - $s->drawLine(0,-600); + $s->setRightFill($s->addFill($r, $g, $b)); + $s->drawLine(600,0); + $s->drawLine(0,600); + $s->drawLine(-600,0); + $s->drawLine(0,-600); return $s; } $b = new SWFButton(); - $b->addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT); - $b->addShape(rect(0, 0xff, 0), SWFBUTTON_OVER); - $b->addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN); + $b->addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT); + $b->addShape(rect(0, 0xff, 0), SWFBUTTON_OVER); + $b->addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN); - $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"), + $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"), SWFBUTTON_MOUSEUP); - $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"), + $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"), SWFBUTTON_MOUSEDOWN); - $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"), + $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"), SWFBUTTON_MOUSEOVER); - $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"), + $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"), SWFBUTTON_MOUSEOUT); - $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"), + $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"), SWFBUTTON_MOUSEUPOUTSIDE); - $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"), + $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"), SWFBUTTON_DRAGOVER); - $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"), + $b->addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"), SWFBUTTON_DRAGOUT); $m = new SWFMovie(); - $m->setDimension(4000,3000); + $m->setDimension(4000,3000); - $i = $m->add($p); - $i->setName("label"); - $i->moveTo(400,1900); + $i = $m->add($p); + $i->setName("label"); + $i->moveTo(400,1900); - $i = $m->add($b); - $i->moveTo(400,900); + $i = $m->add($b); + $i->moveTo(400,900); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -3240,36 +3278,38 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); <function>swfbutton->addaction</function> example -<?php +setRightFill($s->addFill(0xff, 0, 0)); + $s->drawLine(1000,0); + $s->drawLine(0,1000); + $s->drawLine(-1000,0); + $s->drawLine(0,-1000); $b = new SWFButton(); - $b->addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER); + $b->addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER); - $b->addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse + $b->addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse SWFBUTTON_MOUSEDOWN); - $b->addAction(new SWFAction("stopDrag();"), + $b->addAction(new SWFAction("stopDrag();"), SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE); $p = new SWFSprite(); - $p->add($b); - $p->nextFrame(); + $p->add($b); + $p->nextFrame(); $m = new SWFMovie(); - $i = $m->add($p); - $i->setName('test'); - $i->moveTo(1000,1000); + $i = $m->add($p); + $i->setName('test'); + $i->moveTo(1000,1000); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -3870,45 +3910,47 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); <function>swfaction</function> example -<?php +addFill(0xff, 0, 0); + $s->setRightFill($f); - $s->movePenTo(-500,-500); - $s->drawLineTo(500,-500); - $s->drawLineTo(500,500); - $s->drawLineTo(-500,500); - $s->drawLineTo(-500,-500); + $s->movePenTo(-500,-500); + $s->drawLineTo(500,-500); + $s->drawLineTo(500,500); + $s->drawLineTo(-500,500); + $s->drawLineTo(-500,-500); $p = new SWFSprite(); - $i = $p->add($s); - $i->setDepth(1); - $p->nextFrame(); + $i = $p->add($s); + $i->setDepth(1); + $p->nextFrame(); - for($n=0; $n<5; ++$n) + for($n=0; $n<5; ++$n) { - $i->rotate(-15); - $p->nextFrame(); + $i->rotate(-15); + $p->nextFrame(); } $m = new SWFMovie(); - $m->setBackground(0xff, 0xff, 0xff); - $m->setDimension(6000,4000); + $m->setBackground(0xff, 0xff, 0xff); + $m->setDimension(6000,4000); - $i = $m->add($p); - $i->setDepth(1); - $i->moveTo(-500,2000); - $i->setName("box"); + $i = $m->add($p); + $i->setDepth(1); + $i->moveTo(-500,2000); + $i->setName("box"); - $m->add(new SWFAction("/box.x += 3;")); - $m->nextFrame(); - $m->add(new SWFAction("gotoFrame(0); play();")); - $m->nextFrame(); + $m->add(new SWFAction("/box.x += 3;")); + $m->nextFrame(); + $m->add(new SWFAction("gotoFrame(0); play();")); + $m->nextFrame(); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -3917,75 +3959,76 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); <function>swfaction</function> example -<?php +setRate(36.0); + $m->setDimension(1200, 800); + $m->setBackground(0, 0, 0); /* mouse tracking sprite - empty, but follows mouse so we can get its x and y coordinates */ - $i = $m->add(new SWFSprite()); - $i->setName('mouse'); + $i = $m->add(new SWFSprite()); + $i->setName('mouse'); - $m->add(new SWFAction(" + $m->add(new SWFAction(" startDrag('/mouse', 1); /* '1' means lock sprite to the mouse */ ")); /* might as well turn off antialiasing, since these are just squares. */ - $m->add(new SWFAction(" + $m->add(new SWFAction(" this.quality = 0; ")); /* morphing box */ $r = new SWFMorph(); - $s = $r->getShape1(); + $s = $r->getShape1(); /* Note this is backwards from normal shapes. No idea why. */ - $s->setLeftFill($s->addFill(0xff, 0xff, 0xff)); - $s->movePenTo(-40, -40); - $s->drawLine(80, 0); - $s->drawLine(0, 80); - $s->drawLine(-80, 0); - $s->drawLine(0, -80); + $s->setLeftFill($s->addFill(0xff, 0xff, 0xff)); + $s->movePenTo(-40, -40); + $s->drawLine(80, 0); + $s->drawLine(0, 80); + $s->drawLine(-80, 0); + $s->drawLine(0, -80); - $s = $r->getShape2(); + $s = $r->getShape2(); - $s->setLeftFill($s->addFill(0x00, 0x00, 0x00)); - $s->movePenTo(-1, -1); - $s->drawLine(2, 0); - $s->drawLine(0, 2); - $s->drawLine(-2, 0); - $s->drawLine(0, -2); + $s->setLeftFill($s->addFill(0x00, 0x00, 0x00)); + $s->movePenTo(-1, -1); + $s->drawLine(2, 0); + $s->drawLine(0, 2); + $s->drawLine(-2, 0); + $s->drawLine(0, -2); /* sprite container for morphing box - this is just a timeline w/ the box morphing */ $box = new SWFSprite(); - $box->add(new SWFAction(" + $box->add(new SWFAction(" stop(); ")); - $i = $box->add($r); + $i = $box->add($r); - for($n=0; $n<=20; ++$n) + for($n=0; $n<=20; ++$n) { - $i->setRatio($n/20); - $box->nextFrame(); + $i->setRatio($n/20); + $box->nextFrame(); } /* this container sprite allows us to use the same action code many times */ $cell = new SWFSprite(); - $i = $cell->add($box); - $i->setName('box'); + $i = $cell->add($box); + $i->setName('box'); - $cell->add(new SWFAction(" + $cell->add(new SWFAction(" setTarget('box'); @@ -3996,31 +4039,31 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); ")); - $cell->nextFrame(); - $cell->add(new SWFAction(" + $cell->nextFrame(); + $cell->add(new SWFAction(" gotoFrame(0); play(); ")); - $cell->nextFrame(); + $cell->nextFrame(); /* finally, add a bunch of the cells to the movie */ - for($x=0; $x<12; ++$x) + for($x=0; $x<12; ++$x) { - for($y=0; $y<8; ++$y) + for($y=0; $y<8; ++$y) { - $i = $m->add($cell); - $i->moveTo(100*$x+50, 100*$y+50); + $i = $m->add($cell); + $i->moveTo(100*$x+50, 100*$y+50); } } - $m->nextFrame(); + $m->nextFrame(); - $m->add(new SWFAction(" + $m->add(new SWFAction(" gotoFrame(1); play(); @@ -4028,8 +4071,9 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); ")); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -4038,13 +4082,14 @@ $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); <function>swfaction</function> example -<?php +setDimension(11000, 8000); + $m->setBackground(0x00, 0x00, 0x00); - $m->add(new SWFAction(" + $m->add(new SWFAction(" this.quality = 0; /frames.visible = 0; @@ -4054,56 +4099,56 @@ startDrag('/mouse', 1); // mouse tracking sprite $t = new SWFSprite(); - $i = $m->add($t); - $i->setName('mouse'); + $i = $m->add($t); + $i->setName('mouse'); $g = new SWFGradient(); - $g->addEntry(0, 0xff, 0xff, 0xff, 0xff); - $g->addEntry(0.1, 0xff, 0xff, 0xff, 0xff); - $g->addEntry(0.5, 0xff, 0xff, 0xff, 0x5f); - $g->addEntry(1.0, 0xff, 0xff, 0xff, 0); + $g->addEntry(0, 0xff, 0xff, 0xff, 0xff); + $g->addEntry(0.1, 0xff, 0xff, 0xff, 0xff); + $g->addEntry(0.5, 0xff, 0xff, 0xff, 0x5f); + $g->addEntry(1.0, 0xff, 0xff, 0xff, 0); // gradient shape thing $s = new SWFShape(); - $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); - $f->scaleTo(0.03); - $s->setRightFill($f); - $s->movePenTo(-600, -600); - $s->drawLine(1200, 0); - $s->drawLine(0, 1200); - $s->drawLine(-1200, 0); - $s->drawLine(0, -1200); + $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT); + $f->scaleTo(0.03); + $s->setRightFill($f); + $s->movePenTo(-600, -600); + $s->drawLine(1200, 0); + $s->drawLine(0, 1200); + $s->drawLine(-1200, 0); + $s->drawLine(0, -1200); // need to make this a sprite so we can multColor it $p = new SWFSprite(); - $p->add($s); - $p->nextFrame(); + $p->add($s); + $p->nextFrame(); // put the shape in here, each frame a different color $q = new SWFSprite(); - $q->add(new SWFAction("gotoFrame(random(7)+1); stop();")); - $i = $q->add($p); + $q->add(new SWFAction("gotoFrame(random(7)+1); stop();")); + $i = $q->add($p); - $i->multColor(1.0, 1.0, 1.0); - $q->nextFrame(); - $i->multColor(1.0, 0.5, 0.5); - $q->nextFrame(); - $i->multColor(1.0, 0.75, 0.5); - $q->nextFrame(); - $i->multColor(1.0, 1.0, 0.5); - $q->nextFrame(); - $i->multColor(0.5, 1.0, 0.5); - $q->nextFrame(); - $i->multColor(0.5, 0.5, 1.0); - $q->nextFrame(); - $i->multColor(1.0, 0.5, 1.0); - $q->nextFrame(); + $i->multColor(1.0, 1.0, 1.0); + $q->nextFrame(); + $i->multColor(1.0, 0.5, 0.5); + $q->nextFrame(); + $i->multColor(1.0, 0.75, 0.5); + $q->nextFrame(); + $i->multColor(1.0, 1.0, 0.5); + $q->nextFrame(); + $i->multColor(0.5, 1.0, 0.5); + $q->nextFrame(); + $i->multColor(0.5, 0.5, 1.0); + $q->nextFrame(); + $i->multColor(1.0, 0.5, 1.0); + $q->nextFrame(); // finally, this one contains the action code $p = new SWFSprite(); - $i = $p->add($q); - $i->setName('frames'); - $p->add(new SWFAction(" + $i = $p->add($q); + $i->setName('frames'); + $p->add(new SWFAction(" dx = (/:mousex-/:lastx)/3 + random(10)-5; dy = (/:mousey-/:lasty)/3; @@ -4112,9 +4157,9 @@ y = /:mousey; alpha = 100; ")); - $p->nextFrame(); + $p->nextFrame(); - $p->add(new SWFAction(" + $p->add(new SWFAction(" this.x = x; this.y = y; @@ -4125,16 +4170,16 @@ dy += 3; alpha -= 8; ")); - $p->nextFrame(); + $p->nextFrame(); - $p->add(new SWFAction("prevFrame(); play();")); - $p->nextFrame(); + $p->add(new SWFAction("prevFrame(); play();")); + $p->nextFrame(); - $i = $m->add($p); - $i->setName('frames'); - $m->nextFrame(); + $i = $m->add($p); + $i->setName('frames'); + $m->nextFrame(); - $m->add(new SWFAction(" + $m->add(new SWFAction(" lastx = mousex; lasty = mousey; @@ -4146,17 +4191,18 @@ mousey = /mouse.y; if(num == 11) num = 1; -removeClip('char' & num); -duplicateClip(/frames, 'char' & num, num); +removeClip('char' & num); +duplicateClip(/frames, 'char' & num, num); ")); - $m->nextFrame(); - $m->add(new SWFAction("prevFrame(); play();")); + $m->nextFrame(); + $m->add(new SWFAction("prevFrame(); play();")); header('Content-type: application/x-shockwave-flash'); - $m->output(); -?> + $m->output(); +?> +]]> @@ -4169,46 +4215,47 @@ duplicateClip(/frames, 'char' & num, num); <function>swfaction</function> example -<?php +add(new SWFAction("stop();")); $chars = "abcdefghijklmnopqrstuvwxyz". "ABCDEFGHIJKLMNOPQRSTUVWXYZ". - "1234567890!@#$%^&*()_+-=/[]{}|;:,.<>?`~"; + "1234567890!@#$%^&/*()_+-=/[]{}|;:,.<>?`~"; $f = new SWFFont("_sans"); for($n=0; $nremove($i); $t = new SWFTextField(); - $t->setFont($f); - $t->setHeight(240); - $t->setBounds(600,240); - $t->align(SWFTEXTFIELD_ALIGN_CENTER); - $t->addString($c); - $i = $p->add($t); - $p->labelFrame($c); - $p->nextFrame(); + $t->setFont($f); + $t->setHeight(240); + $t->setBounds(600,240); + $t->align(SWFTEXTFIELD_ALIGN_CENTER); + $t->addString($c); + $i = $p->add($t); + $p->labelFrame($c); + $p->nextFrame(); } /* hit region for button - the entire frame */ $s = new SWFShape(); - $s->setFillStyle0($s->addSolidFill(0, 0, 0, 0)); - $s->drawLine(600, 0); - $s->drawLine(0, 400); - $s->drawLine(-600, 0); - $s->drawLine(0, -400); + $s->setFillStyle0($s->addSolidFill(0, 0, 0, 0)); + $s->drawLine(600, 0); + $s->drawLine(0, 400); + $s->drawLine(-600, 0); + $s->drawLine(0, -400); /* button checks for pressed key, sends sprite to the right frame */ $b = new SWFButton(); - $b->addShape($s, SWFBUTTON_HIT); + $b->addShape($s, SWFBUTTON_HIT); for($n=0; $naddAction(new SWFAction(" @@ -4219,17 +4266,18 @@ gotoFrame('$c'); } $m = new SWFMovie(); - $m->setDimension(600,400); - $i = $m->add($p); - $i->setName('char'); - $i->moveTo(0,80); + $m->setDimension(600,400); + $i = $m->add($p); + $i->setName('char'); + $i->moveTo(0,80); - $m->add($b); + $m->add($b); header('Content-type: application/x-shockwave-flash'); - $m->output(); + $m->output(); -?> +?> +]]> diff --git a/functions/misc.xml b/functions/misc.xml index 5093228fac..3100fdd28d 100644 --- a/functions/misc.xml +++ b/functions/misc.xml @@ -1,5 +1,5 @@ - + Miscellaneous functions Misc. @@ -117,14 +117,16 @@ <function>constant</function> example -<php + +]]> @@ -175,7 +177,8 @@ echo constant("MAXSIZE"); // same thing as the previous line Defining Constants -<?php + +]]> @@ -223,11 +227,13 @@ echo Greeting; // outputs "Hello you." Checking Constants -<?php + +]]> @@ -298,23 +304,27 @@ if (defined("CONSTANT")){ // Note that it should be quoted eval example - simple text merge -<?php +'; echo $str; eval ("\$str = \"$str\";"); echo $str; -?> +?> +]]> - - The above example will show: - + + +]]> + + + @@ -359,13 +369,15 @@ This is a cup with my coffee in it. <function>exit</function> example -<?php + +]]> @@ -418,17 +430,19 @@ $file = fopen ($filename, 'r') <function>get_browser</function> example -<?php +$key: $value
\n"; } return $str; } -echo "$HTTP_USER_AGENT<hr>\n"; +echo "$HTTP_USER_AGENT
\n"; $browser = get_browser(); echo list_array ((array) $browser); -?> +?> +]]>
@@ -436,26 +450,28 @@ echo list_array ((array) $browser); The output of the above script would look something like this: -Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr> -<b>browser_name_pattern:</b> Mozilla/4\.5.*<br> -<b>parent:</b> Netscape 4.0<br> -<b>platform:</b> Unknown<br> -<b>majorver:</b> 4<br> -<b>minorver:</b> 5<br> -<b>browser:</b> Netscape<br> -<b>version:</b> 4<br> -<b>frames:</b> 1<br> -<b>tables:</b> 1<br> -<b>cookies:</b> 1<br> -<b>backgroundsounds:</b> <br> -<b>vbscript:</b> <br> -<b>javascript:</b> 1<br> -<b>javaapplets:</b> 1<br> -<b>activexcontrols:</b> <br> -<b>beta:</b> <br> -<b>crawler:</b> <br> -<b>authenticodeupdate:</b> <br> -<b>msn:</b> <br> + +browser_name_pattern: Mozilla/4\.5.*
+parent: Netscape 4.0
+platform: Unknown
+majorver: 4
+minorver: 5
+browser: Netscape
+version: 4
+frames: 1
+tables: 1
+cookies: 1
+backgroundsounds:
+vbscript:
+javascript: 1
+javaapplets: 1
+activexcontrols:
+beta:
+crawler:
+authenticodeupdate:
+msn:
+]]>
In order for this to work, your Creating a source highlighting URL To setup a URL that can code hightlight any script that you pass to - it, we will make use of the "ForceType" directive in + it, we will make use of the "ForceType" directive in Apache to generate a nice URL pattern, and use the function highlight_file to show a nice looking code list. @@ -516,50 +532,57 @@ Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr> - -<Location /source> + + ForceType application/x-httpd-php -</Location> - + +]]> +
+ - And then make a file named "source" and put it in your + And then make a file named "source" and put it in your web root directory. -<HTML> -<HEAD> -<TITLE>Source Display</TITLE> -</HEAD> -<BODY BGCOLOR="white"> -<?php - $script = getenv ("PATH_TRANSLATED"); + + +Source Display + + +ERROR: Script Name needed
"; } else { - if (ereg("(\.php|\.inc)$",$script)) { - echo "<H1>Source of: $PATH_INFO</H1>\n<HR>\n"; + if (ereg("(\.php|\.inc)$",$script)) { + echo "

Source of: $PATH_INFO

\n
\n"; highlight_file($script); } else { - echo "<H1>ERROR: Only PHP or include script names are allowed</H1>"; + echo "

ERROR: Only PHP or include script names are allowed

"; } } - echo "<HR>Processed: ".date("Y/M/d H:i:s",time()); -?> -</BODY> -</HTML> + echo "
Processed: ".date("Y/M/d H:i:s",time()); +?> + + +]]>
Then you can use an URL like the one below to display a colorized - version of a script located in "/path/to/script.php" + version of a script located in "/path/to/script.php" in your web site. + @@ -821,7 +844,9 @@ http://your.server.com/source/path/to/script.php <function>pack</function> format string + The resulting binary string will be 6 bytes long and contain @@ -954,8 +979,10 @@ $binarydata = pack ("nvc*", 0x1234, 0x5678, 65, 66); it is recommended that you use something along the lines of + @@ -993,7 +1020,9 @@ $better_token = md5 (uniqid (rand())); // better, difficult to guess <function>unpack</function> format string + The resulting array will contain the entries "chars1", diff --git a/functions/mnogosearch.xml b/functions/mnogosearch.xml index f5f8cae774..b9682cca5c 100644 --- a/functions/mnogosearch.xml +++ b/functions/mnogosearch.xml @@ -1,5 +1,5 @@ - + mnoGoSearch Functions mnoGoSearch @@ -228,9 +228,11 @@ Example: - if (Udm_Api_Version() >= 30111) { - print "Total number of urls in database: ".Udm_Get_Doc_Count($udm)."<br>\n"; += 30111) { + print "Total number of urls in database: ".Udm_Get_Doc_Count($udm)."
\n"; } +]]>
diff --git a/functions/msql.xml b/functions/msql.xml index 879b660c17..9c000da447 100644 --- a/functions/msql.xml +++ b/functions/msql.xml @@ -1,5 +1,5 @@ - + mSQL functions mSQL @@ -1125,16 +1125,18 @@ <function>msql_tablename</function> example -<?php +"; + echo $tb_names[$i] . "
"; $i++; } ?> +]]>
diff --git a/functions/mssql.xml b/functions/mssql.xml index a9963abbfc..f76919fadc 100644 --- a/functions/mssql.xml +++ b/functions/mssql.xml @@ -1,5 +1,5 @@ - + Microsoft SQL Server functions MS SQL Server @@ -497,7 +497,8 @@ <function>mssql_next_result</function> example -<?php + +]]> diff --git a/functions/mysql.xml b/functions/mysql.xml index a9f924c0e5..9de3661c99 100644 --- a/functions/mysql.xml +++ b/functions/mysql.xml @@ -1,5 +1,5 @@ - + MySQL Functions MySQL @@ -215,12 +215,14 @@ mysql_close($link); MySQL close example -<?php + +]]> @@ -300,12 +302,14 @@ mysql_close($link); MySQL connect example -<?php + +]]> See also @@ -344,7 +348,8 @@ mysql_close($link); MySQL create database example -<?php + +]]> @@ -394,7 +400,8 @@ mysql_close($link); MySQL data seek example -<?php +last_name $row->first_name
\n"; } mysql_free_result ($result); -?> +?> +]]>
@@ -461,7 +469,8 @@ mysql_close($link); <function>mysql_db_name</function> example -<?php + +]]> @@ -597,18 +607,20 @@ while ($i < $cnt) { error code from the most recently executed MySQL function (not including mysql_error and mysql_errno), so if you want to use it, - make sure you check the value before calling another mySQL - function. + make sure you check the value before calling another mySQL + function. -<?php +"; +echo mysql_errno().": ".mysql_error()."
"; mysql_select_db("nonexistentdb"); -echo mysql_errno().": ".mysql_error()."<BR>"; +echo mysql_errno().": ".mysql_error()."
"; $conn = mysql_query("SELECT * FROM nonexistenttable"); -echo mysql_errno().": ".mysql_error()."<BR>"; -?> +echo mysql_errno().": ".mysql_error()."
"; +?> +]]>
@@ -652,14 +664,16 @@ echo mysql_errno().": ".mysql_error()."<BR>"; sure you check the value before calling another MySQL function. -<?php +"; +echo mysql_errno().": ".mysql_error()."
"; mysql_select_db("nonexistentdb"); -echo mysql_errno().": ".mysql_error()."<BR>"; +echo mysql_errno().": ".mysql_error()."
"; $conn = mysql_query("SELECT * FROM nonexistenttable"); -echo mysql_errno().": ".mysql_error()."<BR>"; -?> +echo mysql_errno().": ".mysql_error()."
"; +?> +]]>
@@ -734,8 +748,10 @@ echo mysql_errno().": ".mysql_error()."<BR>"; access the contents with the original column name (by using 'field' in this example). - + +
@@ -768,17 +784,19 @@ select tone.field as foo ttwo.field as bar from tone, ttwo <function>mysql_fetch_array</function> example -<?php +\n"; - echo "user_id: ".$row[0]."<br>\n"; - echo "fullname: ".$row["fullname"]."<br>\n"; - echo "fullname: ".$row[1]."<br>\n"; + echo "user_id: ".$row["user_id"]."
\n"; + echo "user_id: ".$row[0]."
\n"; + echo "fullname: ".$row["fullname"]."
\n"; + echo "fullname: ".$row[1]."
\n"; } mysql_free_result ($result); -?> +?> +]]>
@@ -834,7 +852,8 @@ mysql_free_result ($result); <function>mysql_fetch_assoc</function> -<?php + +]]> @@ -945,20 +965,21 @@ mysql_free_result ($result); <function>mysql_fetch_field</function> -<?php +\n"; +while ($i < mysql_num_fields ($result)) { + echo "Information for column $i:
\n"; $meta = mysql_fetch_field ($result); if (!$meta) { - echo "No information available<BR>\n"; + echo "No information available
\n"; } - echo "<PRE> + echo "
 blob:         $meta->blob
 max_length:   $meta->max_length
 multiple_key: $meta->multiple_key
@@ -971,11 +992,12 @@ type:         $meta->type
 unique_key:   $meta->unique_key
 unsigned:     $meta->unsigned
 zerofill:     $meta->zerofill
-</PRE>";
+
"; $i++; } mysql_free_result ($result); -?> +?> +]]>
@@ -1062,7 +1084,8 @@ mysql_free_result ($result); <function>mysql_fetch_object</function> example -<?php +fullname; } mysql_free_result ($result); -?> +?> +]]> @@ -1188,6 +1212,7 @@ mysql_free_result ($result); <function>mysql_field_name</function> example + - -
- - The above example would produce the following output: - - + + The above example would produce the following output: + + - +]]> + + +
For downwards compatibility mysql_fieldname @@ -1324,7 +1350,8 @@ password MySQL field types -<?php +"; -echo "The table has the following fields <BR>"; -while ($i < $fields) { +echo "Your '".$table."' table has ".$fields." fields and ".$rows." records
"; +echo "The table has the following fields
"; +while ($i < $fields) { $type = mysql_field_type ($result, $i); $name = mysql_field_name ($result, $i); $len = mysql_field_len ($result, $i); $flags = mysql_field_flags ($result, $i); - echo $type." ".$name." ".$len." ".$flags."<BR>"; + echo $type." ".$name." ".$len." ".$flags."
"; $i++; } mysql_close(); -?> +?> +]]>
@@ -1475,25 +1503,29 @@ mysql_close(); <function>mysql_list_dbs</function> example +Database . "\n"; } +?> +]]> - - - - The above example would produce the following output: - - + + The above example would produce the following output: + + - +]]> + + +
@@ -1543,27 +1575,30 @@ database3 <function>mysql_list_fields</function> example + - - - - The above example would produce the following output: - - + + The above example would produce the following output: + + - +]]> + + + For downward compatibility mysql_listfields @@ -1660,7 +1695,8 @@ field3 <function>mysql_num_rows</function> example -<?php + +]]> @@ -1818,10 +1855,12 @@ echo "$num_rows Rows\n"; <function>mysql_query</function> -<?php + +]]> @@ -1833,10 +1872,12 @@ $result = mysql_query ("SELECT * WHERE 1=1") <function>mysql_query</function> -<?php + +]]> @@ -2044,16 +2085,18 @@ $result = mysql_query ("SELECT my_col FROM my_tbl") <function>mysql_tablename</function> Example -<?php +"; + echo $tb_names[$i] . "
"; $i++; } -?> +?> +]]>
diff --git a/functions/network.xml b/functions/network.xml index 22344d696d..ad97a16a5b 100644 --- a/functions/network.xml +++ b/functions/network.xml @@ -1,5 +1,5 @@ - + Network Functions Network @@ -214,9 +214,11 @@ <function>fsockopen</function> Example +\n"; } else { fputs ($fp, "GET / HTTP/1.0\r\n\r\n"); while (!feof($fp)) { @@ -224,6 +226,8 @@ if (!$fp) { } fclose ($fp); } +?> +]]> The example below shows how to retrieve the day and time @@ -231,16 +235,18 @@ if (!$fp) { Using UDP connection +\n"; } else { fwrite($fp,"\n"); echo fread($fp, 26); fclose($fp); } -?> +?> +]]> @@ -512,12 +518,14 @@ if (!$fp) { <function>ip2long</function> Example -<?php +\n"; +$out .= "http://www.php.net/, http://".$ip."/, and http://".sprintf("%u",ip2long($ip))."/
\n"; echo $out; -?> +?> +]]>
@@ -533,11 +541,13 @@ echo $out; Displaying an IP address -<?php + +]]> @@ -868,7 +878,8 @@ echo $out; <function>socket_set_timeout</function> Example -<?php + +]]> @@ -970,12 +982,13 @@ if(!$fp) { Using <function>syslog</function> -<?php + +]]> For information on setting up a user defined log handler, see the diff --git a/functions/nis.xml b/functions/nis.xml index d1d8d46e5d..21d429fcda 100644 --- a/functions/nis.xml +++ b/functions/nis.xml @@ -1,5 +1,5 @@ - + YP/NIS Functions YP/NIS @@ -47,10 +47,12 @@ Example for the default domain -<?php + +]]> @@ -85,10 +87,12 @@ echo "Default NIS domain is: " . $domain; Example for the NIS order -<?php + +]]> @@ -126,10 +130,12 @@ echo "Default NIS domain is: " . $domain; Example for the NIS master -<?php + +]]> @@ -166,10 +172,12 @@ echo "Master for this map is: " . $master; Example for NIS match -<?php + +]]> @@ -211,12 +219,14 @@ echo "Matched entry is: " . $entry; Example for the NIS first -<?php + +]]> @@ -254,7 +264,8 @@ echo "First entry in this map has key " . $key . " and value " . $value; Example for NIS next -<?php + +]]> @@ -358,9 +370,11 @@ echo "The next entry after joe has key " . $key Example for NIS errors -<?php + +]]> diff --git a/functions/oci8.xml b/functions/oci8.xml index b95cc2d914..56ee963ba8 100644 --- a/functions/oci8.xml +++ b/functions/oci8.xml @@ -1,5 +1,5 @@ - + Oracle 8 functions OCI8 @@ -65,7 +65,8 @@ - + + /lib/libpthread.so.0 (0x4001c000) libm.so.6 => /lib/libm.so.6 (0x4002f000) @@ -73,7 +74,8 @@ libdl.so.2 => /lib/libdl.so.2 (0x4007a000) libc.so.6 => /lib/libc.so.6 (0x4007e000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) - +]]> + @@ -81,13 +83,15 @@ - + + +]]> + @@ -95,7 +99,8 @@ OCI Hints -<?php +load(); // For INSERT or UPDATE statement use: @@ -112,12 +117,12 @@ $sql = "insert into table (field1, field2) values (field1 = 'value', field2 = empty_clob()) returning field2 into :field2"; OCIParse($conn, $sql); $clob = OCINewDescriptor($conn, OCI_D_LOB); -OCIBindByName ($stmt, ":field2", &$clob, -1, OCI_B_CLOB); +OCIBindByName ($stmt, ":field2", &$clob, -1, OCI_B_CLOB); OCIExecute($stmt, OCI_DEFAULT); -$clob->save ("some text"); +$clob->save ("some text"); OCICommit($conn); -?> +?> @@ -127,7 +132,8 @@ OCICommit($conn); Using Stored Procedures -<?php + +]]> @@ -184,7 +191,8 @@ $sth = OCIParse ( $dbh, "begin sp_newaddress( :address_id, '$firstname', OCIDefineByName -<?php + +]]> @@ -256,7 +265,8 @@ OCILogoff($conn); OCIDefineByName -<?php + +]]> @@ -357,8 +368,9 @@ OCILogoff($conn); OCILogon -<?php -print "<HTML><PRE>"; +
";
 $db = "";
 
 $c1 = ocilogon("scott","tiger",$db);
@@ -404,7 +416,7 @@ function select_data($conn)
   ociexecute($stmt,OCI_DEFAULT);
   echo $conn."----selecting\n\n";
   while (ocifetch($stmt))
-    echo $conn." <".ociresult($stmt,"TEST").">\n\n";
+    echo $conn." <".ociresult($stmt,"TEST").">\n\n";
   echo $conn."----done\n\n";
 }
 
@@ -435,8 +447,12 @@ select_data($c2);   // no rows returned
 
 
 drop_table($c1);
-print "</PRE></HTML>";
-?>
+print "
"; +?> +]]> +
+
+ See also OCIPLogon and OCINLogon. @@ -518,8 +534,9 @@ print "</PRE></HTML>"; OCINLogon -<?php -print "<HTML><PRE>"; +
";
 $db = "";
 
 $c1 = ocilogon("scott","tiger",$db);
@@ -566,7 +583,7 @@ function select_data($conn)
   ociexecute($stmt,OCI_DEFAULT);
   echo $conn."----selecting\n\n";
   while (ocifetch($stmt))
-    echo $conn." <".ociresult($stmt,"TEST").">\n\n";
+    echo $conn." <".ociresult($stmt,"TEST").">\n\n";
   echo $conn."----done\n\n";
 }
 
@@ -596,8 +613,11 @@ select_data($c2);
 
 
 drop_table($c1);
-print "</PRE></HTML>";
-?>
+print "
"; +?> +]]> +
+
See also OCILogon and @@ -721,7 +741,8 @@ print "</PRE></HTML>"; OCINewDescriptor -<?php +</HTML>"; $conn = OCILogon($user, $password); $stmt = OCIParse($conn,"select rowid from $table $where"); $rowid = OCINewDescriptor($conn,OCI_D_ROWID); - OCIDefineByName($stmt,"ROWID",&$rowid); + OCIDefineByName($stmt,"ROWID",&$rowid); OCIExecute($stmt); while ( OCIFetch($stmt) ) { $nrows = OCIRowCount($stmt); $delete = OCIParse($conn,"delete from $table where ROWID = :rid"); - OCIBindByName($delete,":rid",&$rowid,-1,OCI_B_ROWID); + OCIBindByName($delete,":rid",&$rowid,-1,OCI_B_ROWID); OCIExecute($delete); print "$nrows\n"; if ( ($nrows % $commitsize) == 0 ) { @@ -748,29 +769,31 @@ print "</PRE></HTML>"; OCIFreeStatement($stmt); OCILogoff($conn); ?> +]]> -<?php + - * <input type="file" name="lob_upload"> + *
+ * * ... */ if(!isset($lob_upload) || $lob_upload == 'none'){ ?> -<form action="upload.php3" method="post" enctype="multipart/form-data"> -Upload file: <input type="file" name="lob_upload"><br> -<input type="submit" value="Upload"> - <input type="reset"> -</form> -<?php + +Upload file:
+ - +
+savefile($lob_upload)){ OCICommit($conn); @@ -783,12 +806,14 @@ Upload file: <input type="file" name="lob_upload"><br> OCILogoff($conn); } ?> +]]>
OCINewDescriptor -<?php += 4.0.6). * Example PL/SQL stored procedure signature is: @@ -813,6 +838,7 @@ Upload file: <input type="file" name="lob_upload"><br> $clob->free(); OCIFreeStatement($stmt); ?> +]]> @@ -839,24 +865,28 @@ Upload file: <input type="file" name="lob_upload"><br> OCIRowCount -<?php - print "<HTML><PRE>"; +
";
     $conn = OCILogon("scott","tiger");
     $stmt = OCIParse($conn,"create table emp2 as select * from emp");
     OCIExecute($stmt);
-    print OCIRowCount($stmt) . " rows inserted.<BR>";
+    print OCIRowCount($stmt) . " rows inserted.
"; OCIFreeStatement($stmt); $stmt = OCIParse($conn,"delete from emp2"); OCIExecute($stmt); - print OCIRowCount($stmt) . " rows deleted.<BR>"; + print OCIRowCount($stmt) . " rows deleted.
"; OCICommit($conn); OCIFreeStatement($stmt); $stmt = OCIParse($conn,"drop table emp2"); OCIExecute($stmt); OCIFreeStatement($stmt); OCILogOff($conn); - print "</PRE></HTML>"; -?> + print "
"; +?> +]]> +
+
@@ -883,15 +913,16 @@ Upload file: <input type="file" name="lob_upload"><br> OCINumCols -<?php - print "<HTML><PRE>\n"; +
\n";   
     $conn = OCILogon("scott", "tiger");
     $stmt = OCIParse($conn,"select * from emp");
     OCIExecute($stmt);
     while ( OCIFetch($stmt) ) {
         print "\n";   
         $ncols = OCINumCols($stmt);
-        for ( $i = 1; $i <= $ncols; $i++ ) {
+        for ( $i = 1; $i <= $ncols; $i++ ) {
             $column_name  = OCIColumnName($stmt,$i);
             $column_value = OCIResult($stmt,$i);
             print $column_name . ': ' . $column_value . "\n";
@@ -900,9 +931,10 @@ Upload file: <input type="file" name="lob_upload"><br>
     }
     OCIFreeStatement($stmt);  
     OCILogoff($conn);   
-    print "</PRE>";
-    print "</HTML>\n"; 
+    print "
"; + print "\n"; ?> +]]>
@@ -1025,7 +1057,8 @@ Upload file: <input type="file" name="lob_upload"><br> OCIFetchStatement -<?php + 0 ) { - print "<TABLE BORDER=\"1\">\n"; - print "<TR>\n"; + print "\n"; + print "\n"; while ( list( $key, $val ) = each( $results ) ) { - print "<TH>$key</TH>\n"; + print "\n"; } - print "</TR>\n"; + print "\n"; - for ( $i = 0; $i < $nrows; $i++ ) { + for ( $i = 0; $i < $nrows; $i++ ) { reset($results); - print "<TR>\n"; + print "\n"; while ( $column = each($results) ) { $data = $column['value']; - print "<TD>$data[$i]</TD>\n"; + print "\n"; } - print "</TR>\n"; + print "\n"; } - print "</TABLE>\n"; + print "
$key
$data[$i]
\n"; } else { - echo "No data found<BR>\n"; + echo "No data found
\n"; } -print "$nrows Records Selected<BR>\n"; +print "$nrows Records Selected
\n"; OCIFreeStatement($stmt); OCILogoff($conn); ?> +]]>
@@ -1112,33 +1146,35 @@ OCILogoff($conn); OCIColumnName -<?php - print "<HTML><PRE>\n"; +
\n";   
     $conn = OCILogon("scott", "tiger");
     $stmt = OCIParse($conn,"select * from emp");
     OCIExecute($stmt);
-    print "<TABLE BORDER=\"1\">";
-    print "<TR>";
-    print "<TH>Name</TH>";
-    print "<TH>Type</TH>";
-    print "<TH>Length</TH>";
-    print "</TR>";
+    print "";
+    print "";
+    print "";
+    print "";
+    print "";
+    print "";
     $ncols = OCINumCols($stmt);
-    for ( $i = 1; $i <= $ncols; $i++ ) {
+    for ( $i = 1; $i <= $ncols; $i++ ) {
         $column_name  = OCIColumnName($stmt,$i);
         $column_type  = OCIColumnType($stmt,$i);
         $column_size  = OCIColumnSize($stmt,$i);
-        print "<TR>";
-        print "<TD>$column_name</TD>";
-        print "<TD>$column_type</TD>";
-        print "<TD>$column_size</TD>";
-        print "</TR>";
+        print "";
+        print "";
+        print "";
+        print "";
+        print "";
     }
     OCIFreeStatement($stmt);  
     OCILogoff($conn);   
-    print "</PRE>";
-    print "</HTML>\n"; 
+    print "";
+    print "\n"; 
 ?>   
+]]>
       
@@ -1174,34 +1210,36 @@ OCILogoff($conn);
      
       OCIColumnSize
       
-<?php   
-    print "<HTML><PRE>\n";   
+
\n";   
     $conn = OCILogon("scott", "tiger");
     $stmt = OCIParse($conn,"select * from emp");
     OCIExecute($stmt);
-    print "<TABLE BORDER=\"1\">";
-    print "<TR>";
-    print "<TH>Name</TH>";
-    print "<TH>Type</TH>";
-    print "<TH>Length</TH>";
-    print "</TR>";
+    print "
NameTypeLength
$column_name$column_type$column_size
"; + print ""; + print ""; + print ""; + print ""; + print ""; $ncols = OCINumCols($stmt); - for ( $i = 1; $i <= $ncols; $i++ ) { + for ( $i = 1; $i <= $ncols; $i++ ) { $column_name = OCIColumnName($stmt,$i); $column_type = OCIColumnType($stmt,$i); $column_size = OCIColumnSize($stmt,$i); - print "<TR>"; - print "<TD>$column_name</TD>"; - print "<TD>$column_type</TD>"; - print "<TD>$column_size</TD>"; - print "</TR>"; + print ""; + print ""; + print ""; + print ""; + print ""; } - print "</TABLE>"; + print "
NameTypeLength
$column_name$column_type$column_size
"; OCIFreeStatement($stmt); OCILogoff($conn); - print "</PRE>"; - print "</HTML>\n"; + print "
"; + print "\n"; ?> +]]>
@@ -1236,33 +1274,35 @@ OCILogoff($conn); OCIColumnType -<?php - print "<HTML><PRE>\n"; +
\n";   
     $conn = OCILogon("scott", "tiger");
     $stmt = OCIParse($conn,"select * from emp");
     OCIExecute($stmt);
-    print "<TABLE BORDER=\"1\">";
-    print "<TR>";
-    print "<TH>Name</TH>";
-    print "<TH>Type</TH>";
-    print "<TH>Length</TH>";
-    print "</TR>";
+    print "";
+    print "";
+    print "";
+    print "";
+    print "";
+    print "";
     $ncols = OCINumCols($stmt);
-    for ( $i = 1; $i <= $ncols; $i++ ) {
+    for ( $i = 1; $i <= $ncols; $i++ ) {
         $column_name  = OCIColumnName($stmt,$i);
         $column_type  = OCIColumnType($stmt,$i);
         $column_size  = OCIColumnSize($stmt,$i);
-        print "<TR>";
-        print "<TD>$column_name</TD>";
-        print "<TD>$column_type</TD>";
-        print "<TD>$column_size</TD>";
-        print "</TR>";
+        print "";
+        print "";
+        print "";
+        print "";
+        print "";
     }
     OCIFreeStatement($stmt);  
     OCILogoff($conn);   
-    print "</PRE>";
-    print "</HTML>\n"; 
+    print "";
+    print "\n"; 
 ?>   
+]]>
       
@@ -1292,11 +1332,13 @@ OCILogoff($conn);
      
       OCIServerVersion
       
-<?php
+
+]]>
       
      
@@ -1335,19 +1377,21 @@ OCILogoff($conn);
      
       Code examples
       
-<?php
-    print "<HTML><PRE>";
+
";
     $conn = OCILogon("scott","tiger");
     $sql  = "delete from emp where deptno = 10";
    
     $stmt = OCIParse($conn,$sql);
     if ( OCIStatementType($stmt) == "DELETE" ) {
-        die "You are not allowed to delete from this table<BR>";
+        die "You are not allowed to delete from this table
"; } OCILogoff($conn); - print "</PRE></HTML>"; + print "
"; ?> +]]>
@@ -1377,18 +1421,19 @@ OCILogoff($conn); Using a REF CURSOR from a stored procedure -<?php + +]]> @@ -1403,39 +1449,41 @@ OCILogoff($conn); Using a REF CURSOR in a select statement -<?php -print "<HTML><BODY>"; +"; $conn = OCILogon("scott","tiger"); $count_cursor = "CURSOR(select count(empno) num_emps from emp " . "where emp.deptno = dept.deptno) as EMPCNT from dept"; $stmt = OCIParse($conn,"select deptno,dname,$count_cursor"); ociexecute($stmt); -print "<TABLE BORDER=\"1\">"; -print "<TR>"; -print "<TH>DEPT NAME</TH>"; -print "<TH>DEPT #</TH>"; -print "<TH># EMPLOYEES</TH>"; -print "</TR>"; +print "
NameTypeLength
$column_name$column_type$column_size
"; +print ""; +print ""; +print ""; +print ""; +print ""; while (OCIFetchInto($stmt,&$data,OCI_ASSOC)) { - print "<TR>"; + print ""; $dname = $data["DNAME"]; $deptno = $data["DEPTNO"]; - print "<TD>$dname</TD>"; - print "<TD>$deptno</TD>"; + print ""; + print ""; ociexecute($data[ "EMPCNT" ]); while (OCIFetchInto($data[ "EMPCNT" ],&$subdata,OCI_ASSOC)) { $num_emps = $subdata["NUM_EMPS"]; - print "<TD>$num_emps</TD>"; + print ""; } - print "</TR>"; + print ""; } -print "</TABLE>"; -print "</BODY></HTML>"; +print "
DEPT NAMEDEPT ## EMPLOYEES
$dname$deptno$num_emps
"; +print ""; OCIFreeStatement($stmt); OCILogoff($conn); ?> +]]> diff --git a/functions/openssl.xml b/functions/openssl.xml index 097bd6cc43..871476eded 100644 --- a/functions/openssl.xml +++ b/functions/openssl.xml @@ -1,5 +1,5 @@ - + OpenSSL functions OpenSSL @@ -206,9 +206,11 @@ <function>openssl_error_string</function> example + @@ -330,6 +332,7 @@ while($msg = openssl_error_string) <function>openssl_open</function> example + @@ -395,6 +399,7 @@ openssl_free_key($pkeyid); <function>openssl_seal</function> example + @@ -456,6 +462,7 @@ openssl_free_key($pk2); <function>openssl_sign</function> example + @@ -510,6 +518,7 @@ openssl_free_key($pkeyid); <function>openssl_verify</function> example + @@ -568,6 +578,7 @@ openssl_free_key($pubkeyid); <function>openssl_pkcs7_decrypt</function> example + @@ -625,10 +636,11 @@ else <function>openssl_pkcs7_encrypt</function> example + "nighthawk@agent.com", // keyed syntax + "From: HQ ", // indexed syntax + "Subject" => "Eyes only"))) { // message encrypted - send it! - exec(ini_get("sendmail_path") . " < enc.txt"); + exec(ini_get("sendmail_path") . " < enc.txt"); } +]]> @@ -710,9 +723,10 @@ if (openssl_pkcs7_encrypt("msg.txt", "enc.txt", "nighthawk.pem", <function>openssl_pkcs7_sign</function> example + "joes@sales.com", // keyed syntax + "From: HQ ", // indexed syntax + "Subject" => "Eyes only")) { // message signed - send it! exec(ini_get("sendmail_path") . " < signed.txt"); } +]]>