|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Sun Feb 02 2003 - 19:10:57 CST
php-general Digest 3 Feb 2003 01:10:57 -0000 Issue 1860
Topics (messages 133990 through 134068):
Re: Base64 Encode
133990 by: Stephen
133992 by: Lowell Allen
Re: Turn off PHP for certain directories?
133991 by: Tom Rogers
134022 by: Jason Wong
Re: Loading CSV data into MySQL
133993 by: Brian V Bonini
133994 by: Tom Rogers
134000 by: John W. Holmes
134017 by: Jason Wong
Re: MySQL/PHP Associative Array Insert
133995 by: Matt
help needed with form and mysql design.
133996 by: anders thoresson
134015 by: Jason Wong
Re: help with script!!!
133997 by: Sunfire
Re: using <input> tags with php
133998 by: Sunfire
Re: perl regex help
133999 by: John W. Holmes
Securing php files on shared servers
134001 by: Quinn Comendant
134021 by: John W. Holmes
Server Up-time
134002 by: OjMyStEr
including files...
134003 by: Sunfire
134014 by: Jason Wong
134020 by: John W. Holmes
134055 by: Justin French
134059 by: Sunfire
Sessions and MD5
134004 by: Chris LeBlanc
134016 by: Ernest E Vogelsinger
mailing with SMTP server requiring authentication
134005 by: Johan Köhne
134012 by: Jason Wong
134013 by: Weston Houghton
134035 by: Manuel Lemos
Re: PHP.ini help on Linux
134006 by: Michael Mauch
selecting from an array based on form content
134007 by: Peter Gumbrell
134019 by: John W. Holmes
134026 by: Peter Gumbrell
134036 by: John W. Holmes
134043 by: Peter Gumbrell
Re: Associative vs normal arrays
134008 by: no-spam----me.larrykagan.com
134045 by: Mark Charette
Barcodes...
134009 by: Chris Knipe
134031 by: Jason Sheets
134038 by: Cristian Ichim
134041 by: Cristian Ichim
index.php
134010 by: Renato Lopes
134011 by: Florin Dumitrescu
134040 by: Chris Shiflett
134053 by: Justin French
134057 by: John Nichel
Looping through the mysql_field_name function
134018 by: Davy Obdam
134025 by: Philip Olson
PHP version of ColdFusion CFParam
134023 by: Lon Lentz
134024 by: Philip Olson
134039 by: Chris Shiflett
PHP PDF parser and FFDB-php SQL wrapper
134027 by: zlu tarch
How can I display lastmodified for all my php-files?
134028 by: Øystein Håland
134032 by: Jason Sheets
134052 by: Øystein Håland
134054 by: Philip Olson
134058 by: Øystein Håland
134060 by: Øystein Håland
Ringtones and php
134029 by: John Nichel
safe mode problem
134030 by: Gurvinder Singh
how to write clean code.
134033 by: anders thoresson
134034 by: Jason Sheets
134046 by: rush
134066 by: Maxim Maletsky
134067 by: Luke Woollard
php/mysql connection
134037 by: Anthony Ritter
Help with include path
134042 by: César Aracena
134063 by: César Aracena
134064 by: John Nichel
question
134044 by: Karl James
134047 by: David Rice
134056 by: Justin French
listbox problems
134048 by: Sunfire
134049 by: Matt
134050 by: Philip Olson
134061 by: Sunfire
134065 by: Paul Chvostek
Text size in image
134051 by: Brian V Bonini
Directory size
134062 by: Antti
Date and time problem
134068 by: Denis L. Menezes
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
I have register globals off, and am using both $HTTP_GET_VARS['goto'] and
$_GET['goto']. The problem is not with receiving it, the problem is sending
it. Forexample, a sample URL would look something like this after
redirecting:
http://whatever.com/index.php?goto=
----- Original Message -----
From: "Evan Nemerson" <evan
coeus-group.com>
To: "Stephen" <webmaster
melchior.us>
Cc: <php-general
lists.php.net>
Sent: Sunday, February 02, 2003 2:24 AM
Subject: Re: [PHP] Base64 Encode
: What about $_GET['goto']??? Sounds like another register_globals issue.
Also,
: instead of base64 encoding, you may want to use the rawurlencode and
: rawurldecode functions.
:
:
:
: On Saturday 01 February 2003 07:02 pm, Stephen wrote:
: > I have a PHP script that works on older versions of PHP but on 4.3, it
: > outputs nothing. Here's my code:
: >
: > <?php
: > echo '<SCRIPT language="JavaScript" type="text/javascript">'."\n"
: > ."\n".'if (document.location == top.location)'."\n"
: > .' top.location="home.php?goto='
: > .base64_encode($_SERVER["REQUEST_URI"]).'";'."\n"
: > .'</SCRIPT>';
: > ?>
: >
: > The problem is, when it redirects, the URL variable goto is empty. I'm
: > assuming this has something to do with base64_encode. Since this code
: > snipet is on every page of my site, it'd be a hard hassle to change it
so
: > is there a setting in PHP I need to tweak or should I set aside a few
hours
: > to edit this code? If the latter, what should I change it to?
: >
: > Thanks,
: > Stephen Craton
: > http://www.melchior.us
: >
: > "What's the point in appearance if your true love, doesn't care about
: > it?" -- http://www.melchior.us
:
: --
: If anyone can show me, and prove to me, that I am wrong in thought or
deed, I
: will gladly change. I seek the truth, hich never yet hurt anybody. It is
only
: persistence in elf-delusion and ignorance which does harm.
:
: -Marcus Aurelius
:
:
: --
: PHP General Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:
:
:
attached mail follows:
> From: "Stephen" <webmaster
melchior.us>
>
> I have a PHP script that works on older versions of PHP but on 4.3, it
> outputs nothing. Here's my code:
>
> <?php
> echo '<SCRIPT language="JavaScript" type="text/javascript">'."\n"
> ."\n".'if (document.location == top.location)'."\n"
> .' top.location="home.php?goto='
> .base64_encode($_SERVER["REQUEST_URI"]).'";'."\n"
> .'</SCRIPT>';
> ?>
>
> The problem is, when it redirects, the URL variable goto is empty. I'm
> assuming this has something to do with base64_encode. Since this code snipet
> is on every page of my site, it'd be a hard hassle to change it so is there
> a setting in PHP I need to tweak or should I set aside a few hours to edit
> this code? If the latter, what should I change it to?
I hope this relates -- I use the code below as a "force frame", placing it
at the top of all content pages as an include. (In my case info.php posts to
index.php, which allows any content page that's called directly to be
returned in a frameset.)
<?
$path_array = explode("/", "$REQUEST_URI");
$page_name = array_pop($path_array);
?>
<script language="JavaScript">
<!--
if (top.location == self.location) {
top.location.href = "info.php?contents=" + "<?=$page_name?>"
}
// -->
</script>
-- Lowell Allen
attached mail follows:
Hi,
Sunday, February 2, 2003, 11:07:20 PM, you wrote: EEV> At 12:25 02.02.2003, Tom Rogers said: EEV> --------------------[snip]-------------------- >>you could try >> >>php_flag engine = Off EEV> --------------------[snip]--------------------
EEV> I've tried (this works): EEV> In the configuration for the virtual host: EEV> AllowOverride All
EEV> In .htaccess: EEV> AddType text/plain .php
EEV> engine=off returns an apache config error.
you need the php_flag bit
-- regards, Tom
attached mail follows:
On Sunday 02 February 2003 21:45, Tom Rogers wrote:
> you need the php_flag bit
To be explicit it should be
php_flag engine Off
NB there is no '=' sign.
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* We were so poor we couldn't afford a watchdog. If we heard a noise at night, we'd bark ourselves. -- Crazy Jimmy */
attached mail follows:
On Sat, 2003-02-01 at 20:07, John W. Holmes wrote: > > Then use an ORDER BY in your query. If you're relying on the database to > spit out rows in the order they went in, then you're wrong.
Hey man thanks for pointing that out... !!!! I know it's wrong, I didn't design it but it's what I have to work with and I'm not being paid to fix it. And quite frankly clients being as ignorant as they tend to be at times just know that its worked fine for years and don't want to hear that they have to spend money fixing something that as far as they can tell has always worked fine. That being said, in this instance, due to poor design, I need this stuff to be in there in a particular order. If that's not possible then I'll just have to suck it up and rebuild this thing for free but if I can find a way around that for the time being then....
attached mail follows:
Hi,
Monday, February 3, 2003, 12:09:59 AM, you wrote: BVB> On Sat, 2003-02-01 at 20:07, John W. Holmes wrote: >> >> Then use an ORDER BY in your query. If you're relying on the database to >> spit out rows in the order they went in, then you're wrong.
BVB> Hey man thanks for pointing that out... !!!! I know it's wrong, I didn't BVB> design it but it's what I have to work with and I'm not being paid to BVB> fix it. And quite frankly clients being as ignorant as they tend to be BVB> at times just know that its worked fine for years and don't want to hear BVB> that they have to spend money fixing something that as far as they can BVB> tell has always worked fine. That being said, in this instance, due to BVB> poor design, I need this stuff to be in there in a particular order. If BVB> that's not possible then I'll just have to suck it up and rebuild this BVB> thing for free but if I can find a way around that for the time being BVB> then....
Try creating an index on the field you want it ordered by
-- regards, Tom
attached mail follows:
> > Then use an ORDER BY in your query. If you're relying on the database to > > spit out rows in the order they went in, then you're wrong. > > Hey man thanks for pointing that out... !!!! I know it's wrong, I didn't > design it but it's what I have to work with and I'm not being paid to > fix it. And quite frankly clients being as ignorant as they tend to be > at times just know that its worked fine for years and don't want to hear > that they have to spend money fixing something that as far as they can > tell has always worked fine. That being said, in this instance, due to > poor design, I need this stuff to be in there in a particular order. If > that's not possible then I'll just have to suck it up and rebuild this > thing for free but if I can find a way around that for the time being > then....
Then don't use LOAD DATA INFILE if it's not working for you. Write a PHP script to read each line of the file and insert it. Yes, it'll be a little slower, but then you could also add an auto_increment or timestamp field that'll keep track of how things were inserted...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
On Sunday 02 February 2003 23:10, John W. Holmes wrote:
> Then don't use LOAD DATA INFILE if it's not working for you. Write a PHP > script to read each line of the file and insert it. Yes, it'll be a > little slower, but then you could also add an auto_increment or > timestamp field that'll keep track of how things were inserted...
Even then, do note that once you start deleting records your carefully ordered tables will soon have to be re-ordered.
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* "God is a comedian playing to an audience too afraid to laugh." - Voltaire */
attached mail follows:
----- Original Message -----
From: "CDitty" <mail
redhotsweeps.com>
To: <php-general
lists.php.net>
Sent: Saturday, February 01, 2003 11:26 AM
Subject: [PHP] MySQL/PHP Associative Array Insert
> A co-worker is teaching me to move to the next level in php. I have > started using associative arrays for my scripts, but I am having a problem > using them to do an insert into MySQL. Can someone give me an example of > how to do an insert to the database using these arrays? My array is > this...$item['itemID']
The trick is to wrap array references in curly braces inside double quoted strings.
// some data $array['one'] = 'one'; $array['two'] = 'two'; // build the sql $sql = "INSERT into table (field1,field2) values('{$array['one']}','{array['two']}'";
attached mail follows:
Hi,
I'm having trouble designing a good html-form/MySQL combination for an access rights system.
I'm having three tables in MySQL: members (with member information for my site), albums (with information for separate albums with digital photos on my site) and accessrights (which should function as a "bridge" between members and albums, controling which albums a specific member could view).
accessrights is defined by the following:
CREATE TABLE accessrights ( albumid INT, userid INT, access ENUM("Y","N") DEFAULT "N" NOT NULL, UNIQUE (albumid, userid) );
albumid is from the albums table, and userid from the members table. For each member/album combination I want accessrights to contain one entry with access set to either Y or N.
So far everythings alright. But how do I build a system that lets me control the entries in accessright?
Right now, I'm trying with a form for album editing which contains something like this:
db_connect($dbuser, $dbpassword, $dbdatabase); $query = "SELECT userid FROM members"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { echo($row[0]); ?> <INPUT TYPE="checkbox" name="<?php echo($row[0])?>" VALUE="YES"> }
This creates a checkbox for every member on my site. But the problem is that only checked boxes are passed on to the next script, which process the form for album-editing. This means that if I uncheck a box that's been checked before, this information isn't passed along.
From what I understand, information about unchecked boxes is never passed?
Right now, my solution is to first set the field access in the table accessrights to N for every user and then update the table with an Y for those with checked boxes.
But how can I limit the MySQL queries to just include members for which the access field has been changed?
-- anders thoresson
attached mail follows:
On Sunday 02 February 2003 22:57, anders thoresson wrote:
> I'm having trouble designing a good html-form/MySQL combination for an > access rights system.
[snip]
You may want to have a look at this:
http://phpgacl.sourceforge.net
It seems to provide a very comprehensive system for setting and controlling access rights.
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* "Even more amazing was the realization that God has Internet access. I wonder if He has a full newsfeed?" (By Matt Welsh) */
attached mail follows:
?<php mysql_connect("hostname", "mysqluser", "mysqlpassword")||die(""db error msg..."); mysql_select_db("databaseName")||die("database error msg..."); $result=mysql_query("select * from table_name"); /*heres the trick*/ while($array=mysql_fetch_array($result)){ printf("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username], $array[password], $array[status], $array[notes]); } and make sure that your array indexes are right they are case sensitive in mysql...so array[id] is different than array[Id] or array[ID]...
----- Original Message -----
From: "Karl James" <karl.james
verizon.net>
To: "php" <php-general
lists.php.net>
Sent: Saturday, February 01, 2003 1:37 AM
Subject: [PHP] help with script!!!
Hello guys and gals!!!
can you tell me why i can't get this script to print my table....
thanks Karl
please check out the code below obviously i left my username and passwords blank :-)
----------------------------------------------------------------------------
-
--------------------------------------------------------
<?
$sqlhost = "localhost";
$sqllogin = "login";
$sqlpw = "password";
$sqldb = "database table name";
(
!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) {
die(mysql_error()); }
(
!mysql_select_db($sql[wedbd13])) { die(mysql_error()); }
$result = mysql_query("SELECT * FROM `assignment_one`");
while($array = mysql_fetch_array($result)) {
echo("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username],
$array[password], $array[status], $array[notes]);
}
?>
----------------------------------------------------------------------------
---------------------------------------------------------
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
sorry already fixed my problems but the original question was what html/php code did i need to do the stuff..all i needed was an example 3 or so line code...i dont need anybody to write my code for me...examples are fine enough to get me through my problems if i have any...
btw what is your rates anyways..(just curious) but i have work here to do i am paid to come up with the code myself not pay someone else to have it done for me...(thats lazy)
----- Original Message -----
From: "David Freeman" <dfreeman
outbackqld.net.au>
To: <php-general
lists.php.net>
Sent: Sunday, February 02, 2003 2:08 AM
Subject: RE: [PHP] using <input> tags with php
> > > i want to set up a form that will load values from a table > > and make them the > > "value" of the edit box... then when people press an update > > button then all > > of the stuff that changes from the record already in the table gets > > changed... anybody know how to make it where you can get the > > values out of a > > table and make them the default value of a input field...? > > What is it that you're having trouble with? The logic to do what you > want? The actual code to load values from a table (a database table I > presume)? The correct HTML that you need to have values in a form > field? The code to update your database with information from the form? > > Perhaps if you got started with working out what you want to do and then > ask questions. > > Failing that, I'd be happy to write it for you. Of course, I'll charge > my normal hourly rate to do so... > > CYA, Dave > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
> if > . matches any character except newline (by default) > then > what can i use to match any character INCLUDING newline?
Use an 's' modifier.
Quote: If this modifier is set, a dot metacharacter in the pattern matches all characters, including newlines. Without it, newlines are excluded. This modifier is equivalent to Perl's /s modifier. A negative class such as [^a] always matches a newline character, independent of the setting of this modifier.
Example: preg_match("!<tag>(.*)</tag>!s",$string,$matches);
http://www.php.net/manual/en/pcre.pattern.modifiers.php
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Major security question:
I manage a shared Linux web server running PHP 4.2.3. Apache must have read permissions on a php file necessary for a web application. For example a conf.php file containing a MySQL password that is stored outside the web directory:
-rw-r----- 1 q apache 3522 Oct 17 06:39 conf.php
Because this file is readable by apache, ANY user on the server can write the following script:
<? print_r(file('/home/q/conf.php')); ?>
which upon execution the conf.php file will be read by apache and exposed to the user.
Example understood?
How can a file be secured so it can still be used by apache, but inaccessable by any other user? Is there a PHP ini configuration to force apache to run as the user that is the owner of the php files being executed?
Gosh. Quinn
___________________________________ strangecode :: internet consultancy http://www.strangecode.com/ USA: +1 530 624 4410 Europe: +33 6 81 78 16 11 ___________________________________
attached mail follows:
> Major security question: > > I manage a shared Linux web server running PHP 4.2.3. Apache must have > read permissions on a php file necessary for a web application. For > example a conf.php file containing a MySQL password that is stored > outside the web directory: > > -rw-r----- 1 q apache 3522 Oct 17 06:39 conf.php > > Because this file is readable by apache, ANY user on the server can write > the following script: > > <? print_r(file('/home/q/conf.php')); ?> > > which upon execution the conf.php file will be read by apache and exposed > to the user. > > Example understood? > > How can a file be secured so it can still be used by apache, but > inaccessable by any other user? Is there a PHP ini configuration to force > apache to run as the user that is the owner of the php files being > executed?
Either turn on safe_mode or use the CGI instead of the module.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Hi, As a novelty item on a website I have made a few lines of code for showing how in hours minuts and secoinds since the server was booted up (using C:\php\php.exe -q E:\...\set_boot_time.php value under the Run section in the Windows Registry.). The system by running a script at bootup that sets the time() value to an empty a file called 'boot.time'. All the website has to do then is access the 'boot.time' file and obtain the value. Subtract the 'boot.time' value from the time() value and there you have it, the rest is just formating. This method works perfectly adiquatly. I was just wondering is there is an easyer way to achieve this?
Anyone know of one.
Thanx Josh. (Project Mp3x)
attached mail follows:
hi was just wondering if there was a way to have a php file with all constant variables like db mysqluser and password and a few other things defined in a file of its own and then be able to use the variables in it for the project it was built for?
the last i knew it could be done and all i needed to do was make the file put the definitions in it and then put: include("filename.inc"); at the top of the page..is this right or is there more to it than that?
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
On Sunday 02 February 2003 23:53, Sunfire wrote: > hi was just wondering if there was a way to have a php file with all > constant variables like db mysqluser and password and a few other things > defined in a file of its own and then be able to use the variables in it > for the project it was built for? > > the last i knew it could be done and all i needed to do was make the file > put the definitions in it and then put: > include("filename.inc"); at the top of the page..is this right
Yes.
> or is there > more to it than that?
Not really.
I just don't understand, it would have been _far_ easier for you to test it for yourself by writing a single-line file to init a variable, then a two-line file to include 1st file and display variable, than to have posted to the list.
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* I called my parents the other night, but I forgot about the time difference. They're still living in the fifties. -- Strange de Jim */
attached mail follows:
> hi was just wondering if there was a way to have a php file with all > constant variables like db mysqluser and password and a few other things > defined in a file of its own and then be able to use the variables in it > for > the project it was built for? > > the last i knew it could be done and all i needed to do was make the file > put the definitions in it and then put: > include("filename.inc"); at the top of the page..is this right or is there > more to it than that?
Pretty much. Only addition is to make sure filename.inc can't be viewed through the browser.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
on 03/02/03 5:28 AM, John W. Holmes (holmes072000
charter.net) wrote:
> Pretty much. Only addition is to make sure filename.inc can't be viewed > through the browser.
... by having apache refuse to server all .inc files through http, via the use of a .htaccess file (assuming apache server)
Cheers,
Justin
attached mail follows:
how do you tell it to refuse file.inc with a .taxis file? the server i will be running this on is a public server and they dont allow .taxis files i dont think...i will have to check and see
----- Original Message -----
From: "Justin French" <justin
indent.com.au>
To: <holmes072000
charter.net>; "'Sunfire'" <rusty_81
msn.com>;
<php-general
lists.php.net>
Sent: Sunday, February 02, 2003 5:46 PM
Subject: Re: [PHP] including files...
> on 03/02/03 5:28 AM, John W. Holmes (holmes072000
charter.net) wrote:
>
> > Pretty much. Only addition is to make sure filename.inc can't be viewed
> > through the browser.
>
> ... by having apache refuse to server all .inc files through http, via the
> use of a .htaccess file (assuming apache server)
>
> Cheers,
>
> Justin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
Hey Guys,
I am looking for a quick way to do form validation using $_SESSION variables and MD5, but my brain is mush and my logic is all botched.
Heres the scoop...
I am using 3 $_SESSION variables to test for MD5. 1. $_SESSION["MD5_OLD"] 2. $_SESSION["MD5_NEW"] 3. $_SESSION["MD5_VALID"]
$_SESSION["MD5_NEW"] is rebuilt with each form submission based on 3 other $_SESSION variables.
Code block follows....
// If NOT set set to zero if (!(isset($_SESSION["MD5_NEW"]))) { $_SESSION["MD5_NEW"] = 0; } // If NOT set set to zero if (!(isset($_SESSION["MD5_OLD"]))) { $_SESSION["MD5_OLD"] = 0; } // If NOT set set to zero if (!(isset($_SESSION["MD5_VALID"]))) { $_SESSION["MD5_VALID"] = 0; }
// If var3 is set, build MD5_NEW if (isset($_SESSION["var3"])) { $_SESSION["MD5_NEW"] = $_SESSION["var1"].$_SESSION["var2"].$_SESSION["var3"]; }
if ( md5($_SESSION["MD5_NEW"]) == md5($_SESSION["MD5_OLD"])) { echo "No Changes to MD5"; } else { echo "MD5 has CHANGED!<BR>"; $_SESSION["MD5_NEW"] = $_SESSION["MD5_VALID"]; }
$_SESSION["MD5_OLD"] = $_SESSION["MD5_VALID"];
// End Code block
Ok, so where is the err in my logic since I know there is one, because after var3 is set I keep getting "MD5 has changed", or I just don't understand the proper use of MD5, most likely both :)
Thanks Chris
attached mail follows:
At 17:25 02.02.2003, Chris LeBlanc said: --------------------[snip]-------------------- >Ok, so where is the err in my logic since I know there is one, because after >var3 is set I keep getting "MD5 has changed", or I just don't understand the >proper use of MD5, most likely both :) --------------------[snip]--------------------
You always set MD5_OLD to MD5_VALID, which is never changed since initialized. In other word, both always contain the value "0".
You are always setting MD5_NEW, regardless if var1 or var2 have changed, just to the fact that var3 is set. It's very likely that your test never succeeds (except by chance that var1.var2.var3 result in "0".
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
Is it possible and if so, how to send emails through SMTP servers that require authentication (logging in)?
Thanks in advance
attached mail follows:
On Monday 03 February 2003 00:32, Johan Köhne wrote: > Is it possible and if so, how to send emails through SMTP servers that > require authentication (logging in)?
Yes. Search the archives.
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* A computer lets you make more mistakes faster than any other invention, with the possible exceptions of handguns and Tequilla. -- Mitch Ratcliffe */
attached mail follows:
For a bit more in depth answer, I would recommend using the Mail class in Pear: http://pear.php.net/manual/en/core.mail.mail.php
Should make it very easy. Wes
On Sunday, February 2, 2003, at 01:10 PM, Jason Wong wrote:
> On Monday 03 February 2003 00:32, Johan Köhne wrote: >> Is it possible and if so, how to send emails through SMTP servers that >> require authentication (logging in)? > > Yes. Search the archives. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > ------------------------------------------ > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > ------------------------------------------ > /* > A computer lets you make more mistakes faster than any other invention, > with the possible exceptions of handguns and Tequilla. > -- Mitch Ratcliffe > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >
------------------------------------------------------------------------
--- The selection and placement of letters on this page was determined automatically by a computer program. Any resemblance to actual words, sentences, or paragraphs is pure coincidence, and no liability will be assumed for such coincidences. ------------------------------------------------------------------------ ---
attached mail follows:
Hello,
On 02/02/2003 02:32 PM, Johan köhne wrote: > Is it possible and if so, how to send emails through SMTP servers that require authentication (logging in)?
Not via mail(). You may want to try this class for composing and sending messages that comes with a wrapper function named smtp_mail() that emulates the mail() function except that it send the message through a SMTP server of your choice letting you specify the authentication credentials as you need:
http://www.phpclasses.org/mimemessage
You also need this:
http://www.phpclasses.org/smtpclass
--Regards, Manuel Lemos
attached mail follows:
Nicole <430ntr3k
aeontrek.com> wrote:
> Thank you. Yes, I did chmod my scripts. chmod 754 and tried 755 too. Don't > see why it should be x on the world, though. I would think if the script is > being called by its owner, then x on the owner and group should be enough, > no?
The script has to be executable by the web server user, i.e. "nobody" or "wwwrun" or the like. See "ps auxw|grep httpd" to find out how this special user is named on your system. If your program is not owned by the web server user, you can either use "chown" (as root) to change the owner of the script, or "chmod" to make it "world"-executable.
Regards... Michael
attached mail follows:
The following code loops through a multidimensional array, printing the subject heading and then the strand:
foreach( $strandx as $subjectx=>$strandy ) { print " <li><b>".$subjectx."</b>.<br />\n";
print " <ul>\n"; asort( $strandy ); // sorts the strands foreach( $strandy as $str )
{ print "<li>"; checkbox("fstrand[]",$subjectx,$str,0,0); print "</li>\n"; } print " </ul>\n"; } print "</ol>\n";
This is the array so far: $strandx = array('English' => array('Reading', 'Writing','Oral and Visual Communication'), 'Mathematics' => array('Number Sense and Numeration', 'Measurement', 'Geometry and Spatial Sense','Patterning and Algebra','Data Management and Probability'));
I would like to limit the subject and strand being printed based on the subject selected in a form. So, for example, if "English" is selected in the form, only the subject name and the strands for English would be published. Could someone please help me with the code for this.
Many thanks,
Peter Gumbrell
peter
orilla.net
attached mail follows:
> The following code loops through a multidimensional array, printing the > subject heading and then the strand: > > foreach( $strandx as $subjectx=>$strandy ) > { > print " <li><b>".$subjectx."</b>.<br />\n"; > > > print " <ul>\n"; > asort( $strandy ); // sorts the strands > foreach( $strandy as $str ) > > { print "<li>"; > checkbox("fstrand[]",$subjectx,$str,0,0); > print "</li>\n"; > } > print " </ul>\n"; > } > print "</ol>\n"; > > This is the array so far: > $strandx = array('English' => array('Reading', 'Writing','Oral and Visual > Communication'), > 'Mathematics' => array('Number Sense and Numeration', 'Measurement', > 'Geometry and Spatial Sense','Patterning and Algebra','Data Management and > Probability')); > > I would like to limit the subject and strand being printed based on the > subject selected in a form. So, for example, if "English" is selected in > the > form, only the subject name and the strands for English would be > published. > Could someone please help me with the code for this.
Since you already know $subjectx (English or Math), then just use that value in your foreach() loop...
Foreach($strandx[$subjectx] as $strandy)
Where $subjectx would come from your form. Provide some validation first.
So something like this:
//Many ways to do this, just validate //whatever is coming from your form //matches a key in $strandx switch($_POST['subject']) { case "English" $subject = "English" break; default: $subject = "Mathematics"; break; }
print " <ol><li><b>".$subject."</b>.<br />\n"; foreach( $strandx[$subject] as $strandy ) { print " <ul>\n"; asort($strandy ); // sorts the strands foreach( $strandy as $str ) { print "<li>"; checkbox("fstrand[]",$subjectx,$str,0,0); print "</li>\n"; } print " </ul>\n"; } print "</li></ol>\n";
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Thanks for the suggestion, John. When I implement your code, however, I get an error saying Warning: Invalid argument supplied for foreach() in home/student/peter/public_html/week4.php on line 153
where line 153 is
foreach($strandx[$subject] as $strandy )
This is the code as I have it now:
switch($_POST['fsubject']) { case "English": $subject = "English"; break; case "Mathematics": $subject = "Mathematics"; break; } Print "<h4>Now select the strands for Grade $grades: $subject:</h4></td></tr><tr><td>";
print "<td>"; print "$subject"; //this tells me that I have the correct value foreach($strandx[$subject] as $strandy ) { //print " <li><b>".$subject."</b>.<br />\n";
print " <ul>\n";
foreach( $strandy as $str )
{ print "<li>"; checkbox("fstrand[]",$strandx,$str,0,0); print "</li>\n"; }
Any help would again be appreciated.
Peter
-----Original Message-----
From: John W. Holmes [mailto:holmes072000
charter.net]
Sent: Sunday, February 02, 2003 1:28 PM
To: 'Peter Gumbrell'; php-general
lists.php.net
Subject: RE: [PHP] selecting from an array based on form content
> The following code loops through a multidimensional array, printing the > subject heading and then the strand: > > foreach( $strandx as $subjectx=>$strandy ) > { > print " <li><b>".$subjectx."</b>.<br />\n"; > > > print " <ul>\n"; > asort( $strandy ); // sorts the strands > foreach( $strandy as $str ) > > { print "<li>"; > checkbox("fstrand[]",$subjectx,$str,0,0); > print "</li>\n"; > } > print " </ul>\n"; > } > print "</ol>\n"; > > This is the array so far: > $strandx = array('English' => array('Reading', 'Writing','Oral and Visual > Communication'), > 'Mathematics' => array('Number Sense and Numeration', 'Measurement', > 'Geometry and Spatial Sense','Patterning and Algebra','Data Management and > Probability')); > > I would like to limit the subject and strand being printed based on the > subject selected in a form. So, for example, if "English" is selected in > the > form, only the subject name and the strands for English would be > published. > Could someone please help me with the code for this.
Since you already know $subjectx (English or Math), then just use that value in your foreach() loop...
Foreach($strandx[$subjectx] as $strandy)
Where $subjectx would come from your form. Provide some validation first.
So something like this:
//Many ways to do this, just validate //whatever is coming from your form //matches a key in $strandx switch($_POST['subject']) { case "English" $subject = "English" break; default: $subject = "Mathematics"; break; }
print " <ol><li><b>".$subject."</b>.<br />\n"; foreach( $strandx[$subject] as $strandy ) { print " <ul>\n"; asort($strandy ); // sorts the strands foreach( $strandy as $str ) { print "<li>"; checkbox("fstrand[]",$subjectx,$str,0,0); print "</li>\n"; } print " </ul>\n"; } print "</li></ol>\n";
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Where do you define the $strandx array? What is it's value?
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
> -----Original Message-----
> From: Peter Gumbrell [mailto:peter
orillia.net]
> Sent: Sunday, February 02, 2003 2:08 PM
> To: php-general
lists.php.net
> Subject: RE: [PHP] selecting from an array based on form content
>
> Thanks for the suggestion, John. When I implement your code, however,
I
> get
> an error saying
> Warning: Invalid argument supplied for foreach() in
> home/student/peter/public_html/week4.php on line 153
>
> where line 153 is
>
> foreach($strandx[$subject] as $strandy )
>
> This is the code as I have it now:
>
> switch($_POST['fsubject'])
> {
> case "English":
> $subject = "English";
> break;
> case "Mathematics":
> $subject = "Mathematics";
> break;
> }
> Print "<h4>Now select the strands for Grade $grades:
> $subject:</h4></td></tr><tr><td>";
>
> print "<td>";
> print "$subject"; //this tells me that I have the correct value
> foreach($strandx[$subject] as $strandy )
> {
> //print " <li><b>".$subject."</b>.<br />\n";
>
>
> print " <ul>\n";
>
> foreach( $strandy as $str )
>
> { print "<li>";
> checkbox("fstrand[]",$strandx,$str,0,0);
> print "</li>\n";
> }
>
> Any help would again be appreciated.
>
> Peter
> -----Original Message-----
> From: John W. Holmes [mailto:holmes072000
charter.net]
> Sent: Sunday, February 02, 2003 1:28 PM
> To: 'Peter Gumbrell'; php-general
lists.php.net
> Subject: RE: [PHP] selecting from an array based on form content
>
>
> > The following code loops through a multidimensional array, printing
> the
> > subject heading and then the strand:
> >
> > foreach( $strandx as $subjectx=>$strandy )
> > {
> > print " <li><b>".$subjectx."</b>.<br />\n";
> >
> >
> > print " <ul>\n";
> > asort( $strandy ); // sorts the strands
> > foreach( $strandy as $str )
> >
> > { print "<li>";
> > checkbox("fstrand[]",$subjectx,$str,0,0);
> > print "</li>\n";
> > }
> > print " </ul>\n";
> > }
> > print "</ol>\n";
> >
> > This is the array so far:
> > $strandx = array('English' => array('Reading', 'Writing','Oral and
> Visual
> > Communication'),
> > 'Mathematics' => array('Number Sense and Numeration', 'Measurement',
> > 'Geometry and Spatial Sense','Patterning and Algebra','Data
Management
> and
> > Probability'));
> >
> > I would like to limit the subject and strand being printed based on
> the
> > subject selected in a form. So, for example, if "English" is
selected
> in
> > the
> > form, only the subject name and the strands for English would be
> > published.
> > Could someone please help me with the code for this.
>
> Since you already know $subjectx (English or Math), then just use that
> value in your foreach() loop...
>
> Foreach($strandx[$subjectx] as $strandy)
>
> Where $subjectx would come from your form. Provide some validation
> first.
>
> So something like this:
>
> //Many ways to do this, just validate
> //whatever is coming from your form
> //matches a key in $strandx
> switch($_POST['subject'])
> {
> case "English"
> $subject = "English"
> break;
> default:
> $subject = "Mathematics";
> break;
> }
>
> print " <ol><li><b>".$subject."</b>.<br />\n";
> foreach( $strandx[$subject] as $strandy )
> {
> print " <ul>\n";
> asort($strandy ); // sorts the strands
> foreach( $strandy as $str )
> {
> print "<li>";
> checkbox("fstrand[]",$subjectx,$str,0,0);
> print "</li>\n";
> }
> print " </ul>\n";
> }
> print "</li></ol>\n";
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your
copy
> today. http://www.phparch.com/
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
$strandx is defined with code at the top of the page, as follows
$strandx = array('English' => array('Reading', 'Writing','Oral and Visual Communication'), 'Mathematics' => array('Number Sense and Numeration', 'Measurement', 'Geometry and Spatial Sense','Patterning and Algebra','Data Management and Probability'));
Peter Gumbrell
peter
orillia.net
-----Original Message-----
From: John W. Holmes [mailto:holmes072000
charter.net]
Sent: Sunday, February 02, 2003 2:50 PM
To: 'Peter Gumbrell'; php-general
lists.php.net
Subject: RE: [PHP] selecting from an array based on form content
Where do you define the $strandx array? What is it's value?
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
> -----Original Message-----
> From: Peter Gumbrell [mailto:peter
orillia.net]
> Sent: Sunday, February 02, 2003 2:08 PM
> To: php-general
lists.php.net
> Subject: RE: [PHP] selecting from an array based on form content
>
> Thanks for the suggestion, John. When I implement your code, however,
I
> get
> an error saying
> Warning: Invalid argument supplied for foreach() in
> home/student/peter/public_html/week4.php on line 153
>
> where line 153 is
>
> foreach($strandx[$subject] as $strandy )
>
> This is the code as I have it now:
>
> switch($_POST['fsubject'])
> {
> case "English":
> $subject = "English";
> break;
> case "Mathematics":
> $subject = "Mathematics";
> break;
> }
> Print "<h4>Now select the strands for Grade $grades:
> $subject:</h4></td></tr><tr><td>";
>
> print "<td>";
> print "$subject"; //this tells me that I have the correct value
> foreach($strandx[$subject] as $strandy )
> {
> //print " <li><b>".$subject."</b>.<br />\n";
>
>
> print " <ul>\n";
>
> foreach( $strandy as $str )
>
> { print "<li>";
> checkbox("fstrand[]",$strandx,$str,0,0);
> print "</li>\n";
> }
>
> Any help would again be appreciated.
>
> Peter
> -----Original Message-----
> From: John W. Holmes [mailto:holmes072000
charter.net]
> Sent: Sunday, February 02, 2003 1:28 PM
> To: 'Peter Gumbrell'; php-general
lists.php.net
> Subject: RE: [PHP] selecting from an array based on form content
>
>
> > The following code loops through a multidimensional array, printing
> the
> > subject heading and then the strand:
> >
> > foreach( $strandx as $subjectx=>$strandy )
> > {
> > print " <li><b>".$subjectx."</b>.<br />\n";
> >
> >
> > print " <ul>\n";
> > asort( $strandy ); // sorts the strands
> > foreach( $strandy as $str )
> >
> > { print "<li>";
> > checkbox("fstrand[]",$subjectx,$str,0,0);
> > print "</li>\n";
> > }
> > print " </ul>\n";
> > }
> > print "</ol>\n";
> >
> > This is the array so far:
> > $strandx = array('English' => array('Reading', 'Writing','Oral and
> Visual
> > Communication'),
> > 'Mathematics' => array('Number Sense and Numeration', 'Measurement',
> > 'Geometry and Spatial Sense','Patterning and Algebra','Data
Management
> and
> > Probability'));
> >
> > I would like to limit the subject and strand being printed based on
> the
> > subject selected in a form. So, for example, if "English" is
selected
> in
> > the
> > form, only the subject name and the strands for English would be
> > published.
> > Could someone please help me with the code for this.
>
> Since you already know $subjectx (English or Math), then just use that
> value in your foreach() loop...
>
> Foreach($strandx[$subjectx] as $strandy)
>
> Where $subjectx would come from your form. Provide some validation
> first.
>
> So something like this:
>
> //Many ways to do this, just validate
> //whatever is coming from your form
> //matches a key in $strandx
> switch($_POST['subject'])
> {
> case "English"
> $subject = "English"
> break;
> default:
> $subject = "Mathematics";
> break;
> }
>
> print " <ol><li><b>".$subject."</b>.<br />\n";
> foreach( $strandx[$subject] as $strandy )
> {
> print " <ul>\n";
> asort($strandy ); // sorts the strands
> foreach( $strandy as $str )
> {
> print "<li>";
> checkbox("fstrand[]",$subjectx,$str,0,0);
> print "</li>\n";
> }
> print " </ul>\n";
> }
> print "</li></ol>\n";
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your
copy
> today. http://www.phparch.com/
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
No functions that I can think of but you can write one like this:
$arrayType = 'numeric';
foreach($myArray as $key => $value) { if(!is_numeric($key)) { $arrayType = 'associative'; } }
Also remember that an array can be both!
Larry
> Is there a way to determine if an array is associative or not? Maybe = > something similar to the is_array() function ??
attached mail follows:
All arrays in PHP are associative; we sometimes use integers to refer to them, but the order of the array internally is not necessarily the same as the integers; indeed, any array can have "holes" in them. So the question is moot.
"There are no different indexed and associative array types in PHP, there is only one array type, which can both contain integer and string indices." - http://www.php.net/manual/en/language.types.array.php
Mark C.
> > Is there a way to determine if an array is associative or not? Maybe = > > something similar to the is_array() function ?? >
attached mail follows:
Lo all,
Does anyone have some fonts or neat PHP code / classes to generate Code 128-type Barcodes? I'm preferably looking to get the barcode generated in a PNG / GIF type format...
-- me
attached mail follows:
You might take a look Pear's Image_Barcode, it uses GD so it should be able to make them in PNG.
With PEAR::Image_Barcode class you can create a barcode represent given string. This class uses GD function because of this the generated graphic can be any of GD supported supported image types.
http://pear.php.net/package-info.php?pacid=142
Jason
On Sun, 2003-02-02 at 10:41, Chris Knipe wrote: > Lo all, > > Does anyone have some fonts or neat PHP code / classes to generate Code > 128-type Barcodes? I'm preferably looking to get the barcode generated in a > PNG / GIF type format... > > -- > me > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
You can have a look at this: http://www.aramsoft.com/barcode/barcode-0.0.8a.tar.gz
--- http://cristophus.cjb.net --- Why static, when you can go dynamic?
On Sun, 2 Feb 2003, Chris Knipe wrote:
> Lo all, > > Does anyone have some fonts or neat PHP code / classes to generate Code > 128-type Barcodes? I'm preferably looking to get the barcode generated in a > PNG / GIF type format... > > -- > me > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Try to have a look at this: http://www.aramsoft.com/barcode/barcode-0.0.8a.tar.gz
--- http://cristophus.cjb.net --- Why static, when you can go dynamic?
On Sun, 2 Feb 2003, Chris Knipe wrote:
> Lo all, > > Does anyone have some fonts or neat PHP code / classes to generate Code > 128-type Barcodes? I'm preferably looking to get the barcode generated in a > PNG / GIF type format... > > -- > me > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Hi!
I have called a index.php file in a directory.
Every time I point my browser to that directory the contents of the directory gets displayed instead of the index.php file.
Can anyone help?
Thanks in advance
Renato
attached mail follows:
Hi,
Add "index.php" to DirectoryIndex section in your httpd.conf file, if you're using Apache...
HTH, Florin.
On Sun, 2 Feb 2003 17:45:33 -0800
Renato Lopes <renatolopes
mac.com> wrote:
> Hi! > > I have called a index.php file in a directory. > > Every time I point my browser to that directory the contents of the > directory gets displayed instead of the index.php file. > > Can anyone help? > > Thanks in advance > > Renato > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
--- Renato Lopes <renatolopes
mac.com> wrote:
> Every time I point my browser to that directory the
> contents of the directory gets displayed instead of
> the index.php file.
It would help if we knew what Web server, but I will assume Apache and hope for the best.
Locate your httpd.conf file, and add index.php to the DirectoryIndex directive. Restart (or better, kill -1) Apache.
Chris
attached mail follows:
Strange -- can u change it to foo.php and execute it, or do you get a 404 error (not found)?
Justin
on 03/02/03 12:45 PM, Renato Lopes (renatolopes
mac.com) wrote:
> Hi! > > I have called a index.php file in a directory. > > Every time I point my browser to that directory the contents of the > directory gets displayed instead of the index.php file. > > Can anyone help? > > Thanks in advance > > Renato >
attached mail follows:
Can you hit it by typing the actual filename?
http://www.mydomain.com/index.php
If yes, check you httpd.conf file, and make sure that you have added "index.php" as a valid index file.
Justin French wrote:
> Strange -- can u change it to foo.php and execute it, or do you get a 404
> error (not found)?
>
> Justin
>
>
> on 03/02/03 12:45 PM, Renato Lopes (renatolopes
mac.com) wrote:
>
>
>>Hi!
>>
>>I have called a index.php file in a directory.
>>
>>Every time I point my browser to that directory the contents of the
>>directory gets displayed instead of the index.php file.
>>
>>Can anyone help?
>>
>>Thanks in advance
>>
>>Renato
>>
>
>
>
-- By-Tor.com It's all about the Rush http://www.by-tor.com
attached mail follows:
Hi ppl,
I have a problem that probably very simple, but i cannot figure it out right now.... I need to get the field names of my database. I have a query like select * from books and now i wanna have both the result and the field name. I have been trying with mysql_field_name, but not succesfully...
$i = 0; for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) { echo mysql_field_name($db->sqlResult, $i)."<br />"; $i++; }
Can anyone help me please.. Your help is greatly appreciated;-)
Best regards,
Davy Obdam
mailto:info
davyobdam.com
attached mail follows:
On Sun, 2 Feb 2003, Davy Obdam wrote:
> Hi ppl, > > I have a problem that probably very simple, but i cannot figure it out > right now.... > I need to get the field names of my database. I have a query like select > * from books and now i wanna have both the result and the field name. I > have been trying with mysql_field_name, but not succesfully... > > $i = 0; > for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) { > echo mysql_field_name($db->sqlResult, $i)."<br />"; > $i++; > } > > Can anyone help me please.. Your help is greatly appreciated;-)
Please read the example in the manual as well as the user contributed notes. They show how to do this:
http://www.php.net/mysql_field_name
See also: mysql_num_fields()
Regards, Philip
attached mail follows:
Is there a PHP version of the ColdFusion tag <CFParam>?
attached mail follows:
On Sun, 2 Feb 2003, Lon Lentz wrote: > > Is there a PHP version of the ColdFusion tag <CFParam>?
Go here: http://marc.theaimsgroup.com/?l=php-general&s=cfparam
Regards, Philip
attached mail follows:
--- Lon Lentz <lonl
eximpact.com> wrote:
> Is there a PHP version of the ColdFusion tag <CFParam>?
It has been a while since I wrote CF, but I believe <cfparam> just does the same thing as something like this:
<cfif not isdefined("variables.foo")> <cfset variables.foo = "default"> </cfif>
The PHP equivalent of this example is:
if (!isset($foo)) { $foo = 'default'; }
Chris
attached mail follows:
Hi All,
I need to extract text ata from PDF files. Does anyone know if there is a PHP PDF parser?
Also, does anyone know if there is a sql wrapper for the ffdb-php project (http://sourceforge.net/projects/ffdb-php/)?
John created this wonderful FFDB in PHP, and I was wondering if there are plans to include his FFDB in the next PHP release. I mean, has there been any discussion about adding FFDB as the default database for those who don't have access to a real SQL database. I think adding FFDB support would enhance PHP's popularity.
Zlutarch
__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
attached mail follows:
In one file I want to display filenames and when these files was last modified. I want this to happen even for files in other directories. First of all, can it be done with php (I have seen that it is possible using SSI), and in that case how?
attached mail follows:
Take a look at the getlastmod() function, an example of the usage would be:
$last_mod = date ("F d Y H:i:s.", getlastmod());
Then you can print or operate on last_mod any way you want, if you don't want to operate on the date you can just print the return of date.
This information is available in the PHP manual at http://www.php.net/manual/en/function.getlastmod.php and http://www.php.net/manual/en/function.filemtime.php.
Jason
On Sun, 2003-02-02 at 12:08, Øystein Håland wrote: > In one file I want to display filenames and when these files was last > modified. I want this to happen even for files in other directories. > First of all, can it be done with php (I have seen that it is possible using > SSI), and in that case how? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
"Jason Sheets" <jsheets
php.net> skrev i meddelandet
news:1044214335.322.15.camel
daemon.shadotech.biz...
Take a look at the getlastmod() function, an example of the usage would
be:
$last_mod = date ("F d Y H:i:s.", getlastmod());
Then you can print or operate on last_mod any way you want, if you don't want to operate on the date you can just print the return of date.
I use the getlastmod()function already, to print in the same document, but I recon this isn't exactly the same thing, since I want to display in ONE page the last modified date of all my php-files, or am I wrong? Some kind of array is necessary? I believe I need some kind of (recursive) function that collect this information from all my files, and I believe someone have written one already. I have not the skills (yet) to write it myself
attached mail follows:
On Sun, 2 Feb 2003, Øystein Håland wrote:
>
> "Jason Sheets" <jsheets
php.net> skrev i meddelandet
> news:1044214335.322.15.camel
daemon.shadotech.biz...
> Take a look at the getlastmod() function, an example of the usage would
> be:
>
> $last_mod = date ("F d Y H:i:s.", getlastmod());
>
> Then you can print or operate on last_mod any way you want, if you don't
> want to operate on the date you can just print the return of date.
>
> I use the getlastmod()function already, to print in the same document, but I
> recon this isn't exactly the same thing, since I want to display in ONE page
> the last modified date of all my php-files, or am I wrong?
> Some kind of array is necessary? I believe I need some kind of (recursive)
> function that collect this information from all my files, and I believe
> someone have written one already. I have not the skills (yet) to write it
> myself
See: http://www.php.net/readdir http://www.php.net/filemtime
The examples within will help you write this.
Regards, Philip
attached mail follows:
----- Original Message -----
From: "Philip Olson" <philip
cornado.com>
To: "Øystein Håland" <molen
mbox302.swipnet.se>
Cc: <php-general
lists.php.net>
Sent: Sunday, February 02, 2003 11:41 PM
Subject: Re: [PHP] How can I display lastmodified for all my php-files?
See: http://www.php.net/readdir http://www.php.net/filemtime
The examples within will help you write this.
Thanks, I will
attached mail follows:
See: http://www.php.net/readdir http://www.php.net/filemtime
The examples within will help you write this.
K, think it is possible to solve my problem. Here comes a almost similar question. After looking up the stat(9 function I cant see how I can acces the 'created date' of a file. Can I? How?
attached mail follows:
Has anyone used php to send ringtones to cell phones? I've been to sites that are doing this in ASP, so I'm pretty sure it can be done in php. I've tried just sending headers like this...
header ( "Content-Type: audio/midi" ); header ( "Content-Name: By-Tor's Song" ); header ( "Content-Version: 1.0" ); header ( "Content-Vendor: www.by-tor.com.com" ); header ( "Content-URL: http://www.by-tor.com/test.mid" ); header ( "Content-Size: 16655" ); header ( "Content-Disposition: attachment; filename=test.mid" ); readfile ( 'test.mid' );
but that isn't working...it just forces the phone to play the midi file.
-- By-Tor.com It's all about the Rush http://www.by-tor.com
attached mail follows:
hi i create a php page dynamically in my php script. this page include one of my other php file. when i run the newly created script i get this error
Warning: SAFE MODE Restriction in effect. The script whose uid is 48 is not allowed to access file.php owned by uid 831
Is there a way to handle this.
i even tried chown to change the newly created file's owner to be 831 but it doesnt seem to work
Thanks & Regards Gurvinder
attached mail follows:
Where can I find good guidelines on how to write PHP-code that's easy to read for a human?
-- anders thoresson
attached mail follows:
One resource I've found valuable is the PHP Coding Standard at http://utvikler.start.no/code/php_coding_standard.html
To quote the introduction:
The PHP Coding Standard is with permission based on Todd Hoff's C++ Coding Standard. Rewritten for PHP by Fredrik Kristiansen / DB Medialab, Oslo 2000-2001.
There are many other resources available as well, you should be able to find good information if you do a google search for PHP Coding Standard, or take a look at the Pear requirements at http://pear.php.net.
Jason 2003-02-02 at 12:34, anders thoresson wrote: > Where can I find good guidelines on how to write PHP-code that's easy to > read for a human? > > -- > anders thoresson > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
"Anders Thoresson" <listor
thoresson.net> wrote in message
news:oprjzfbxevzzwwoi
mail.darkface.pp.se...
> Where can I find good guidelines on how to write PHP-code that's easy to
> read for a human?
it is also good idea to separate html from the code, for instance by using some template engine.
rush
-- http://www.templatetamer.com/
attached mail follows:
Coding style is a very personal issue, one codes the way he/she likes. But, for keeping the maintenance easier, K&R style (named after Kernighan and Ritchie - the Linux fathers) would probably be the best. I (personally) prefer it quite a lot, without much modifications.
Here are a few references for K&R:
http://www.purists.org/linux/ http://www.jetcafe.org/~jim/c-style.html http://www.cs.utexas.edu/users/scottm/cs307/Handouts/codingStandards.htm http://staff.oclc.org/~thompson/correct_style.html
-- Maxim Maletsky maximphp.net
On Sun, 02 Feb 2003 20:34:35 +0100 anders thoresson <listor
thoresson.net> wrote:
> Where can I find good guidelines on how to write PHP-code that's easy to > read for a human? > > -- > anders thoresson > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
What about the coding standard found on PEAR.php.net
LW
-----Original Message-----
From: Maxim Maletsky
lists.php.net [mailto:Maxim
Maletsky
lists.php.net]On Behalf Of Maxim Maletsky
Sent: Monday, 3 February 2003 11:19 AM
To: anders thoresson
Cc:
Subject: Re: [PHP] how to write clean code.
Coding style is a very personal issue, one codes the way he/she likes. But, for keeping the maintenance easier, K&R style (named after Kernighan and Ritchie - the Linux fathers) would probably be the best. I (personally) prefer it quite a lot, without much modifications.
Here are a few references for K&R:
http://www.purists.org/linux/ http://www.jetcafe.org/~jim/c-style.html http://www.cs.utexas.edu/users/scottm/cs307/Handouts/codingStandards.htm http://staff.oclc.org/~thompson/correct_style.html
-- Maxim Maletsky maximphp.net
On Sun, 02 Feb 2003 20:34:35 +0100 anders thoresson <listor
thoresson.net> wrote:
> Where can I find good guidelines on how to write PHP-code that's easy to > read for a human? > > -- > anders thoresson > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Newbie question and OT. Sorry.
I am able to conncet to a mysql server with the following call to
mysql_connect().
$connect=
mysql_connect("","","");
There are no parameters in the function call.
Why can I connect if there are no parameters?
However, if I give mysqladmin the password of: goodpassword
and call:
$connect=
mysql_connect("localhost","root","goodpassword");
I connect.
But if I call:
$connect=
mysql_connect("localhost","root","badpassword");
I cannot connect.
Or from the command line...
From the command line: C:\Windows\cd c:\mysql\bin \\enter
C:\mysql\bin> mysqld-shareware --standalone \\enter
C:\mysql\bin> mysql \\enter note: no password have been entered.
\\ I get the: Welcome to the MySql monitor... ............................... Or...
C:\Windows\cd c:\mysql\bin \\enter
C:\mysql\bin> mysqld-shareware --standalone \\enter
C:\mysql\bin> mysql -u root - p \\ enter
Enter password goodpassword \\ I get the: Welcome to the MySql monitor...
............................ C:\Windows\cd c:\mysql\bin \\enter
C:\mysql\bin> mysqld-shareware --standalone \\enter
C:\mysql\bin> mysql -u root - p \\ enter Enter password badpassword \\ I do _not_ get the: Welcome to the MySql monitor... ........................
Why is this when I thought it needs a password to connect to the MySql monitor? Thanks, TR
attached mail follows:
Hi all,
I just finished loading the OS to my PC once again, installed and configured IIS and then installed PHP 4 but now, every page I try to open tells me:
Failed opening required '/icaam7/lib/stdlib.php' (include_path='.;c:\php4\pear')
even when my php.ini (under Windows folder) tells me that the include_path is:
include_path = ".;c:\php\includes;/"
and no matter how I change this line in php.ini, the include_path appears to be set ONLY to c:\php4\pear
Any ideas on how to change that??? Is there another php.ini file around?
Thanks in advance
-----------------------
Cesar Aracena
lists
icaam.com.ar
http://www.icaam.com.ar
Cel: +54.299.635-6688
Tel: +54.299.477-4532
Fax: +54.299.477-7773
Cipolletti, Rio Negro
R8324BEG
Argentina
--------------------------- Soluciones profesionales en Internet y Comunicaciones http://www.icaam.com.ar
attached mail follows:
Hi all,
I'm sorry for this re-post, but I do need help with this URGENT...
I just finished loading the OS to my PC once again, installed and configured IIS and then installed PHP 4 but now, every page I try to open tells me:
Failed opening required '/icaam7/lib/stdlib.php' (include_path='.;c:\php4\pear')
even when my php.ini (under Windows folder) tells me that the include_path is:
include_path = ".;c:\php\includes;/"
and no matter how I change this line in php.ini, the include_path appears to be set ONLY to c:\php4\pear
Any ideas on how to change that??? Is there another php.ini file around?
Thanks in advance
-----------------------
Cesar Aracena
lists
icaam.com.ar
http://www.icaam.com.ar
Cel: +54.299.635-6688
Tel: +54.299.477-4532
Fax: +54.299.477-7773
Cipolletti, Rio Negro
R8324BEG
Argentina
--------------------------- Soluciones profesionales en Internet y Comunicaciones http://www.icaam.com.ar
attached mail follows:
Make a php file with nothing but this in it....
<?php
phpinfo();
?>
...and hit that in your browser. It will tell you the location of the ini that it is using.
César Aracena wrote:
> Hi all,
>
> I'm sorry for this re-post, but I do need help with this URGENT...
>
> I just finished loading the OS to my PC once again, installed and
> configured IIS and then installed PHP 4 but now, every page I try to open
> tells me:
>
> Failed opening required '/icaam7/lib/stdlib.php'
> (include_path='.;c:\php4\pear')
>
> even when my php.ini (under Windows folder) tells me that the include_path
> is:
>
> include_path = ".;c:\php\includes;/"
>
> and no matter how I change this line in php.ini, the include_path appears
> to be set ONLY to c:\php4\pear
>
> Any ideas on how to change that??? Is there another php.ini file around?
>
> Thanks in advance
>
> -----------------------
> Cesar Aracena
> lists
icaam.com.ar
> http://www.icaam.com.ar
> Cel: +54.299.635-6688
> Tel: +54.299.477-4532
> Fax: +54.299.477-7773
> Cipolletti, Rio Negro
> R8324BEG
> Argentina
>
>
> ---------------------------
> Soluciones profesionales en
> Internet y Comunicaciones
> http://www.icaam.com.ar
>
>
>
-- By-Tor.com It's all about the Rush http://www.by-tor.com
attached mail follows:
what is a winmail.dat file? thanks Karl
attached mail follows:
Karl:
Your question appears to be completely off-topic but perhaps this might help you.
http://www.gotquestions.com/xs/seeDocument.asp?topicID=14&documentID=696
On Saturday, February 1, 2003, at 03:56 PM, Karl James wrote:
<image.tiff> > > ____________________________________________________ <image.tiff> IncrediMail - Email has finally evolved - Click Here
attached mail follows:
on 02/02/03 7:56 AM, Karl James (karl.james
verizon.net) wrote:
> what is a winmail.dat file?
PLEASE don't post in rich text / HTML -- you've been asked more than once PLEASE ask php-specific questions
Justin
attached mail follows:
i have a listbox: <select name="users"> <?php //connect to db and get query mysql_connect("....."); mysql_select_db("..."); $query=mysql_query("select username from users); /*finish the listbox*/ while($account=mysql_fetch_array($query)){ echo "<option value=$account[username]>$account[username]<br>"; } ?> </select> <input type="submit" value="send">
got it to fill listbox with usernames.. now my question is how do you use the $users variable in the php script that deals with the listbox? iat this point all i wanted to do was print the user name that was selected in the listbox but after i get how that works then it will load a form with all user data in it so it can be changed..
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
>From: "Sunfire" <rusty_81
msn.com>
>Sent: Sunday, February 02, 2003 4:53 PM
>Subject: [PHP] listbox problems
> i have a listbox: > <select name="users"> > <?php > //connect to db and get query > mysql_connect("....."); > mysql_select_db("..."); > $query=mysql_query("select username from users); > /*finish the listbox*/ > while($account=mysql_fetch_array($query)){ > echo "<option value=$account[username]>$account[username]<br>";
Try: echo "<option value={$account['username']}"; $selected = ($account['username'] == $_POST['user']) ? 'selected' : ''; echo $selected; echo ">{$account['username']}<br>";
> } > ?> > </select> > <input type="submit" value="send">
attached mail follows:
On Sun, 2 Feb 2003, Sunfire wrote:
> i have a listbox: > <select name="users"> > <?php > //connect to db and get query > mysql_connect("....."); > mysql_select_db("..."); > $query=mysql_query("select username from users); > /*finish the listbox*/ > while($account=mysql_fetch_array($query)){ > echo "<option value=$account[username]>$account[username]<br>"; > } > ?> > </select> > <input type="submit" value="send"> > > got it to fill listbox with usernames.. > now my question is how do you use the $users variable in the php script that > deals with the listbox? > iat this point all i wanted to do was print the user name that was selected > in the listbox but after i get how that works then it will load a form with > all user data in it so it can be changed..
Read this: http://www.php.net/variables.external
Regards, Philip
attached mail follows:
hi.. listbox prob fixed... i had echo "<select name='user's<br>"; in the first file it should have been: echo "<select name='users'<br>"; and in second file i had: echo 'account[username]........<br>'; should have been : echo "$account[username]......<br>";
----- Original Message -----
From: "Matt" <mschroebel
epooch.com>
To: "Sunfire" <rusty_81
msn.com>; <php-general
lists.php.net>
Sent: Sunday, February 02, 2003 4:55 PM
Subject: Re: [PHP] listbox problems
> >From: "Sunfire" <rusty_81
msn.com>
> >Sent: Sunday, February 02, 2003 4:53 PM
> >Subject: [PHP] listbox problems
>
>
> > i have a listbox:
> > <select name="users">
> > <?php
> > //connect to db and get query
> > mysql_connect(".....");
> > mysql_select_db("...");
> > $query=mysql_query("select username from users);
> > /*finish the listbox*/
> > while($account=mysql_fetch_array($query)){
> > echo "<option value=$account[username]>$account[username]<br>";
>
> Try:
> echo "<option value={$account['username']}";
> $selected = ($account['username'] == $_POST['user']) ? 'selected' : '';
> echo $selected;
> echo ">{$account['username']}<br>";
>
> > }
> > ?>
> > </select>
> > <input type="submit" value="send">
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
On Sun, Feb 02, 2003 at 04:55:08PM -0500, Matt wrote: > > > i have a listbox: > > <select name="users"> > > <?php > > //connect to db and get query > > mysql_connect("....."); > > mysql_select_db("..."); > > $query=mysql_query("select username from users); > > /*finish the listbox*/ > > while($account=mysql_fetch_array($query)){ > > echo "<option value=$account[username]>$account[username]<br>"; > > Try: > echo "<option value={$account['username']}"; > $selected = ($account['username'] == $_POST['user']) ? 'selected' : ''; > echo $selected; > echo ">{$account['username']}<br>"; > > > } > > ?> > > </select> > > <input type="submit" value="send">
This is good. I've always liked things like this:
$query="SELECT ..."; if ($result=mysql_query($q)) { $sel[$user]=" selected"; print "<select name='users'>\n"; while ($row=mysql_fetch_array($result)) { printf(" <option value='%s'%s>%s</option>\n", $row['id'], $sel[$row['id']], $row['text']); } print "</select>\n"; }
-- Paul Chvostek <paulit.ca> Operations / Abuse / Whatever it.canada, hosting and development http://www.it.ca/
attached mail follows:
When creating an image using the image functions how do you control the type face size?
attached mail follows:
How do I get the directory size? Suppose there is a function for this.
antti
attached mail follows:
Hello friends.
The follwing code displays the date on my webpage :
echo date ("l dS of F Y h:i:s A");
However, I need to add 12 hrs to this date befor displaying on the webpage. Can someone please help me to modify the above code?
Thanks Denis
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]