Re: [PHP] Code for off-site Maintenance?

2002-08-21 Thread Martin Clifford

Good comments made by all, no doubts.  Something said by Justin though, sticks out 
above the rest.

I strongly recommend to everyone to never, EVER edit or manipulate LIVE code!  I know 
we're all good at what we do, but accidents happen (perhaps you didn't specify a WHERE 
clause in your delete statement for your database?  Whoops!).  Like Justin, my process 
is to test, test, test, upload, and test some more.  Extra time spent now could 
possibly mean less time spent correcting stupid mistakes.

Martin

The more I see of this world, the more I am convinced of the inability of brute force 
to create anything durable.  - Napoleon

 Andre Dubuc [EMAIL PROTECTED] 08/21/02 09:49AM 
Thanks Justin,

A web-based control panel  content management system seems like a nice 
invitation to enter 'Hackers' Paradise'. I like the idea of doing it at home 
and testing, as you do. Something inside of me squirms at the idea of the 
whole shebang being tatooed by a hacker.

Regards,
Andre

On Wednesday 21 August 2002 09:21 am, Justin French wrote:
 I'm usually weeks, or month ahead of myself.  The code I have in my local
 environment is looking forward towards knew features, new ideas, etc etc.
 Every week or two I grab a mirror of the online database (or I could
 connect straight to it of course), and WHEN new code is ready to upload, I
 do it via FTP.

 If I had a LOT of uploads, I'd write something that does it for me,
 comparing dates or something.

 I do have a web-based control panel  content management system for some
 sections of some sites, allowing me (or the client) to add / edit / delete
 / arrange some content...

 End of the day, it's each to their own -- but I know that I wouldn't want
 to be directly editing live code, data or modules on the fly.  I like to
 work on a mirror, test, test, test, upload, test.


 Justin French

 on 21/08/02 10:11 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote:
  Soon, I will be transferring my site to go on-line with my IP. Since I've
  never managed anything off-site, I have a very fundamental question:
 
  What are the usual procedures with respect to maintaining a site, that
  is, accessing the PostgreSQL database for corrections, deletions, etc?
 
  One idea that occured to me:  mirror the site here, complete with
  database, and modify stuff at this end, then upload to the IP. Or should
  I create some form of management code that would allow me, using php, to
  access and modify the stuff on-line. I've looked at Zope, Midguard, and
  another one, but they seem like over-kill (and I would have to change a
  lot of my code to use them).
 
  I would appreciate any input pointing how I should proceed -- I'm a total
  newbie in this area. Any pointers, or where to look, would be greatly
  appreciated.
 
  Tia,
  Andre


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




[PHP] Re: passing variable via url ( newbye question)

2002-07-31 Thread Martin Clifford

Because you HAVE to use it if you have register_globals OFF.  Only when 
register_globals is ON can you do what you thought is more efficient, but isn't.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Lord Loh. [EMAIL PROTECTED] 07/31/02 02:37AM 
Why bother with $_GET['modo']; ?


-- 
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




Re: [PHP] select multiple

2002-07-31 Thread Martin Clifford

It depends on how you want them to be in the database.  If you want comma-delimited, 
then just use implode().

$array = array(Red, Blue, Green);
$comma_seperated = implode(, , $array);
$space_seperated = implode( , $array);

There really is no limit to how you want to do this.  Then just use explode() with the 
same arguments (although replace array with the comma_seperated string) to go back to 
an array.

HTH!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 [EMAIL PROTECTED] [EMAIL PROTECTED] 07/31/02 08:56AM 
Hello,
i have done as told to select multiple value from a html
form, but i cannot insert all of them into  MySql
database.
it inserts Array into the field, instead of the list of
values.
What can i do?
Is there a special script to insert them?
i tried,
$str = ;
foreach ($tableau as $k=$v)
$str= $v .  ;
$sjt1=$_POST[sjt1]; and then the insert command
(among others )but it's always the same story. Please
help, thanks

---
L'e-mail gratuit pas comme les autres.
NOMADE.FR, pourquoi chercher ailleurs ?



--
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




Re: [PHP] Disabling Browser BACK button

2002-07-31 Thread Martin Clifford

There is never a way to disable back, forward, home, etc buttons.  They all have 
shortcuts that will ALWAYS work, so there's really no point.  Additionally, it's all 
nice and good that your site works fine without using cookies, and don't take this 
offensively, but if the client cannot use the back button without getting mishapen 
results, then it doesn't sound as if the site is designed very efficiently.

Just my opinion.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Petre [EMAIL PROTECTED] 07/31/02 01:16PM 
HI
Is there a way I can disable the client's browser back button, forcing 
them to use the navigation I built into the page?
Ideally, when they try to press BACK on browser, a popup asking them 
to use the navigation instead would win first prize.

The reason I'm asking is again to do with sessions, I have an app 
running 100% now without using cookies, but if the user hits BACK and 
ignores the expire warning, the app produces unwanted results ( adds 
form data again to the db etc.)
Just want to patch the holes.

Maybe write my own little browser that has no back button??



-- 
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




Re: [PHP] String Question

2002-07-31 Thread Martin Clifford

Give this a whirl:

?php

$string = abcdefghijklmnopqrstuvwxyz;
$len = strlen($string)  // in this case, 26

for($i=0; $i  $len; $i+8) {
   $str_array[] = substr($string, $i, 8);
}

for($i=0; $i  count($str_array); $i++) {
   echo $str_array[$i] . br\n;
}

?

I haven't tested it, but in theory it should find the length of the string (26), loop 
through it as long as $i is less than 26, incrementing 8 at a time.  Each time it goes 
through, $str_array[] is fed a new element, which is a substring of $string that 
starts at $i (0, 8, 16, 24, etc) and grabs 8 characters.  So here is how the data 
should be retrieved.

1st loop:  0-7 (8 elements)
2nd loop:  8-15 (8 elements)
3rd loop:  16-23 (8 elements)
4th loop:  24-26 (3 elements)

Let me know how it works out for you :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Randy Johnson [EMAIL PROTECTED] 07/31/02 03:26PM 
Hello,

I would like to be able to do the following but have not figured out a way to handle it

$string=abcdefghijklmnopqrstuvwxz;

I would like to divde the above string into separate strings 8 charactes long , example

$string1=abcdefgh
$string2=ijklmnop
$string3=qrstuvwx
$string4=yz

if the string were only 10 long

$string=abcdefghij

then

$string1=abcdefgh
$string2=ij

any suggestions would be greatly appreciated.

Thanks,


Randy


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




[PHP] A Fond Farewell

2002-07-31 Thread Martin Clifford

Howdy List,

Well, apparently we are no longer permitted to receive personal emails where I am 
working, so I'm afraid I'll have to part ways with the lot of you.  It's unfortunate, 
considering I think this one of the best places to find information about PHP (and 
more!) on the internet.  It sure as hell as taught me a lot about our craft.

To those that I have helped, thank you for giving me the opportunity to do so.  It has 
truly been MY pleasure.  You can always contact me at this address if you're in a 
bind, and I'll do what I can :o)

To those that have helped me, one HUGE THANK YOU!!!  You all are the best of the best, 
and I'll always been grateful for the advice and knowledge that you all have shared 
with me.  You are truly great people to be so generous.  Thank you again!

If anyone wants to contact me, you'll have to reply directly, as I'm unsubscribing 
after I send this last mail.  Against my will, no doubt, but leaving just the same.  
Take care, everyone, and as always...

Happy Coding! :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/



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




Re: [PHP] passing variable via url ( newbye question)

2002-07-30 Thread Martin Clifford

http://myaddress/php/mypage.php?modo=123color=redsize=3 

Just separate name/value pairs with ampersand ().

HTH

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Saci [EMAIL PROTECTED] 07/30/02 04:09PM 
I can pass one variable using the url on this way

http://myadress/php/mypage.php?modo=123 

and to read i have the code

echo $_GET['modo'].BR;

That's work fine on 4.21

How can I pass  and read 3 variables instead of one ?

I nedd to pass
 mode = 123
color= red
size=3

 using the url

I tried
http://myadress/php/mypage.php?modo=123color=redsize=3 

and to get

echo $_GET['modo'].BR;
echo $_GET['color'].BR;
echo $_GET['size'].BR;

but does not work

How can i do that





-- 
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




Re: [PHP] Array variable in Javascript PHP

2002-07-29 Thread Martin Clifford

PHP cannot read a JavaScript array, simple as that.  There are many workarounds, 
depending upon your situation.  You can, for instance, create a function that is 
called onsubmit, that will take any values in checked checkboxes and put them into a 
comma-delimitted string inside a hidden form element.  That string is then passed to 
the PHP page, where it can be parsed (ala implode/explode) and put into a new array.

I hope that made some sense :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Sheni R. Meledath [EMAIL PROTECTED] 07/29/02 11:18AM 
Hello:

In a form I am using a series of check boxes for a number of lists. Some 
calculations has to be done on the client side using Javascript depending 
upon the check box values. For this I am using a single variable name 
(array) for the check boxes in a list and another for the next list and so 
on. The format I have used is
input type=checkbox name=list1 value=Education onclick=addList() 
Education
input type=checkbox name=list1 value=Profession onclick=addList() 
Profession

I can access these variables from Javascript as list1[0]  list1[1].
(document.form.list1['0'].checked  document.form.list1['1'].checked

But when this form is submitted to the PHP script I am getting only the 
last value. list1 = 'Profession'. I am not getting an array of values.
?
for ($i=0; $icount($list1); $i++)
{
$listall .= '$list1[$i],';
}
?

How can I accomplish both these operations? I cannot use single variables 
names for each item in the form, because it is more than 1000. Also I want 
to use both Javascript  PHP operations. Please help to solve this issue or 
suggest some other ways to accomplish this business logic.

Many Thanks in Advance  Best Regards
Sheni R Meledath
[EMAIL PROTECTED] 


-- 
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




Re: [PHP] Help Please

2002-07-29 Thread Martin Clifford

You can't send headers after the page has left the server.  If you try to write to the 
HTML file in ANY way, even a hard return in your code, then you are telling the server 
that the headers have been completed and should be sent to the client (browser).

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Varsha Agarwal [EMAIL PROTECTED] 07/29/02 04:00PM 
Hi,
I am trying to run a sample program. It connects to a
postgres database verifies user name and password and
if correct, displays the login screen.
But in that program wherever there there are
setcookies() or header() functions, I get following
error

Warning: Cannot add header information - headers
already sent by (output started at
var/www/html/processing.php:5) in
/var/www/html/common.php on line 63

I checked the settings of my browser, it can accept
all cookies.
Someone help please!!!

__
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.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




Re: [PHP] OT - javascript question..

2002-07-29 Thread Martin Clifford

?php

echo body onunload=\opener.window.location='$PHP_SELF';\\n\n;

?

Something similar will work fine.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Kelly Meeks [EMAIL PROTECTED] 07/29/02 04:00PM 
Sorry for the off topic post, but this is by far the most experienced list I've found.

I've got a php page that show all the .gif and .jpeg files in an directory via a form 
based drop down menu.

On the same page, I've also got a link that opens a new window, and allows the user to 
upload an image to that same directory.

Is there any way, when the upload window is closed, to force a reload of the other 
page, so the dynamic pop-up reflects the recent upload?

Thanks in advance,

Kelly


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




Re: [PHP] Help Please

2002-07-29 Thread Martin Clifford

That's not entirely correct, though.  If you are using output bufferng, then you can.  
Also, for example, say this is your file, with the makeshift line representing the top 
of the text editor:

Start

?php header(Location: index.php?msg=blah); ?
-End

That will produce the same error as before, since a hard return was entered before the 
parser began it's work, therefore finishing the headers and sending the data to the 
client for rendering.  Hope this clears something up :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Dennis Moore [EMAIL PROTECTED] 07/29/02 04:18PM 
you cannot print or echo anything back to the browser before running the
header() function...




- Original Message -
From: Varsha Agarwal [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 29, 2002 4:00 PM
Subject: [PHP] Help Please


 Hi,
 I am trying to run a sample program. It connects to a
 postgres database verifies user name and password and
 if correct, displays the login screen.
 But in that program wherever there there are
 setcookies() or header() functions, I get following
 error

 Warning: Cannot add header information - headers
 already sent by (output started at
 var/www/html/processing.php:5) in
 /var/www/html/common.php on line 63

 I checked the settings of my browser, it can accept
 all cookies.
 Someone help please!!!

 __
 Do You Yahoo!?
 Yahoo! Health - Feel better, live better
 http://health.yahoo.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 



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




Re: [PHP] Help Please

2002-07-29 Thread Martin Clifford

Copy and paste the code (minus and indisclosurables) and we can take a look at it :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Varsha Agarwal [EMAIL PROTECTED] 07/29/02 04:27PM 
Hi,
I did not find any print or echo stetement in the
sample example before hearder or setcookie function.
Is there any way to find out what really is causing
error or trace the program. Actually i am very new to
this cookies and all stuff. Is there any way of
tracing the program? I am using it on red hat 7.3.

--- Dennis Moore [EMAIL PROTECTED] wrote:
 you cannot print or echo anything back to the
 browser before running the
 header() function...
 
 
 
 
 - Original Message -
 From: Varsha Agarwal [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, July 29, 2002 4:00 PM
 Subject: [PHP] Help Please
 
 
  Hi,
  I am trying to run a sample program. It connects
 to a
  postgres database verifies user name and password
 and
  if correct, displays the login screen.
  But in that program wherever there there are
  setcookies() or header() functions, I get
 following
  error
 
  Warning: Cannot add header information - headers
  already sent by (output started at
  var/www/html/processing.php:5) in
  /var/www/html/common.php on line 63
 
  I checked the settings of my browser, it can
 accept
  all cookies.
  Someone help please!!!
 
  __
  Do You Yahoo!?
  Yahoo! Health - Feel better, live better
  http://health.yahoo.com 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php 
 
 


__
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.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




Re: [PHP] How can I get my session variable to pass to anotherpage?

2002-07-26 Thread Martin Clifford

You have to have session_start() in each page in order to carry over session 
variables. :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 DonPro [EMAIL PROTECTED] 07/26/02 04:06PM 
Hi,

I have a form that calls a PHP script which sets a session variable and
redirects to anopther URL as such:

session_start();
$HTTP_SESSION_VARS['userid'] = someidnumber;
Header('Location: ' . 'http://www.mydomain.com/welcome.html');

On welcome.html, I have the following code:

script language=php
echo 'userid: ' . $HTTP_SESSION_VARS['userid'] . 'br/';
/script

When I run it in my browser, the value of 'userid' is empty.  Anyone know
why?



-- 
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




RE: [PHP] php redirect

2002-07-26 Thread Martin Clifford

Learning about HTTP protocol helps a LOT with understanding headers.  Basically, the 
headers are generated by the server to tell the client (browser) what to do.  If you 
send ANYTHING (even a hard return) before the header function is invoked then you will 
get this error.  In essence, if you are going to use the header() function without 
output buffering, then it should be just like this:

--top of text editor
?php
header(Location: blah.php);
?
-- End of text editor

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Tyler Durdin [EMAIL PROTECTED] 07/26/02 11:21AM 

I already tried that and i got an error that said Cannot add header 
information - headers already sent by (another snippet of code I have in the 
page.

Use the header() function

http://www.php.net/manual/en/function.header.php 

*




_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx 


-- 
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




Re: [PHP] (newbie) questions abot vars and args

2002-07-26 Thread Martin Clifford

1)  To echo the variables name instead of it's value, surround it instead by single 
quotes, not double.
   echo '$var' OUTPUTS $var
   echo $var OUTPUTS the contents of $var

2)  Checkout the func_get_args() function.
   http://www.php.net/manual/en/function.func-get-args.php

HTH!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Alexander Ross [EMAIL PROTECTED] 07/26/02 11:40AM 
1)  Given a variable how can I echo the var's name, not its value??
2)  Is there a way for PHP function to handle a dynamic number of arguments?
In other words, I want to write a function that takes any number of
arguments (strings) and echos each of them with a br appended to each of
them.

Thanks for your help everybody



-- 
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




Re: [PHP] still on sessions

2002-07-26 Thread Martin Clifford

I always just register an extra variable to track logged in users.  If the user has 
logged in, it is set to TRUE, if not, FALSE.  Then I just do comparisons on that 
variable.

?php
session_start()
if($loggedin == FALSE) {
   header(Location: login.php);
}
?

Something along those lines.



 Tyler Durdin [EMAIL PROTECTED] 07/26/02 03:28PM 
alrigh I have switched everything over to the $_Session['variable'] style of 
session. Next question, I have a little script that used to check if the 
session was registered and if it was not it would redirect to the login 
page. How do i accomplish this now that i cannot check if the session is 
registered? Here is what i have.

?
  session_start();
  if (session_registered(valid_user2')) {
echo  you are registered;
  } else {
header(Location: http://loginpage.com;);
  }
?

How do I check if a session is active/registered or whatever it is so i cn 
still redirect or assign variables?



_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.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




Re: [PHP] PHP Meetup, how many of you have signed up?

2002-07-25 Thread Martin Clifford

I've signed up, and I suppose I would qualify for the Washington, DC area, though that 
is not strictly the locale I have setup :o)

As it's new, I'm sure many will be signing up in the coming weeks.  Personally, I can 
hardly wait to sit around and chat with other PHP developers.  Sign up now if you 
haven't all!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Jay Blanchard [EMAIL PROTECTED] 07/25/02 10:15AM 
Top 10 Locales --
Washington DC (9 members)
Amsterdam (7 members)
Leeds, UK (7 members)
London, England (7 members)
Atlanta (5 members)
Manhattan (below 42nd St) (5 members)
Melbourne (5 members)
Oakland-Alameda, CA (4 members)
Nashville, TN (4 members)
St. Louis, MO (4 members)

I am somewhat surprised that there are no more developers in Texas signed
up. In my area it would just be me and one other. I was hoping to get to see
enough to start a users group. There is only a total of 268 signed up
world-wide.

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*



-- 
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




Re: [PHP] pulling records from mysql

2002-07-25 Thread Martin Clifford

You would need to use SQL to identify which columns and rows you need to retrieve, 
then use various MySQL PHP functions to gather the information.

For your two queries, they would appear thus, respectively:

SELECT firstname FROM tablename WHERE id=16

and

SELECT firstname FROM tablename ORDER BY id ASC LIMIT 15

The functions you'll want to look into are mysql_connect(), mysql_select_db(), 
mysql_query() and mysql_fetch_array().  They can be found at http://www.php.net, do a 
search for any one of the functions ;o)

HTH

Martin

 Tyler Durdin [EMAIL PROTECTED] 07/25/02 11:18AM 
I have a column in my table named firstname with twenty records in it. How 
can i use php to pull out individual records (say for ex. record 16)? Also, 
how could i pull out all records upto number 15? Thanks in advance.



_
Send and receive Hotmail on your mobile device: http://mobile.msn.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




Re: [PHP] Paying Job...

2002-07-25 Thread Martin Clifford

resists the urge to debate ethics

Why didn't you just say, Charge by whichever will screw the client the worst.?  
Jesus.

Martin

 Tyler Longren [EMAIL PROTECTED] 07/25/02 11:44AM 
Charge by which ever will get you the most money.

tyler

On Thu, 25 Jul 2002 11:46:38 -0400
Gerard Samuel [EMAIL PROTECTED] wrote:

 Basically, someone is looking to get a database driven site built,
 and Ive never written code for money before.
 Im looking for advice, as to how the experienced coders in here charge
 
 for their work.
 Do you charge by the page, script or by the hour (that would be nice).
 
 Thanks for any input you may provide...
 
 -- 
 Gerard Samuel
 http://www.trini0.org:81/ 
 http://dev.trini0.org:81/ 
 
 
 
 -- 
 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 



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




Re: [PHP] pulling records from mysql

2002-07-25 Thread Martin Clifford

Yes, that will indeed return the rows specified, but the result is very unstable.  By 
it's nature, MySQL does not have to conform to any sorting method unless you specify 
it.  So it's very good practice when retrieving multiple rows to ALWAYS order them.  
Just my thoughts :o)

Martin

 Tech Support [EMAIL PROTECTED] 07/25/02 12:09PM 
This query will return only the 16th row

SELECT firstname FROM table_name LIMIT 16, 1

This query will give you all rows up to 15

SELECT firstname FROM table_name LIMIT 1, 15


Jim Grill
Support
Web-1 Hosting
http://www.web-1hosting.net 
- Original Message -
From: Tyler Durdin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 10:18 AM
Subject: [PHP] pulling records from mysql


 I have a column in my table named firstname with twenty records in it. How
 can i use php to pull out individual records (say for ex. record 16)?
Also,
 how could i pull out all records upto number 15? Thanks in advance.



 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.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 



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




Re: [PHP] Re-directing

2002-07-24 Thread Martin Clifford

PHP redirects using the header() function, but it's not very useful if information has 
already been sent to the browser.  ANY information, including a hard return.  So if 
you have a login script, you would start your session, register any variables, then 
redirect.

?php header(Location: index.php); ?

That would do the trick.  But like I said, once the parser begins to write HTML to the 
browser, then you can no longer send HTTP headers.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Roberts, Mark [EMAIL PROTECTED] 07/24/02 10:28AM 
Is there a way to redirect to a different script in PHP? I call it
redirecting, but can't find it in the documentation using that track.

I have a script...that if a certain criteria is met, I want to load a
different script. Haven't been able to figure that out yet. I have gotten
about it by conditionally executing a location.href in javascript. It works,
but would like to know how to do it in PHP.

~Thanks.

Mark Roberts
Sr. Systems Analyst
LanApps/Web Development
The Williams Information Services Corporation
918-573-1706
[EMAIL PROTECTED] 




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




Re: [PHP] Re-directing

2002-07-24 Thread Martin Clifford

Awesome!  Learn something new everyday!

That's why I love this list :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Chris Sharkey [EMAIL PROTECTED] 07/24/02 11:01AM 
Well you can actually,

If you start your script IMMEDIATELY (well before you output anything) with:

?php
ob_start();

This will buffer output so you can use your header anywhere in your script

eg
header(location.php);
exit;

and then if you weren't redirected then you send the output with

ob_end_flush();


Chris.


- Original Message -
From: Martin Clifford [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 12:47 AM
Subject: Re: [PHP] Re-directing


PHP redirects using the header() function, but it's not very useful if
information has already been sent to the browser.  ANY information,
including a hard return.  So if you have a login script, you would start
your session, register any variables, then redirect.

?php header(Location: index.php); ?

That would do the trick.  But like I said, once the parser begins to write
HTML to the browser, then you can no longer send HTTP headers.

Martin Clifford
Homepage: http://www.completesource.net 
Developer's Forums: http://www.completesource.net/forums/ 


 Roberts, Mark [EMAIL PROTECTED] 07/24/02 10:28AM 
Is there a way to redirect to a different script in PHP? I call it
redirecting, but can't find it in the documentation using that track.

I have a script...that if a certain criteria is met, I want to load a
different script. Haven't been able to figure that out yet. I have gotten
about it by conditionally executing a location.href in javascript. It works,
but would like to know how to do it in PHP.

~Thanks.

Mark Roberts
Sr. Systems Analyst
LanApps/Web Development
The Williams Information Services Corporation
918-573-1706
[EMAIL PROTECTED] 




--
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 



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




Re: [PHP] PHPMyAdmin interface

2002-07-24 Thread Martin Clifford

It's not normal that I've come across.  Any hosting company I've ever dealt with 
(albeit not many, still three different ones), have all offered phpMyAdmin for 
interfacing with MySQL.  And honestly, if the host REQUIRES you to do it, then they 
aren't worth hosting with.  You'll find that will transcend into other areas of how 
they do business (i.e. technical support tickets, etc).

Currently I'm hosting with http://www.websytz.com, and they have good prices.  Another 
of my sites is on http://www.dzones.com, and they're very good as well.

WebSytz' control panel flat out sucks, but it's usable.  DZones has an incredible 
control panel, but they just didn't have the price I wanted for my current website.  
There's plenty out there, and since you pay monthly, you lose nothing by switching to 
another company.  The choice is yours.

BTW, I hadn't intended this to become a chapter, but it did... sorry for the length :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 [EMAIL PROTECTED] 07/24/02 12:46PM 
I have just recently just signed up for virtual hosting with a MySQL
database.  They do not have a PHPMyAdmin interface too access the
database.  All they have given me is my username and password and the
server too login too.  They suggested that I install PHPMyAdmin on my
workstation and access my database that way.
Is there major security risks too my database doing this?  Is this normal,
where service providers request that I install PHPMyAdmin on my
workstation or should I be looking for a new internet service provider who
supplies the interface on the server?




-- 
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




Re: [PHP] MySQL Backup and Restore

2002-07-24 Thread Martin Clifford

With phpMyAdmin, just scroll down until you see the dumping section.  Select the 
appropriate information, tick the save as file box, then Go.  It'll prompt you to 
save the file.  You just use that file, then, as a query to your next database.

Martin

 1LT John W. Holmes [EMAIL PROTECTED] 07/24/02 01:38PM 
I've never had any luck using PHPMyAdmin for dumping databases. They always
time out over the 30 second limit. I know if it was my installation, I could
fix it, but these are usually with hosting companies, where that's the only
access they provide. It's very much a pain in the butt...

---John Holmes...

- Original Message -
From: Justin French [EMAIL PROTECTED]
To: Peter [EMAIL PROTECTED]; kip [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, July 23, 2002 11:29 PM
Subject: Re: [PHP] MySQL Backup and Restore


 Can highly recommend doing it (and a whole lot more) with phpMyAdmin
 (http://phpMyAdmin.net)

 Justin French




 on 24/07/02 1:04 PM, Peter ([EMAIL PROTECTED]) wrote:

  grab ur self a copy of myphpadmin  or use mysqldump or just simply make
a
  copy of the data dir or grab ur self a copy of mysql_front
 
  -Original Message-
  From: kip [mailto:[EMAIL PROTECTED]] 
  Sent: Wednesday, 24 July 2002 12:58 PM
  To: [EMAIL PROTECTED] 
  Subject: [PHP] MySQL Backup and Restore
 
 
  Hi,
 
  Can you tell me the steps of backup and restore the databases in Mysql?
 
  And can i specific a path for the backup file?
 
  Futhermore, i have installed the MySQL in Win2000 but i don't know how
to
  restore the database of MySQL from a Linux server to Win2000 MySQL.
 
  Thanks
 
 
 
  --
  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 



-- 
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




Re: [PHP] Help with msql_fetch_array()

2002-07-24 Thread Martin Clifford

Shouldn't it be:

$result = mysql_query($sql, $link_id);

PHP will be quick to tell you that there is a missing link identifier in the 
mysql_query() call.  It's happened to me plenty of times.  HTH!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 PHPCoder [EMAIL PROTECTED] 07/24/02 02:16PM 
Yes, what on earth was I thinking!
should be:
...
$result = mysql_query($sql);
if (mysql_num_rows($result)) {
 $row = mysql_fetch_assoc($result);
 } else {
 echo whatever;
 }
...


Kevin Stone wrote:

You beat me too the punch and I think you explained it better than me, but
just one minor little thing to note.  Where you said..

if ( $result = mysql_query($sql)) 

This is not a valid way to check if the query has returned anything.
mysql_query() returns FALSE on error.  So if there was no error but there
also wasn't anything returned then the object stored in $result wiill more
than likely evaluate to TRUE.  For the determining factor you should count
the number of rows with mysql_num_rows($result).  If the returned value is
zero then you know it hasn't returned anything.

-Kevin

- Original Message -
From: PHPCoder [EMAIL PROTECTED]
To: Matthew Bielecki [EMAIL PROTECTED]
Cc: php-general [EMAIL PROTECTED]
Sent: Wednesday, July 24, 2002 11:50 AM
Subject: Re: [PHP] Help with msql_fetch_array()


I can almost guarantee that it's not the second line that is failing,
the problem here is that $result is not containing naything, and that is
normally due to the fact that you are not connecting to the db, or the
table tablename is not there.

I use the following format as my standard MySQL connect and query

snippet:

$link = @mysql_connect(localhost,$username,$password) or die ('Could
not connect!'); //@ suppresses the default error message generated by
this function and the or die() bit kills the script right then and
there should it not be able to connect.
mysql_select_db(YOUR_DB_NAME,$link);
$sql = select * from your_table_name;
if ( $result = mysql_query($sql)) {  // checks to see if $result
contains anything before it even tries to fetch an associative array
from it.
 $row = mysql_fetch_assoc($result);
} else {
echo Empty result set!;

Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9
out of 10 times, you don't need the array element id's that is returned
by mysql_fetch_array.

Matthew Bielecki wrote:

I have a couple of scripts that fail with the error of:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL

result

resource in...

I'm new to both SQL and PHP and I'm wondering if I have some setting
turned off or what.

Here's the piece of code that is failing (the second line fails):

$result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id);
   $row = mysql_fetch_array($result);


Thanks for your help in advance!!



--
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 



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




Re: [PHP] Hitting return in a textarea box...

2002-07-24 Thread Martin Clifford

I've never had a problem with this.  Even using a textbox with only the required 
parameters works fine as far as hitting the return key to get a newline.  If you're 
talking about hitting the return key to submit, that's something else entirely, hehe.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Jesse Lawrence [EMAIL PROTECTED] 07/24/02 02:26PM 
I'm putting together a message board, and I'm having
problems with hitting the return(enter) key within my
textarea.

I've looked around for a solution, I tried
wrap=hard, wrap=soft and wrap=vitual and none of
them worked (should they?  I may have done it wrong?)
and I also tried nohardbreaks and nosoftbreaks, but I
think they may be no longer supported.

Is this a case for regex?  If so, can someone perhaps
point me to an article on how to accomplish this? 
Thanks very much for any help.

Jesse

__ 
Post your ad for free now! http://personals.yahoo.ca 

-- 
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




Re: [PHP] control structure question

2002-07-23 Thread Martin Clifford

For steps and sequences, I always use switches.  Most commonly associated with the 
action variable, it would look like this:

switch($action) {
   default:
  // what to show if no variable exists, or is set to a value
  // that is not acceptable below
   break;
   case add_file:
  // what to do in the even that a file needs to be added
  // to the database.
   break;
   case remove_file:
  // what to do in the even that a file need sto be removed
  // from the database.
   break;
}

Basically, whatever the value of $action, that is what section of code will execute.  
Hope that helps!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Javier Montserat [EMAIL PROTECTED] 07/23/02 10:03AM 
is there a more programmatically elegant way of saying...

$isError = ;

function main() {

doStep1();

if (!$isError) {
doStep2();
}

if (!$isError) {
doStep3();
}
// etc. etc.
}

function doStep1() {
if ($something) {
$isError = 1;
}
}

function doStep2() {
if ($something) {
$isError = 1;
}
}

_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.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




Re: [PHP] Using PHP with MySQL - Can I supress MySQL errors?

2002-07-23 Thread Martin Clifford

Put an ampersat symbol (@) in front of the function name to suppress errors.

$link = @mysql_connect(host, user, pass);

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 DonPro [EMAIL PROTECTED] 07/23/02 12:08PM 
Hi,

I'm using PHP to connect and perform queries with a MySQL database.  I've noticed that 
it there is an error performing certain
commands like 'mysql_connect()', I'll get a warning message in the browser.

I'd like to suppress these messages as I am storing the error, mysql_error(), in an 
array.  So if there is an error, I would simply
display the contents of the array in a nice format.

Is this possible?

Thanks,
Don



-- 
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




Re: [PHP] PHP creating table for HTML layout

2002-07-23 Thread Martin Clifford

PHP is server-side, so it can't do anything that would help with the layout of HTML on 
the client-side.  You might want to look into Cascading Style Sheets (CSS) to format 
the page so that it validates the way you want it to :o)

HTH!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Briggsy [EMAIL PROTECTED] 07/23/02 04:10PM 
I am hoping someone can help me with a desperate problem I am having

I know nothing about PHP and hoping that it might be able to solve a problem
I have with HTML tables.

I want my web background to cover the entire screen regardless of screen
size. The background has a header, a left side nav and a footer. I want the
footer to be on the bottom of the screen or bottom of the text, which ever
is greater. If you go to www.v3.aru.org.nz you will get an idea of what I'm
talking about. If you are using IE 5.x or greater it should show correctly.

I used the HTML table tag height=100%, however this is not a valid tag and
therefore Netscape ignores it. Also if  I use it it wont validate as a true
complaint code, which I want it to.

So can I use PHP to create a table or place the background images to create
a header, side nav and footer with the middle white section adjusting to
screen size.

I don't want to have to greater multiple sites for different resolutions and
would rather have one template that all pages call by an include statement
(That's the ASP command, think I saw the same command in PHP)

Any help or solution would be appreciated as I have been searching the net
and working on this for weeks and I'm getting nowhere.

Thanks

Shane.





-- 
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




[PHP] Re: Using Javascript

2002-07-22 Thread Martin Clifford

Just my opinion, but it is ALWAYS a good idea to terminate statements with semicolons, 
no matter if there is or isn't additional statements.

But thanks Chris for at least using standardized HTML coding practices.  I can't stand 
it when I see tags and the like that don't cooperate with standards.

Martin

 Chris Earle [EMAIL PROTECTED] 07/22/02 01:18AM 
You use the onClick feature like this:

input type=text name=text1 onClick=dd.value='? echo $correct; ?'
no semicolon unless there is more than one thing being called/defined -- you
use single quotes within the onClick's double quotes

Uma Shankari T. [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Hello,

  I need to display a value on the text box during onClick event where the
 data is fetched from the database..I have given the code like this but it
 is giving unterminated string constant..


 input type=text name=text1 onClick=(dd.value=? echo $correct; ?);


 Can anyone please tell me how to solve this ...


 Thanks  Regards,
 Uma




-- 
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




Re: [PHP] Newbie's question about \n

2002-07-22 Thread Martin Clifford

Think of it this way:  br creates a line break in HTML Output, \n creates a line 
break in HTML Code.

echo I really\n like\n PHP!;

HTML Code:

I really
 like
 PHP!

HTML Output:

I really like PHP!

HTH



It seems that i have a very silly problem.
I can't get the new line escape character to work.
the following is my SIMPLE script and corresponding output.


PHP script:
-//W3C//DTD HTML 4.0 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd; 





echo this should be printed out:\n;
echo this is a second line;
?




Output in IE6:
this should be printed out: this is a second line


regards,

KK




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



-
Do You Yahoo!?
Yahoo! Health - Feel better, live better

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/



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




Re: [PHP] What does register_globals do?

2002-07-22 Thread Martin Clifford

My way of thinking about is:

With register_globals ON, all variables defined are available anywhere in the script 
(with the exception of functions and classes, unless defined otherwise), whereas with 
register_globals OFF, they are only available through the superglobals for the 
respective variable types.

I'm sure there's a much better way to explain it, but it works for me :o)


Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Matt Babineau [EMAIL PROTECTED] 07/22/02 03:59PM 
I have never had a clear understanding about what this does, the php.ini
has an explanation but being newer to PHP I don't understand it very
well. Could someone prodive a human explanation about what
register_globals does and why it is so important?
 
Matt Babineau
MCWD / CCFD
-
e:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] 
p: 603.943.4237
w:  http://www.criticalcode.com/ http://www.criticalcode.com 
PO BOX 601
Manchester, NH 03105
 


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




RE: [PHP] What does register_globals do?

2002-07-22 Thread Martin Clifford

unless defined otherwise was what I said.  When I said that, I simply meant that you 
declare the variables as global within the function and/or class.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Matt Schroebel [EMAIL PROTECTED] 07/22/02 04:41PM 
 From: Martin Clifford [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, July 22, 2002 4:21 PM
 Subject: Re: [PHP] What does register_globals do?
 My way of thinking about is:
 
 With register_globals ON, all variables defined are available 
 anywhere in the script (with the exception of functions and 
 classes, unless defined otherwise), whereas with 
 register_globals OFF, they are only available through the 
 superglobals for the respective variable types.

That's not quite right.  Php's variable scoping is different than most langauges.  
Variables inside a function are always local, even with register_globals on (this has 
something to do with Rasmus' life experiences at IBM). So you would need to use global 
on a variable inside a function (unless it's passed in) and except for the 'magic' 
global arrays, $_POST, $_GET, $_COOKIE, $_SERVER, etc

--- register_globals on --
http://localhost/index.php?target=help 

?php

function echo_out() {
  global $target;
  echo $targetbr;
}

echo_out();
?

--- register_globals off --
http://localhost/index.php?target=help 

?php

function echo_out() {
  echo {$_GET['target']}br;
}

echo_out();
?

-- 
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




[PHP] Re: Arrays and Regs

2002-07-19 Thread Martin Clifford

Firstly, many thanks to Richard and Dan...

A quick test script in PHP would have been faster than asking... :-)

It was just one of those questions that I had burning in my mind at the time, and 
since I don't have access to PHP at work (As if the Government would allow that!), I 
had to ask :o)

And to Dan:  I would love to change the line margins of my email client, but 
unfortunately Novell Groupwise sucks, and the government will not, without exception, 
allow customization of any software, whatsoever.  So I'm stuck with it.

Thanks again guys!

Martin


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




Re: [PHP] Check for Associative Array

2002-07-18 Thread Martin Clifford

Try this:

while($row = mysql_fetch_assoc($result)) {
// code here
}

This way, the resulting array will ONLY be associative.

HTH!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Henning Sittler [EMAIL PROTECTED] 07/18/02 12:57PM 
What's the best way to check for an Associative Array?  There is no
is_assoc() or similiar function listed in the manual (I don't think anyway).

I'm using mysql_fetch_array() and I want to foreach only the assoc. part of
the array without using mysql_fetch_assoc():

foreach ($arr as $key=$value) { 
echo $key:$value;
}

But of course it show both the indexed array and the assoc array contents.
Is there an existing function to check this, or should I do one of these
things inside the foreach loop:

A) set $last=value and just check if $value = $lastval

B) check if the $key is just a number or just a string

C) $key += 1


?? Thanks,


Henning Sittler
www.inscriber.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




Re: [PHP] Check for Associative Array

2002-07-18 Thread Martin Clifford

Oh well.  And HTH means Hope to Help.

 For some unknown reason the OP specifically does not want to use 
 mysql_fetch_assoc()!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/



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




Re: [PHP] spawning scripts to different graphical targets

2002-07-18 Thread Martin Clifford

I would assume you just do it as if you didn't have any scripts in it in the first 
place.

The link in frame A might be like below:

a href=content.php?show=TOC target=bClick here to see the content/a

Then, in frame b, content.php will show up and you can then use $show to decide what 
to do.  I might be totally off on this one, but I only went on what it sounded like 
you wanted.

The same applies to JavaScript.

// This can be used to get the height and width of the browser window for any 
server-side needs.

script language=javascript
!-- hide me

function getScreen() {
   var height = screen.height;
   var width = screen.width;

   document.location = index.php?height= + height + width= + width;
}

body onload=getScreen();

:babbles on and on and on...:

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Alberto Serra [EMAIL PROTECTED] 07/18/02 03:12PM 
??!

Is there a way I can decide where to target my output from server side?

suppose my page has two iframes

+---++---+
! A !! b !
+---++---+

while executing a script that is called by A can I spawn another script 
that will output to b? And no, I cant' use any Jscript, but I do know 
from server side what my target names are (A and b, that is).

Bear in mind that A and b might be even different windows, but I'd more 
than happy even if it worked with iframes on a single window.





@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is...


-- 
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




[PHP] Arrays and Regs

2002-07-18 Thread Martin Clifford

Howdy,

Just a performance question, if anyone knows for sure.  Within a large array, would 
using numerical indices be quicker than associative?  I'm talking about a *noticeable* 
difference in performance, here.

Also, on Regular Expression replacements:

$text = eregi_replace(([abc]+), span style=\color: red\\\1/span, $text);

Would this replace any occurences of the pattern with the same pattern match in red 
text?  I'm not sure exactly how the \\1, \\2, etc. works.  So, does:

$text = eregi_replace((a)(b)(c), \\1, $text);

Does this output only the 'a'?  I find this confusing for some reason, hehe.  Any help 
would be great!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/



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




Re: [PHP] $HTTP_SESSION_VARS ? Have I got it wrong

2002-07-17 Thread Martin Clifford

Define the value of $count before registering it, and it should work fine :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Henry [EMAIL PROTECTED] 07/17/02 10:14AM 
The answer is probably yes.

I do a
session_start() followed by a $HTTP_SESSION_VARS['count']=2 on one page.
Then I go to another page and do a session_start() again; unfortunately
the $HTTP_SESSION_VARS['count'] is empty!!!

I tried doing a session_register('count2'); $count2=123; in the first page
followed by another page where I display $count2 and that works fine.

Why?

Henry



-- 
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




Re: [PHP] $HTTP_SESSION_VARS ? Have I got it wrong

2002-07-17 Thread Martin Clifford

Ignore that, I'll just go grab my copy of Hooked on Phonics so I can learn to read 
before replying.

:trots off:

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Martin Clifford [EMAIL PROTECTED] 07/17/02 10:15AM 
Define the value of $count before registering it, and it should work fine :o)

Martin Clifford
Homepage: http://www.completesource.net 
Developer's Forums: http://www.completesource.net/forums/ 


 Henry [EMAIL PROTECTED] 07/17/02 10:14AM 
The answer is probably yes.

I do a
session_start() followed by a $HTTP_SESSION_VARS['count']=2 on one page.
Then I go to another page and do a session_start() again; unfortunately
the $HTTP_SESSION_VARS['count'] is empty!!!

I tried doing a session_register('count2'); $count2=123; in the first page
followed by another page where I display $count2 and that works fine.

Why?

Henry



-- 
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 



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




Re: [PHP] querying for one specific row number

2002-07-17 Thread Martin Clifford

If you are using an auto_increment primary key field named id, then you would use this:

SELECT * FROM table WHERE id=2 LIMIT 1

Just so long as you know that if for some reason you delete that row, there will NEVER 
Be another id of 2, unless you set it that way.

If you only want to select certain columns from the row, then list those columns in 
place of the wildcard.

SELECT first_name, last_name FROM table WHERE id=1 LIMIT 1

HTH!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Phil Schwarzmann [EMAIL PROTECTED] 07/17/02 10:21AM 
I want query my mysql table and get one particular row.
 
So let's say my table had 5 rows (entries) in it, and I want to pull
just row #2, how would I do this??
 
THANKS!!


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




[PHP] Of Jobs and Certs

2002-07-17 Thread Martin Clifford

Howdy everyone,

I'd like to get everyone's input on Jobs and Certs.  I know there are a couple 
Certifications for web developers out there, such as the CIW and CWP certifications.

Here are my questions:

1.  What is the best method to go about becoming certified?
2.  What is the best way to go about getting into the web development industry?
3.  If you have ever taken online courses relating to web development, what is your 
opinion on them?  Good, bad, ugly?
4.  Which certification is most beneficial?  I know that CWP requires work experience 
before becoming certified past certain points, and CIW does not require this.
5.  Why can't I remember what question five was? Doh.

At any rate, I'm current a data entry clerk, but have quite a bit of web experience 
(none at a job, though), and I know that I have TONS more to learn, but I am very 
passionate about it and want to be able to do it as a career.  I just don't know where 
the hell to start, and I know that some of you might be able to offer some advice in 
this area.

Thanks in advance!  This is very important to me, so I thought I'd ask the people that 
would know best :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/



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




Re: [PHP] $_SESSION - autostart, or session_start() ?

2002-07-17 Thread Martin Clifford

The error is pretty self-explanatory.  You aren't starting the session before 
soemthing is being written to the page.

This will yeild the same error:

-top of document--
!-- BEGIN DOCUMENT 
?php session_start(); ?
-botton of doc-

This is because something has been sent to the browser (the comment line), which is 
after the HTTP headers have already returned from the server.

HTH

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Matt Babineau [EMAIL PROTECTED] 07/17/02 11:20AM 
If I set the SESSION autostart = 1 in the PHP config, would that
eliminate my need to use session_start() in my code? I have some PHP
inline with some HTML, and the PHP is telling me:
 
Warning: Cannot send session cookie - headers already sent
 
Any ideas how to remedy this?
 
Matt Babineau
MCWD / CCFD
-
e:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] 
p: 603.943.4237
w:  http://www.criticalcode.com/ http://www.criticalcode.com 
PO BOX 601
Manchester, NH 03105
 


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




Re: [PHP] how to access javascipt variables in PHP

2002-07-17 Thread Martin Clifford

You can blend the two... sort of.

script language=javascript
!-- hide me

function checkWidth() {
var width = screen.width;
var height = screen.height;
document.location = filename.php?width= + width + height= + height;
}

//--
/script

body onload=checkWidth();

I'm not aware of any PHP vars that hold screen information.

HTH

Martin

 Seppo Laukkanen [EMAIL PROTECTED] 07/17/02 03:06PM 
Can anybody help?

I have javascript code to find out browsers width and height, but they
are stored in javascript variables. How can I access them from PHP? Or
is there a method to do same in PHP straightly?

Thanks,
Seppo



-- 
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




RE: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Clifford

To add to the below, object classes, can have their own set of functions, called 
methods.  These methods are specific to the function, and ALL functions within a class 
treat any properties (variables) within the class as global.

So if you have a class Car with two properties (Make and Model), then those two 
properties can be readily accessible to any method within the class.  At least I think 
that's how it works.  I'm not all that knowledgeable on the subject :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Jay Blanchard [EMAIL PROTECTED] 07/16/02 10:51AM 
[snip]
Could someone please explain the difference between classes and functions
and how to use a class. I write alot of PHP, but I never understood this at
all. I use an include statement in many of my pages and include a file with
a bunch of functions. For instance, I might have a function called stock();
In the page I am using I include the file that has this function and I call
it like this:

stock($Sym);

I am wondering if I am doing it the wrong way. So I need to better
understand classes. What is one, and why would you use it?
[/snip]

A class is the representation of an object, such as a person, place, or
thing.
A function is a group of commands that can be called for a specific purpose.

function addNumbers()

A function can be performed on an object, but an object (the logical
extension of class) cannot be performed on a function. Does that help?

Jay

Cleverly disguised as a responsible adult

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*



-- 
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




Re: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Clifford

Here is a sample code (don't take this as gospel... Jay knows more about OOP than I 
do, I'm sure!):

class Car {
var $make;
var $model;

function setMake($x) {
$this-make = $x;
}
function setModel($y) {
$this-model = $y;
}
}

$make and $model are the properties of the Car class, and setMake() and setModel() are 
the methods of the Car class.  You don't actually get an object until make a *new* 
one.  Like this:

$passat = new Car;
$passat-setMake(Volkswagen);
$passat-setModel(Passat);

This assigns the new object, passat, the properties relating to it's make and model, 
using the methods setMake and setModel.  I'm sure this is right, but I'm sure I'm 
probably wrong (hehe, confused?).  I'm also sure someone will correct me if I am! :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Chris Crane [EMAIL PROTECTED] 07/16/02 11:06AM 
It helps a little bit, thank you. Could you provide some code as to what a
Class looks like. I am just trying to understand it better and if I see it,
it might help.
Jay Blanchard [EMAIL PROTECTED] wrote in message
000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt">news:000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt...
 [snip]
 Could someone please explain the difference between classes and functions
 and how to use a class. I write alot of PHP, but I never understood this
at
 all. I use an include statement in many of my pages and include a file
with
 a bunch of functions. For instance, I might have a function called
stock();
 In the page I am using I include the file that has this function and I
call
 it like this:

 stock($Sym);

 I am wondering if I am doing it the wrong way. So I need to better
 understand classes. What is one, and why would you use it?
 [/snip]

 A class is the representation of an object, such as a person, place, or
 thing.
 A function is a group of commands that can be called for a specific
purpose.

 function addNumbers()

 A function can be performed on an object, but an object (the logical
 extension of class) cannot be performed on a function. Does that help?

 Jay

 Cleverly disguised as a responsible adult

 *
 * Want to meet other PHP developers *
 * in your area? Check out:  *
 * http://php.meetup.com/*
 * No developer is an island ... *
 *





-- 
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




Re: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Clifford

I'm still trying to figure that out, but the fog is clearing slowly but steadily :o)

From what I've heard on this and other lists, it's all a matter of preference.  
Obviously those that come from an object-oriented environment (Java, etc), will lean 
toward this method, while others stay with the procedural side of things (using 
functions).  It's all a matter of preference, and just yet I haven't decided which is 
more useful :o)

Good luck!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Chris Crane [EMAIL PROTECTED] 07/16/02 11:19AM 
This helps quite a bit Thank you.
I am just wondering if I should make classes instead of functions? What
would be the benefit of that? Do you know?

Martin Clifford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Here is a sample code (don't take this as gospel... Jay knows more about OOP
than I do, I'm sure!):

class Car {
var $make;
var $model;

function setMake($x) {
$this-make = $x;
}
function setModel($y) {
$this-model = $y;
}
}

$make and $model are the properties of the Car class, and setMake() and
setModel() are the methods of the Car class.  You don't actually get an
object until make a *new* one.  Like this:

$passat = new Car;
$passat-setMake(Volkswagen);
$passat-setModel(Passat);

This assigns the new object, passat, the properties relating to it's make
and model, using the methods setMake and setModel.  I'm sure this is right,
but I'm sure I'm probably wrong (hehe, confused?).  I'm also sure someone
will correct me if I am! :o)

Martin Clifford
Homepage: http://www.completesource.net 
Developer's Forums: http://www.completesource.net/forums/ 


 Chris Crane [EMAIL PROTECTED] 07/16/02 11:06AM 
It helps a little bit, thank you. Could you provide some code as to what a
Class looks like. I am just trying to understand it better and if I see it,
it might help.
Jay Blanchard [EMAIL PROTECTED] wrote in message
000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt">news:000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt...
 [snip]
 Could someone please explain the difference between classes and functions
 and how to use a class. I write alot of PHP, but I never understood this
at
 all. I use an include statement in many of my pages and include a file
with
 a bunch of functions. For instance, I might have a function called
stock();
 In the page I am using I include the file that has this function and I
call
 it like this:

 stock($Sym);

 I am wondering if I am doing it the wrong way. So I need to better
 understand classes. What is one, and why would you use it?
 [/snip]

 A class is the representation of an object, such as a person, place, or
 thing.
 A function is a group of commands that can be called for a specific
purpose.

 function addNumbers()

 A function can be performed on an object, but an object (the logical
 extension of class) cannot be performed on a function. Does that help?

 Jay

 Cleverly disguised as a responsible adult

 *
 * Want to meet other PHP developers *
 * in your area? Check out:  *
 * http://php.meetup.com/*
 * No developer is an island ... *
 *





--
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 



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




Re: [PHP] strange beahaviour with a mysql query in php

2002-07-16 Thread Martin Clifford

If you only want to update the row if it exists, then you need to use a WHERE clause 
to make sure it does exist.  

Blah blah blah WHERE row_id='$id' LIMIT 1 might work.  I'm lazy and didn't want to 
retype what you had. :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 David D [EMAIL PROTECTED] 04/16/02 11:57AM 
Hello,

I ve got mysql 4.0.1
I don't understand what happen.
I use to make replace other than insert in order to avoid error in php
scripts.

I have a table with on primary key :

CREATE TABLE `nlconfig` (
  `id` tinyint(4) NOT NULL auto_increment,
  `nomnews` varchar(255) NOT NULL default '',
  `hebergeur` varchar(255) NOT NULL default '',
  `fromc` varchar(255) NOT NULL default '[EMAIL PROTECTED]',
  `fromonline` varchar(255) NOT NULL default 'contact',
  `limitconf` tinyint(2) NOT NULL default '7',
  `host` varchar(255) NOT NULL default 'localhost',
  `user` varchar(255) NOT NULL default 'root',
  `passwd` varchar(255) NOT NULL default '',
  `db` varchar(255) NOT NULL default 'newsfr',
  `tablenews` varchar(255) NOT NULL default 'news',
  `tabletemp` varchar(255) NOT NULL default 'temp',
  `tablelog` varchar(255) NOT NULL default 'log',
  `tableconfig` varchar(255) NOT NULL default 'nlconfig',
  `admin_pass` varchar(255) NOT NULL default 'pikatchu',
  `limitlog` tinyint(2) NOT NULL default '10',
  `url` varchar(255) NOT NULL default '',
  `pathtopmn` varchar(255) NOT NULL default 'http://www.test.fr/fr/',
  `langfile` varchar(255) NOT NULL default 'lang-french.php',
  `welcome_subj` varchar(255) NOT NULL default 'bienvenue',
  `welcome_msg` text NOT NULL,
  `sub_msg` text NOT NULL,
  `pied` tinytext NOT NULL,
  `validation` tinyint(1) NOT NULL default '1',
  `description` text,
  `newstemplate` varchar(100) default NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;


When inserting with mysqlfront windows client :

replace into nlconfig values (last_insert_id(),'abc', 'nexen', 'a@', 'a',
'', 'localhost', 'root' , '', 'newsfr', 'news', 'temp', 'log', 'nlconfig',
'lucas', '', '', 'http://www.test.fr/fr/', 'lang-french.php', '','','','',
'1','','' );

1st on row affected
2nd 2rows.

I get no error.
But from a php 4.06 script I get :
errno 1062: erromsg : Duplicata du champ '127' pour la clef 1
That means : duplicate value for key 1.

I didnt have the same result from a php script ?

That the same error i get with NULL in the id with the windows client ?!

Could you explain me what happen ?

I only want to insert a new row when values are different from what is on
the table,
and to replace the row that there is when there is the same id or when all
the data in query is the same !
Is it for that, that replace is for ?


Thanks.





-- 
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




Re: [PHP] Exit script early

2002-07-16 Thread Martin Clifford

RTFM re: Exit and Continue.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Michael Zornek [EMAIL PROTECTED] 07/16/02 01:08PM 
Ok, 

So I'm creating a details.php page where I'm expecting the url to be
something like:

/details.php?id=12345

Thus in my php I have the following:

if (!isset($id))
{ // if no id exsits

// Create a page saying ID not found, goto index
writeHTMLTag();
writeHeader(Error, never);
writeBodyTag();
writeLogoNav();

echo h1Error: A hospital ID was not found./h1
  pGoto: a href=\index.php\Nursing Career Match/a
  ;

writeFooter();
writeHTMLTagCloser();

// what command can I use to end the script right here?
}
else
{ // Run MySQL stuff and display page

} 

My question is what command can I use to end the script [inside the top
part of that if statement]?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org 

Personal Site: 
http://www.mikezornek.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




Re: [PHP] I can't echo object variables

2002-07-16 Thread Martin Clifford

Try enclosing it in curly braces.

echo p${db-field('name_long')};


Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Michael Zornek [EMAIL PROTECTED] 07/16/02 01:45PM 
We all know this works:

echo p$someVar;

However this does not:

echo p$db-field('name_long');

I know this slight variation will make it work:

echo p . $db-field('name_long');

But it's cumbersome .. Anyway to get the first way to work?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org 

Personal Site: 
http://www.mikezornek.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




Re: [PHP] Is there a way?

2002-07-16 Thread Martin Clifford

It's called here doc formatting, and follows the pattern below:

$chunk =  EOF;
// stuff here
EOF;

Hmm.  For some reason that just doesn't look right.  I'm sure someone will correct it 
if I'm wrong though :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Chris Crane [EMAIL PROTECTED] 07/16/02 02:03PM 
In Perl you could print a block of information as it was written like this;
print HTML_END;

This a whole bunch of HTML code!!!

HTML_END

The best part about this, was that you did not have to escape your  and you
could mix in your variables making it easy to design and layout the HTML. Is
there a similiar way to do this in PHP?



-- 
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




Re: [PHP] Session and output buffering

2002-07-16 Thread Martin Clifford

You have to give the variable value before registering it, from my experience.

$var = 123 Sesame Street;
session_register($var);

Also, I don't believe you need to use session_unset(), since you are already 
destroying the session information.  If you are getting errors, it would be helpful if 
you include those in your message so that we might be able to deduce the error from 
it's cryptic nature :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Divyank Turakhia [EMAIL PROTECTED] 07/16/02 02:46PM 
I have set output_buffering = On in my php.ini file, since I need this
for my application.

When the user logins I want to destroy any current session and start a
new session. I have included the below in my code for the same. But for
some reason all my old data is available in the session. 

session_start();
session_unset();
session_destroy();

session_start();
session_register(somevariable);

Can anyone figure out where I may be going wrong.

Warm Regards,
Divyank Turakhia
--
http://www.directi.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




Re: [PHP] Newbie Question on Efficiency

2002-07-16 Thread Martin Clifford

Unless the file is getting retartedly big (10-20K), then I wouldn't separate them.  
Though if you have enough functions, you could justify making separate files for your 
database functions, output functions, backend functions, etc.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 [EMAIL PROTECTED] 07/16/02 04:59PM 
Hello everyone, I'm a newbie and have a question on style that I've not
seen addressed anywhere.  I have a large number of frequently used
functions that I'm trying to find a good way to organize.  The method
I'm thinking of using is to simply create a .php file called, for
example, functions.php.  Then, just include the file at the top of each
page that needs any of the functions, and just call them as needed.  My
question is this- if that file gets very large with tons of different
functions, is that an inefficient method?  I'm not entirely clear on how
PHP is parsed and passed to the client.  I assume it would be best to
divide up the functions into multiple files (ex. dbfunctions.php, etc.),
but is that still the best method?  Basically, I'm just curious on how
you guys handle things like this.
 
Thanks in advance.
Michael Kennedy


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




[PHP] Re: Good Forum...

2002-07-15 Thread Martin Clifford

Invision Board is the best PHP based BB that I've seen so far.  If you're familiar 
with Ikonboard written in Perl, this is the same thing optimized for PHP.  Not to 
mention that the installation is a BREEZE!  You can get a copy FREE at 
http://www.invisionboard.com, and you can check out a sample of what it can do in the 
forums link below.  Good Luck!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 [EMAIL PROTECTED] 07/15/02 06:26AM 
phpbb is a good forum or phorum 

both are free to use :) 

i hope you can use one of those ;) 


JJ Harrison\ writes: 

 What is a good php-based forum? 
 
 I would have used vBulletin but my group a non-profit so we obviously can't
 afford it. 
 
 Part of what I require is users to be stored in a db table using md5() or
 anouther function. What I would do is expand the table with more user info
 for use with my whole site. 
 
 
 --
 JJ Harrison
 [EMAIL PROTECTED] 
 www.tececo.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 



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




[PHP] Alley-OOP! ... or not?

2002-07-15 Thread Martin Clifford

Hey all,

I've seen quite a few programs that seem to greatly favor Object Orienting Programming 
(OOP) in their code.  I don't mean to start a holy war or anything of the sort, but as 
a burgeoning PHP developer, I would like the opinions of my peers.

So how about it, ladies and gents?  Tell me about the Pros and Cons to OOP, and why 
you prefer to use it/not use it!

Personally, I've always used regular functions to accomplish my repetetive tasks, and 
OOP seems rather daunting for me, but I'm always open to new (and hopefully, more 
efficient) ideas!  Thanks!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/



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




Re: [PHP] newbie: mysql statement

2002-07-15 Thread Martin Clifford

You're right Andrew, got a little ahead of myself :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Andrew Brampton [EMAIL PROTECTED] 07/15/02 03:23PM 
Shouldn't this be

UPDATE header SET parent='$this-parent' WHERE posted = max(posted)

Otherwise the max(posted) = max(posted) is true for all records (therefore
all records get updated)

Andrew

- Original Message -
From: Martin Clifford [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, July 15, 2002 8:11 PM
Subject: Re: [PHP] newbie: mysql statement


I would rewrite the query as:

UPDATE header SET parent='$this-parent' WHERE max(posted) = max(posted)





-- 
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




[PHP] [PHP-DB] RE: PHP meetup [CROSS-POST] Meet other PHP Developersin Your Area

2002-07-15 Thread Martin Clifford

Yes, everyone please join up!  I would love to find more developers in the Maryland 
area, and I'm sure others would in their areas as well!  Let's do the great american 
get togeth... err... the great php get together!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Jay Blanchard [EMAIL PROTECTED] 07/15/02 03:20PM 
[snip]
No, it's not a dating service :)
Want to meet other PHP developers in your area? Check out:

http://php.meetup.com/ 

Pretty nifty idea... especially given the lack of user groups in the U.S.

I thought for others who had not seen this I would post this. There is
probably already a user group in your area if you live near a major city.
According to the PHPusergroups.org web site
[http://www.phpusergroups.org/groups.phtml?menu=groups] there 189 PHP user
groups in 52 countries.
[/snip]

I have seen some users groups mentioned, which is outstanding. PHP Meetup is
gaining lots of ground with 105 members at last check. Top 5 cities are...

Manhattan (below 42nd St) (5 members)
London, England (4 members)
Ann Arbor, MI (3 members)
Melbourne (3 members)
Washington DC (3 members) [actually tied with Philadelphia, PA and Orange
County, CA]

And I finally saw another San Antonio member. Just want to keep this fresh
in everyone's mind. If you know of other developer lists where php is
discussed please forward this along.

Thanks!

Jay

Do not meddle in the affairs of dragons-for you are crunchy and good with
ketchup



-- 
PHP Database 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




Re: [PHP] ^k ? -- how do I match that?

2002-07-15 Thread Martin Clifford

Just try eregi_replace(\^k[.+], , $container);

Regular expressions are the MASTERS of the INTARWEB! :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Jimmy  Brake [EMAIL PROTECTED] 07/15/02 04:32PM 
Hi!

I keep getting that evil little character ... ^k  from mac users (pre X)
and I need to remove it. Does anyone know how to remove?

This site has that character as a vertical tab. This character is what
is used in MS Excel when people hit return inside a cell. If they copy
and paste that into a form its ok, but when I export that data to a csv
it gets ugly.

http://www.robelle.com/smugbook/ascii.html 

Thanks in advance!

Jimmy


-- 
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




Re: [PHP] A question of style ...

2002-07-12 Thread Martin Clifford

I see no problems whatsoever in utilizing an intermediary script to do processing of 
information.  However, there IS a problem when this script sets flags that are 
unwanted by the client.  An example of a good intermediary script application would be 
as below.

Person A and Person B both remotely log into their website's Content Management 
System.  They both navigate to the same file on the server, because their boss told 
them it needs updating.  Person A clicks on the link to edit the file first, thereby 
setting an intermediary script into action which sets a flag, say checked_out to 
true.  Person B across the hall is denied access to this file because Person A already 
has it checked out.  This is much in the tradition of DreamWeaver FTP.

The above is a great example of how intermediary scripts can be used to help avoid 
critical misunderstandings.  You do NOT want two people to edit the same file at the 
same time, otherwise it'll get messed up REALLY fast.

In your example, though, if the agent simply wishes to view the customer's 
information, but has no interest in contacting the person at all (perhaps for research 
purposes), then the flag that says that the agent is, has or will be contacting the 
customer is obtrusive.

Overall, I think the coding style is very good, and you're right that it does in fact 
make code much easier to interpret.  However, there is a big difference between an 
intermediary script being helpful, and it being a hinderance.

Just my $20.00 (big mouth, you know)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Jay Blanchard [EMAIL PROTECTED] 07/12/02 09:40AM 
Howdy group,

   Over the past couple of days I have come under some fire for my style
of coding, most particularly the use of PHP scripts to process information
between pages or interfaces shown to various users. An example;

   An agent goes to an interface that reveals a list of customers from a
database. These customers have provided referrals which now reside in a
database. The agent selects a referral which is processed by an intermediary
script which sets a flag in the database saying that this agent is, has,or
will be contacting this referral (to prevent duplicate contact). Then this
redirects to the referral's interface where the details about this referral
are revealed.

Interface A
   ++
   | Customer   |
   | Submitted  |
   | Referral   |
   ++
 |+--+
 +---| PHP Script   |
  | (for processing) |
  +--+
|
Interface B |
   ++   |
   | Referral   |   |
   | Info   |--+
   ++

While this is a rather simplistic example (I use some intermediary scripts
that are much more complex, some that call other script if the situation
warrents it) I have found that for many applications this makes the code
easier to maintain, gives me a way ID certain processes when something
breaks (I use a lot of error logging), and also prevents some code from
being aborted by the user when the results of doing something like that
might be undesirable.

I know that this might start a holy war, but it is likely that discussion on
this would enhance all of our coding styles. I realize that this may not
help me strengthen my position with regards to the fire I have come under,
but I had to ask. Thoughts?

Thanks!

Jay

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*



-- 
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




Re: [PHP] ' giving problem while inserting in table.

2002-07-12 Thread Martin Clifford

Use addslashes() on ALL strings before inserting them into your database.  Then, on 
your frontend, extract the data and use stripslashes() on all strings.

Hope to help!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Anil Garg [EMAIL PROTECTED] 07/12/02 10:45AM 
Hi,
I am making a faq maintenance system using mysql and php.
To insert a entry in to a faq table i am using the following query:
-
INSERT INTO faq_table_netvd (id,question,
answer,netvcr,netdetector,add_date,mod_date,keyword,category,display,attach_
id)
 VALUES ('0','$frm[question]',
'$frm[answer]','$frm[netvcr]','$frm[netdetector]','$frm[add_date]','$frm[mod
_date]','$frm[keyword]','$frm[category]','$frm[display]','$frm[attach_id]')
 );
---
now the problem is when $frm[question] has some string like: why i can't
eat.
i get the following error:
MySQL Error: You have an error in your SQL syntax near 't eat?' ,answer =
'Please recheck the power of your specs:)' ' at line 3.Putting a '\' before
' (e.g. \')solves my problem...but when i open the same quesion to edit it,
again i have to put backslashes where ever i find  '   in the quesion or
answer.

Can anyone please suggest a solution to this.

thanx and regards

anil

[please ask if i havent explained the problem fully]



-- 
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




Re: [PHP] Final Year Computer Science Project involving PHP

2002-07-12 Thread Martin Clifford

If completely developing a fully functional and optimized E-commerce site isn't good 
enough, I don't know what is.  I can understand how it may not necessarily be 
innovative (though it could have innovative features), but designing such a site would 
prove to anyone I know that you have a great knowledge of the language the site was 
created in.

As for original ideas, good luck.  You'll come to find that anything you can think to 
do has already been done.  You're best bet may be to look around some sites on the 
'Net and try to vastly improve what has already been done.

Projects that find solutions?  That could be anything from a Weight Loss Tracking 
System to an advanced encryption/decryption algorithm.

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Serdar Sokmen [EMAIL PROTECTED] 07/12/02 11:14AM 
Hi,

Please read the rest of this email if you're interested in helping final
year

Computer Science student (yes, that's me...) by giving him some ideas on his
final

year project very possible involving PHP and SQL...

I will start next autumn my third year of Computer Science studies. I have
to carry

out a large programming project in this final year. These projects are
supervised

and assessed via a dissertation and an oral presentation. The project alone
counts

for 20% of my whole degree, so it is quite important.

A variety of project proposals have been made available for our
consideration

already but they all look very dull and boring. We are also encouraged to
come up

with our own project ideas.

The onus is on us to define the problem boundaries, to investigate possible

solutions, and to present the results verbally, in writing and (possibly) to

demonstrate in action. They like having projects that find solutions (or
improve a

current sloution) real life problems.

This summer, I am doing an internship in a Swiss IT company, working on a
Content

Management System implemented with PHP and MySQL. This will obviously give
me some

valuable experience with these languages (I sort of already learn them quite

well...) and most of our tuition in Uni is based on Java.

If you can think of an interestin final year project involving hese
languages, it

would be very kind to share it with me... In order to obtain a very high
mark, the

project needs to be challenging. For example, having an e-commerce web-site
using a

Database is seen as a weak, non-innovative project...


Many Thanks for your time

Serdar Sokmen
[EMAIL PROTECTED] 






-- 
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




RE: [PHP] PHP meetup

2002-07-12 Thread Martin Clifford

I just signed up for this, as I would LOVE to be able to talk and interact (in person) 
with some PHP Developers.  As I'm still learning (as we all are), it would be a great 
opportunity for me to be able to meet up and discuss this wonderful language with my 
peers.  Hopefully that'll come to pass! :o)

I emplore all PHP Developers to sign up for MEETUP.  You have nothing to loose, and 
everything to gain!

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


 Jay Blanchard [EMAIL PROTECTED] 07/12/02 11:48AM 
[snip]
Want to meet other PHP developers in your area? Check out:

http://php.meetup.com/ 

Pretty nifty idea... especially given the lack of user groups in the U.S.
[/snip]

I thought for others who had not seen this I would post this. There is
probably already a user group in your area if you live near a major city.
According to the PHPusergroups.org web site
[http://www.phpusergroups.org/groups.phtml?menu=groups] there 189 PHP user
groups in 52 countries.

While there is nothing in my area (closest is Houston, over 3 hours away
:^[ , and I thought there would be one in Austin, even if I don't want to
drive an hour to go drink an adult beverage or two.) but you may find one
already exists in your area. Meetup is a cool idea, and appears to be
gaining ground slowly. Jon, did you cross-post to all PHP lists?

Jay

Code! Yes. A programmer's strength flows from code maintainability. But
beware of Perl. Terse syntax... more than one way to do it...default
variables. The dark side of code maintainability are they. Easily they flow,
quick to join you when code you write.  If once you start down the dark
path, forever will it dominate your destiny, consume you it will. -- Yoda
(or maybe Coda)



-- 
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




RE: [PHP] Development Tools

2002-07-11 Thread Martin Clifford

I usually always have my content dynamically generated by functions, or displayed in 
include files.  I'm not a  fan of cluttering up my apps with content.

Martin Clifford
http://www.completesource.net (Now Open!)

 Lazor, Ed [EMAIL PROTECTED] 07/10/02 05:38PM 
I am too.  I've developed an approach to coding with Dreamweaver that allows
me to take advantage of WYSIWYG and my own style of coding at the same time.
The MX version of Dreamweaver is supposed to add support for code snipets,
and a few other things.  I'm looking forward to checking them out.

Oh, and Dreamweaver has provided the most efficient WYSIWYG created code
that I've seen so far.

So... what do you do when it comes to creating actual content that's
separate from the coding?

My personal approach has been doing the coding necessary to create templates
and then opening templates in Dreamweaver and filling in the blanks.

-Ed

-Original Message-
WYSIWYG does nothing more for me than screw up my code.  I'm very anal about
how my code looks, firstly.  Secondly, most WYSIWYG editors add superfluous
markup into code which not only inflates the file size of your documents,
but also slows down processing of them.

I'm not saying that WYSIWYG isn't right for you, because obviously it is.
I'm just saying that, to me, it might as well be fingernails running down a
chalkboard for all the good it *doesn't* do me, personally.
 

This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message.  If you have received this message in error, please immediately
advise the sender by reply email and delete the message.  Thank you very
much.   

-- 
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




Re: [PHP] Newbie Logical opertaor question

2002-07-11 Thread Martin Clifford

You'd have to separate it like so:

if($var1 == 1 AND ($var2 == a OR $var2 == b OR $var2 == c) {
// do stuff here if true
} else {
// do stuf here if false
}

HTH

Martin Clifford
http://www.completesource.net (Now Open!)

 Rw [EMAIL PROTECTED] 07/11/02 09:11AM 
I have been trying this to no avail.

Tryng to say the equivalent of:

IF  (var1 = 1 AND var2 = a or b or c)

i.e. yield true if 1 and a
OR
1 and b
OR 1 and c

:-)

Thanks!


-- 
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




Re: [PHP] Newbie Logical opertaor question

2002-07-11 Thread Martin Clifford

Fixing the below, since it would produce a parse error (I forgot a parenthesis, hehe)

Martin Clifford
http://www.completesource.net (Now Open!)

 Martin Clifford [EMAIL PROTECTED] 07/11/02 09:29AM 
You'd have to separate it like so:

if($var1 == 1 AND ($var2 == a OR $var2 == b OR $var2 == c)) {
// do stuff here if true
} else {
// do stuf here if false
}

HTH

Martin Clifford
http://www.completesource.net (Now Open!)

 Rw [EMAIL PROTECTED] 07/11/02 09:11AM 
I have been trying this to no avail.

Tryng to say the equivalent of:

IF  (var1 = 1 AND var2 = a or b or c)

i.e. yield true if 1 and a
OR
1 and b
OR 1 and c

:-)

Thanks!


-- 
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 



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




[PHP] Re: Customise Index page using PHP????

2002-07-11 Thread Martin Clifford

The easiest way to accomplish that is by using switches.  Here is an example:

switch($pageid) {
default:
include(default_page.inc);
break;
case 18:
include(page_18.inc);
break;
}

With that in your index.php page, it will look for the variable $pageid, and depending 
on what it is set to, display the appropriate information.  In this instance, it will 
display the default index page by default (if $pageid is empty), or page_18.inc if 
$pageid = 18.

Hope that helps :o)

 Craig [EMAIL PROTECTED] 07/11/02 10:42AM 
I want to acheive something like this

http://www.claviga.com/index.php?pageid=18 



-- 
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




Re: [PHP] Re: session error ... I think

2002-07-11 Thread Martin Clifford

When you request a page, for instance, php.net, your web browser sends HTTP headers to 
the server that holds php.net on it.  When the server receives these HTTP headers, it 
knows which page is needed, and sets up it's own headers to send back to the browser, 
such as location, file types, etc.  It then sends back the requested page with all the 
appropriate header information to the browser, which displays the page.

Where your question comes into play is somewhere in the middle.  You can set the HTTP 
headers only AFTER the request to the server has been made, but has to be BEFORE the 
page arrives at the client browser for display.  So, when we all say that there can be 
NOTHING output to the HTML file before the headers are sent, we mean it literally.

For example:  Open up Notepad.  Hit return once, then type this in:

?php header(Location: index.php); ?

Upload it and run it.  You'll get an error.  Why?  Because you sent a hard return to 
the HTML output BEFORE the header was sent.  Hopefully this is not all jumbled an 
unhelpful.  Heh :o)

Good Luck!

Martin

 Chris Hewitt [EMAIL PROTECTED] 07/11/02 01:40PM 
Alexander Ross wrote:

I'm slowly beginning to undrestand this, but please bear with a php novice.
When/how were the headers sent?  In other words, how do I know that they
have already been sent?

Because something other than a header has gone out. As something other 
has gone out, it is not possible to send more headers. Thus headers that 
were to be sent must have already been sent. I interpret this error 
message as Something other than headers has already been sent so you 
cannot send headers now., (but then I have been known to be wrong).

HTH
Chris


-- 
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




Re: [PHP] Newbie continued..wrong datatype

2002-07-11 Thread Martin Clifford

As far as I'm aware, the first argument to the in_array() function is the needle (what 
you're searching for) and the second is the array to be searched through (the 
haystack).

So if $type represents what you're searching for, then it would be written as:

in_array($type, $CheckArr);

If you supply the third argument as TRUE, then the search becomes case sensitive, I 
believe.

HTH!

 Rw [EMAIL PROTECTED] 07/11/02 02:25PM 
This is a continue from this morning (thanks so much for the responses)..
yielding a data type mismatch:

  $CheckArr = array(Periodic, Sale, Return);
  IF (SUBSTR($approvalcode,0,1) == Y  in_array($CheckArr, $type))
   {
   PRINT BR$approvalcode;
   PRINT  ;
   PRINT $type;
   }

This line:   IF (SUBSTR($approvalcode,0,1) == Y  in_array($CheckArr,
$type))

Causes this error:
Warning: Wrong datatype for second argument in call to in_array in
/home/www/globalspacesolutions/php3/billingtrx.php on line 47


-- 
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




RE: [PHP] MAIL() Trouble. Need your eyes.

2002-07-11 Thread Martin Clifford

I would think that there would only be a limit on the SMTP server that the mail 
function sends the mail through.  I'm no expert on the subject though, just makes 
sense. :o)

Martin Clifford
http://www.completesource.net (Now Open!)

 Shane [EMAIL PROTECTED] 07/11/02 02:42PM 
Nope, no luck. Still errors out.
Is there a limit to how man characters a MAIL() call can have?

-Original Message-
From: Paul Roberts [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 11, 2002 11:31 AM
To: Shane
Subject: Re: [PHP] MAIL() Trouble. Need your eyes.


try escaping the # in there.


Paul Roberts
[EMAIL PROTECTED] 



- Original Message - 
From: Shane [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 11, 2002 7:21 PM
Subject: [PHP] MAIL() Trouble. Need your eyes.


Greetings, I am attempting to send an HTML based email using the Mail() function in 
PHP.

I am having great luck until I include an OBJECT or EMBED tag in the HTML string.

I am running PHP 4.2.1 on a WIN NT client.

If I uncomment the OBJECT or EMBED lines below in the $message variable, my script 
errors out on the MAIL() call at the bottom.

Please, any help would be appreciated.
Thanks folks!

- NorthBayShane
-
?PHP
$myname = Me Myself;
$myemail = [EMAIL PROTECTED];
$myreplyemail = [EMAIL PROTECTED];
$contactname = Mister Contact;
$contactemail = [EMAIL PROTECTED];

---
MY VERY LONG $MESSAGE STRING
---

$message = htmlheadtitle/title;
$message.= meta http-equiv='Content-Type' content='text/html; 
charset=iso-8859-1'/head;
$message.= body bgcolor='#54616E' text='#FF' link='#FF6600' vlink='#99' 
alink='#FF9900';
$message.= centertable width='501' border='0' cellspacing='0' 
cellpadding='0'trtd width='500' 
background='http://www.delaplaine.net/flashmail/noflash.gif';

--
HERE IS WHERE THE TROUBLE STARTS
IF I UNCOMMENT THE OBJECT OR EMBED TAG
THE SERVER ERRORS OUT ON MY MAIL() CALL
--

//$message.= pobject classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354' 
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'
 width='500' height='300'param name=movie 
value='http://www.delaplaine.net/flashmail/delaplaine.swf'param name=quality 
value=highparam name=menu value=falseparam name='BGCOLOR' value='#54616E';
//$message.= embed src='http://www.delaplaine.net/flashmail/delaplaine.swf' 
quality=high 
pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
 type='application/x-shockwave-flash' width='500' height='300' 
bgcolor='#54616E'/embed;
//$message.= /object/p;

--
HERE IS WHERE THE TROUBLE ENDS
--
$message.= /td;
$message.= td bgcolor='#54616E'img 
src='http://www.delaplaine.net/flashmail/spacer.gif' width='1' 
height='300'/td/tr;
$message.= trtd align='center'pbr/ppfont face='Verdana, Arial, 
Helvetica, sans-serif' size='1'a 
href='http://www.delaplaine.net/extranet/fm.php?sec=newid=noflash'Click here/a if 
you cannot see the animation above./font/ppfont face='Verdana, Arial, 
Helvetica, sans-serif' size='1' color='#99'copy; Copyright 2002, Delaplaine 
Creative.br All rights reserved./font/p/tdtd align='center'nbsp;/td/tr;
$message.= /tablepnbsp;/p/center;
$message.= /body/html;

$subject = FlashMail Test;
$headers = MIME-Version: 1.0\r\n;
$headers.= Content-type: text/html; charset=iso-8859-1\r\n;
$headers.= From: .$myname..$myemail.\r\n;
$headers.= To: .$contactname..$contactemail.\r\n;
$headers.= Reply-To: .$myname.$myreplyemail\r\n;
$headers.= X-Priority: 1\r\n;
$headers.= X-MSMail-Priority: High\r\n;
$headers.= X-Mailer: Just My Server;

mail($contactemail, $subject, $message, $headers);

?

-- 
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 


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




Re: [PHP] Now a Question for all you ARRAY Junkies

2002-07-10 Thread Martin Clifford

Since it's not an associative array, you can just use sort($Lang); and that should 
work just fine.

Martin

 vins [EMAIL PROTECTED] 07/10/02 08:36AM 
I have an array
$Lang = array('English','German','French','Zulu');
I want it in alphabetical order

do i reset the arrray first or usort it first 



-- 
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




Re: [PHP] Display criteria

2002-07-10 Thread Martin Clifford

You're gonna have to give me quite a bit more to go on than that.  What are you using 
to store the data?  An array, flatfile, database, etc?

Also, we're not really all about telling you what code you need, as much as helping 
you to find the answer (without GIVING the answer), you know?  At least that is how I 
work :o)

Martin

 DC [EMAIL PROTECTED] 07/10/02 08:42AM 
Hi

I want to display data based on the criteria selected by the user eg click
on size to display smallest to largest, or by price smallest to highest,
location etc etc

what is the code I need?

Thanks.

DC



-- 
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




Re: [PHP] cookies

2002-07-10 Thread Martin Clifford

Set the cookies expiration to a date that has already passed.  The cookie will only 
last until the browser is closed, since the browser must have just created it.  Then 
it's deleted from the computer since it's past due.

Martin

 Alexander Ross [EMAIL PROTECTED] 07/10/02 09:43AM 
How can I set a cookie which expires when the borwser is closed??  How can I
delete a cookie via PHP?

Thanks



-- 
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




Re: [PHP] if syntax

2002-07-10 Thread Martin Clifford

There are no brackets necessary if you only have one line of code to be executed in 
the case.  For example:

if($var == 1)
echo Var equals 1;
} else {
echo Var does not equal 1;
}

But this is not valid:

if($var == 1)
echo Var equals ;
echo 1;
} else {

}

HTH

Martin

 Alexander Ross [EMAIL PROTECTED] 07/10/02 10:25AM 
I know this is correct:

if ($something)
{
...
}
else
{
...
}

But I recently saw someone use this instead:

if($something):
 ...
else:
...

Is that also correct??   No brackets needed?



-- 
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




Re: [PHP] sessions

2002-07-10 Thread Martin Clifford

Hi Alexander :o)

You have to have session_start() at the top of EACH page that will hold session 
registered variables.  So just rewrite it like this:

Page 1:

?
session_start();
$test_var = froggy;
session_register('test_var');
?
a href=page2.phpClick here/a


Page 2:

?
session_start();
print $test_var.!;
?

Hope this helps!

Martin

 Alexander Ross [EMAIL PROTECTED] 07/10/02 11:23AM 
I'm trying to understand sessions so I can set session variables. I set up 2
very simple pages:

Page 1:

?
session_start();
$test_var = froggy;
session_register('test_var');
?
a href=page2.phpClick here/a


Page 2:

?
print $test_var.!;
?


This doesn't seem to work though.  $test_var doesn't seem to have a value
when I go the second page.  What am I missing.  Thanks for helping a newbie.

Alex



-- 
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




Re: [PHP] Development Tools

2002-07-10 Thread Martin Clifford

I use the almighty Notepad for my coding.  When I'm at home, however, I typically use 
Macromedia Homesite 5 (simply because it has PHP syntax highlighting).  I tried using 
PHPEdit, but I thought it was horrible.  It was buggy, and annoying.

PHP Master Editor is VERY good, and you can probably find it on downloads.com.  I've 
never tried Zend, but it does look very interesting.  And since they created the 
engine for PHP, you would think they're editor would be god, but that, unfortunately, 
doesn't seem to be the case very often.

HTH

Martin

 Mark McCulligh [EMAIL PROTECTED] 07/10/02 11:42AM 
I am looking for a good Development tool to write my PHP in and was
wondering what people are using out there.

I have been looking at Dreamweaver MX, Zend Studio 2.5 and phpEdit.
I know UltraDev 4 well with ASP, but the new MX now supports PHP.  This
MX/PHP any good?  Zend looks good with the integrated documentation and
debugging tools.

Thanks, Mark.
_
Mark McCulligh, Application Developer / Analyst
Sykes Canada Corporation www.SykesCanada.com 
(888)225-6824 ex. 3262
[EMAIL PROTECTED] 



-- 
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




Re: [PHP] Development Tools

2002-07-10 Thread Martin Clifford

Exactly.  Homesite is, in essence, Dreamweaver MX without the WYSIWYG.  Syntax 
highlighting and code completion make it a very viable editor.  I can't stand that 
WYSIWYG crap.  I'm plenty good at messing up my own code without assistance, thank you 
very much! :o)

Martin

 Bret L Conard [EMAIL PROTECTED] 07/10/02 12:24PM 

Hence the happy medium of Homesite. acts as a basic text editor but
allows some support for coding when needed/wanted. IMHP


Bret
- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: 'Uwe Birkenhain' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Wednesday, July 10, 2002 12:21 PM
Subject: RE: [PHP] Development Tools


 [snip]
 What makes development tools better than a good editor? (serious question)
 [/snip]

 Over the course of time (I have been writing code for 25 years, many
 languages, some compiled, some not) I have found that the most useful tool
 in the arsenal is a good editor with no more features than line numbering.
 When I find myself in times of code trouble (props to John Lennon) I will
 almost always turn to an editor first. I have used many, and for my money
 where web application development is concerned, Programmers File Editor
(no
 longer supported) http://www.lancs.ac.uk/people/cpaap/pfe/ for Windows,
and
 vi or pico on *nix are the editors of choice. I do use PHPedit from time
to
 time because, while it is buggy, it does do syntax highlighting and
matches
 brackets and other curly thingies well, which is especially helpful when
 viewing large scripts with lots of code.

 I have and continue to use some IDE's for certain projects (Visual C++,
 UltraDev for ASP code) but often find myself using an editor on the code
 created by these.

 So to answer the question above ... nothing beats a good editor.

 Jay



 --
 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 



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




Re: [PHP] Accessing multiple List/Menu values

2002-07-10 Thread Martin Clifford

Have you tried like this?

select name=list[] size=5 multiple
option value=yahooYahoo!/option
...
option value=phpnetPHP.net/option
/select

Then access the array on the processing page.

Martin

 Joseph Szobody [EMAIL PROTECTED] 07/10/02 02:02PM 
This is sorta OT, but involves PHP.

I have a fairly large List/Menu on a form, which allows for multiple selections. I 
want users to be able to use cntrl/shift-click to select a bunch of items. Let's say 
this List is called 'list'. Now when I submit the form, how does the processing script 
access all these different values in 'list'? If I try to echo '$list' it only show 
*one* of the selected items from the list. I've tried treating it as an array 
($list[0], $list[1], etc), but that doesn't work either.

How do I get at the different values? 

Thanks,

-- 
: Joseph Szobody :
Computers are like airconditioners: They stop working properly if you open windows.


--
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




Re: [PHP] Automatic Form creation

2002-07-10 Thread Martin Clifford

That all depends on what the form is for, what it has to do, how many fields it needs, 
etc.  You'd be better off writing a function to create your forms, if you ask me.

Just my $20.00 (big mouth)

Martin

 CM [EMAIL PROTECTED] 07/10/02 01:14PM 
Are there any php scripts or classes that do Automatic Form Creation?  If it
worked from a MySQL datbase that would be a plus.





-- 
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




Re: [PHP] SQL field problem

2002-07-10 Thread Martin Clifford

SELECT DISTINCT kat FROM tablename; should work.

Martin

 [EMAIL PROTECTED] 07/10/02 01:40PM 
Hello

I have a problem with mysql.I create a table with a field kat.In this field are 
entries like this : 

Light
Dark
Dark
Light
Robot
Find
Dark
Light

You see that all entries are not unique.So i want to list as output all entries but 
only once.If the word Dark is in the table 6 times php should output dark only 1 
time. 
How should i solve this problem ?

Thanks!
chris


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




[PHP] Re: Forms not passing variables

2002-07-10 Thread Martin Clifford

Did you restart your server after changing register_globals?  Try that.

 Derick Rethans [EMAIL PROTECTED] 07/10/02 02:30PM 
Hai,

did you check the setting of register_globals really changed? See the 
phpinfo(); output if it's really set to on. If not, place your php.ini 
file in the correct location.

Derick

Hopp3r wrote:
 Hello all.
 
   I have a site that was backed up, before the box was reformatted and
 rebuilt. Apache and PHP were upgraded.  I have since resored all of the
 files and DB's that make up my site. Now, in doing some testing, the html
 forms are not passing variables to the next page. Specifically, these
 variables are the databse name, and the infor to be insereted into that
 database. My site uses frames, and it trying to pass the information from a
 form on one static page (menu) to the main window to display results. This
 used to work before I got the bright idea to upgrade.
 
  I have tried setting register_globals=on to see if that might help, but
 it had no effect. Has anyone else had, or is currently having issues like
 these? If you think you have any answer, please let me know. I will just
 about try anything to make this work again.
 
 Thanks,
 RC
 
 



-- 
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




[PHP] Re: Development Tools

2002-07-10 Thread Martin Clifford

Homesite (at least version 5.0) has support for more languages than DW4.  Though I 
believe in DW4 you can customize the syntax highlighting to match any languages that 
*aren't* supported.  I love Homesite 5.  Not to mention that it runs a lot faster than 
DW because it doesn't have to load as many libraries.

Martin

 [EMAIL PROTECTED] 07/10/02 03:39PM 
For those of you using HomeSite, is it worthwhile for me to install it if I
already have DreamWeaver 4 on my PC?  Someone said HomeSite is basically
DreamWeaver without the UI interface so I'm wondering if it's possible to use
DreamWeaver the same way I would Homesite.

Jesse

-- 
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




Re: [PHP] Dumb session / cookie / password questions

2002-07-10 Thread Martin Clifford

Firstly, you should ALWAYS use an encryption algorithm for passwords.  For my site, I 
used md5() and match with that.  That way, even if someone does get a hold of the 
encrypted password, it's not in their best interest (or maybe it is, if they're bored) 
to crack it.

I haven't testing the following out, but it might work if someone wants to be a 
smartass and type out 
index.php?user=admingodpass=adminpass[EMAIL PROTECTED] in which they know 
the info.

?php
if(!empty($_GET)) {
header(Location: $PHP_SELF);
}
?

Putting that at the top of the page would check to see if any information was sent to 
the page from the $_GET superglobal, and if it was, reload the page without any URL 
extensions.  It sounds good in theory, though I haven't tested it, so it might not 
work as I think it should (it NEVER does!).

My $20.00 (big mouth)



Martin Clifford
http://www.completesource.net (Now Open!)

 Chad Day [EMAIL PROTECTED] 07/10/02 04:09PM 
I am a little confused about storing stuff in cookies/sessions and how to
prevent spoofing of them.

A user logs in, his e-mail address or user id and password(md5'ed) is
checked against my database.

Assuming it matches, I then set a cookie with the users id + email.

What is to stop someone from spoofing that cookie?  I obviously don't want
to put the password in a cookie .. can someone point me in the direction of
an article about this?  I've searched around, but I'm not finding stuff
about in a preventing spoofing / security aspect.

Thanks,
Chad


-- 
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




Re: [PHP] newbie: question about question marks

2002-07-09 Thread Martin Clifford

In that case, the question marks are part of the PHP opening and closing tags.

There are several ways to open and close sections of PHP script, mainly being ?php 
?, ? ?, and % %.  What the below equals is ?php echo $parent; ?, since ?= is 
the equivalent of saying echo or print the following.

Hope that wasn't too jumbled.  :o)

Martin Clifford
http://www.completesource.net (Now Open!)

 Alexander Ross [EMAIL PROTECTED] 07/09/02 09:54AM 
How bout the question marks in the following line of php generated html:

input type = hidden name = parent value = ?=$parent;?

what do they mean?


Miguel Cruz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Sun, 7 Jul 2002, Alexander Ross wrote:
  Can someone explain to me what the ? does.  I have a vague idea of what
  it means in a URL (please cearify that) but I haven't the slightest what
  it means in php code.  Thanks for your help

 Read about the ternary operator at:

   http://www.php.net/manual/en/language.operators.comparison.php 

 miguel




-- 
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




Re: [PHP] Build-up of MySQL Sessions

2002-07-09 Thread Martin Clifford

My advice is to use mysql_connect().  The only instance I would consider using 
mysql_pconnect() would be if I had to access multiple databases and servers at the 
same time.

Martin

 SpamSucks86 [EMAIL PROTECTED] 07/09/02 10:26AM 
I'm running windows 2000 and the latest releases of PHP and MySQL. All
database connections are made with mysql_pconnect(). Connections build
up, however. The only person connecting to this webserver at the moment
is myself. It seems that it opens connections and keeps them open, but
doesn't always reuse them, thus causing it to open new ones. Is this a
bug in mysql_pconnect()? Should I just use mysql_connect()? Any and all
help is appreciated.

 



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




Re: [PHP] can I call a variable... using variables?

2002-07-09 Thread Martin Clifford

You would have to set up a dummy variable to hold the value of two concatenated 
variable names.  I'd love to write an example, but work is draggin' me down, sorry!

Martin

 Joseph Szobody [EMAIL PROTECTED] 07/09/02 02:12PM 
So here's what I'm trying to do:

I have a form submitting dozens of variables called var1, var2, var3, .. and on 
and on.

I want to check the value of each of these variables:

for($i = 1;$i  100; $i++) {
  if($var$i  0) 
echo Yup. $var$i is greater than 0;
}

I get a parse error when trying to run this code. Can I not use $i to call the $var1, 
$var2, etc. variables? Is there another way of doing this?

Thanks,

Joseph




--
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




Re: [PHP] ??????????????????????????????????????????????????????````````````````````ØØØØØØØØØØØØØØØØØØÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ

2002-07-09 Thread Martin Clifford

Dear Lord, where is the admin to boot this guy?

Martin

 Erik Hegreberg [EMAIL PROTECTED] 07/09/02 03:25PM 



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




Re: [PHP] HTTPS vs. HTTP ?

2002-07-08 Thread Martin Clifford

How do you know their certificate hasn't been stolen, and they haven't even
figured it out yet?  How do you know they were trustworthy people in the
first place?

Why do you ASSUME that they're NOT trustworthy people?  Do you go through your entire 
life in that shell?

The more I think about this, the more I agree with people who just won't do
eCommerce at all...

Just the opposite for me.  Time to go web-shoppin!

Martin

-- 
Like Music?  http://l-i-e.com/artists.htm 


-- 
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




Re: [PHP] phpBB Info

2002-07-08 Thread Martin Clifford

I'm sure there is a phpBB specific userbase out there that could answer this question 
for you.  My guess would be... I don't know, something like http://www.phpbb.com. 

Martin

 BrettM [EMAIL PROTECTED] 07/06/02 12:35PM 
I wanna be able to do some stuff, which involves getting data from my phpBB
board.

Member Count: (this section should autoupdate)
Number Of Forums: (this section should autoupdate)
Highest Post Count: (this section shouldauto  update((member) with (post
count) posts))
Most Replied to topic: (this section should auto update((topic) with (number
of replys) replys))

Can someone give me the code to do this

the page with this on is in my base directory. My forums are in /forums



-- 
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




Re: [PHP] hide a select tag

2002-07-08 Thread Martin Clifford

Just create a hidden form field with the value you want to pass.

input type=hidden name=name value=value to pass /

HTH

Martin

 Anil Garg [EMAIL PROTECTED] 07/08/02 01:35PM 
Hi,

sorry for going a lil out of way of php.
can i hide a drop down menu.(as i always want to pass the default value
selected in the drop down.

thanx and regards
anil


-- 
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




Re: [PHP] Checking for a successful login and setting a globalflag.

2002-07-08 Thread Martin Clifford

No need to open a new window to reset the cookies.  Just have a function that is 
trigged onunload().

Martin

 Pete James [EMAIL PROTECTED] 07/08/02 03:18PM 
You could also try using Javascript to popup a window when they close
the current one, and reset your cookies (and/or destroy your session) in
that window.

Pete.


Kevin Stone wrote:
 
 Okay sorry for the misunderstanding.  You can set the lifetime of the cookie
 to die when the browser window is closed.  Or if you use sessions this will
 happen automatically.
 http://www.php.net/manual/en/function.setcookie.php 
 -Kevin
 
 - Original Message -
 From: Youngie [EMAIL PROTECTED]
 To: Kevin Stone [EMAIL PROTECTED]
 Sent: Monday, July 08, 2002 12:21 PM
 Subject: Re: [PHP] Checking for a successful login and setting a global
 flag.
 
  Hi Kevin,
 
  Firstly, thanks for your answer. I am infact only protecting my php pages.
 I
  don't really care that the user
  can bring up a form on an HTML page like query.htm, sure he can submit the
  query to query.php but it's
  there I do the check to see if the cookie has been set. Problem is someone
  could log on properly
  and the cookie would be set. They could then close the browser, someone
 else
  could come along
  and the cookie would still be set. How do I clear all cookies when the
  browser is closed?
 
  Thanks
 
  John.
 
  - Original Message -
  From: Kevin Stone [EMAIL PROTECTED]
  Newsgroups: php.general
  To: PHP-general [EMAIL PROTECTED]
  Sent: Monday, July 08, 2002 11:07 AM
  Subject: Fw: [PHP] Checking for a successful login and setting a global
  flag.
 
 
   Simply put you can not protect HTML pages through your login system.
 You
   must have some kind of continuous login/check at the top of each page.
  Give
   the page the .php extension so it can parse and execute the check.  If
   you're using Cookies that's perfect.. you can just check for the
 existance
   of that cookie at the top of each page.  Same thing if you were using
   sessions.  They can only get the cookie or the session from one
 script...
   your login script.  So as long as you continuously check for that you're
   pretty much all set.
   -Kevin
  
- Original Message -
From: Youngie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 08, 2002 11:54 AM
Subject: [PHP] Checking for a successful login and setting a global
  flag.
   
   
 Hi Follks

 I'm writing an application that requires the user to login to gain
   access
to
 the rest of the site.
 The login dailog is on index.html, once verified by login.php the
 user
   is
 presented with a menu from
 which he can select several options option1.htm which executes a
 query
 through option1.php etc,
 option2.htm and option3.htm  and so on. But there's nothing stopping
  him
 from bypassing the login completely
 and just brining up option2.htm directly in the browser. I'm looking
  for
 some kind of mechanism to set a
 flag for a successful logon in index.php that can be tested in the
  other
php
 scripts.

 I tried using a cookie and got that to work but the user can close
 the
 browser, reopen and the cookie is still
 set. I looked in to session variables but one page could seem to see
  the
 session variable values set in the
 login page, it saw the variable was registered but not the value it
  was
set
 to.

 I know this has to be a simple exercise but I'm a newbie.

 Thanks

 John.




 --
 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




Re: [PHP] UNSETing Session Variables

2002-07-08 Thread Martin Clifford

You only have to register the session variables once.  If you need to register the 
same variables again (such as for a different user), then you should use 
session_destroy() before registering the variables again.

The variables should be available throughout your pages as long as session_start() is 
done before ANY output goes to the HTML.  It's usually best to have it as the FIRST 
thing on your pages.

Martin

 [EMAIL PROTECTED] 07/08/02 04:19PM 
/me feels kinda dumb now.

Well even after adding session_start to my connect.inc, it doesn't work. I 
only need to do session_register() once correct?  Or do I need to do that 
everytime I do session start?  If I have to do it everytime then what is 
the point of sessions?

Jed






Kevin Stone [EMAIL PROTECTED]
07/08/2002 02:12 PM

 
To: [EMAIL PROTECTED], [EMAIL PROTECTED] 
cc: 
Subject:Re: [PHP] UNSETing Session Variables


I fear you're missing something fundemental here.  The active session 
needs to be requested for each script.  So session_start() needs to be 
called at the top of each script (or at least before any output). 
Example..
 
page 1
--
?
session_start();
$myvar = foo bar;
session_register('myvar');
// or //
$_SESSION['myvar'] = $myvar;
?
 
page 2
-
?
session_start();
unset($_SESSION['myvar'];
// or //
session_unregister('myvar');
?
 
- Original Message - 
From: [EMAIL PROTECTED] 
To: Kevin Stone 
Cc: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
Sent: Monday, July 08, 2002 2:05 PM
Subject: Re: [PHP] UNSETing Session Variables


Sorry about that I should have been more detailed. 
session_start() and all of my session_register() calls happen on login.php 
here is a sample session_register call. 
  session_register(currentbid); 
I am under the impression that I only need one session register call. 

Jed 




Kevin Stone [EMAIL PROTECTED] 
07/08/2002 02:00 PM 

To:[EMAIL PROTECTED] 
cc:[EMAIL PROTECTED] 
Subject:Re: [PHP] UNSETing Session Variables



$_SESSION['currentbid'] isn't available until you do session_start(); 
  
session_start(); 
unset($_SESSION['currentbid']); 
  
Or is this what does connect.inc contains? 
  
-Kevin 
 
- Original Message - 
*snip 
  please see previous messages for this information 
 snip* 



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




Re: [PHP] localhost - passing variables

2002-07-05 Thread Martin Clifford

If you're using one of the more recent releases of PHP4+, then register_globals is set 
to OFF by default in your php.ini file.  Change this to ON or use 
$_GET['variable']/$_POST['variable'] to access the values.

Martin

 Tony Tzankoff [EMAIL PROTECTED] 07/05/02 12:43PM 
Is it possible to pass variables in PHP on the localhost server? Is there
some kind of setting or something that I need? I am new to this and am not
sure how to go about this. When I upload to a server, the script I have
works just fine; but when I work on it locally, it does not work. Please
help while I am still technically sane. Thanks. :oP

Tony Tzankoff
http://www.tzankoff.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




Re: [PHP] How do I split an alphabetical list (array) into A-Mand N-Z?

2002-07-03 Thread Martin Clifford

Try using a regular expression to go through each of the array elements, sending to 
one array if the first letter is [a-mA-M], to another if the first letter is [n-zN-Z]. 
 If you're not searching by first letter in the array elements, and they are 
comma-delimited name sets, do it that way.

HTH

Martin

 [EMAIL PROTECTED] 07/03/02 08:50AM 
On Wednesday 03 July 2002 19:52, Daevid Vincent wrote:
 Anyone have a function that will take an alphabetical list of names (in
 an array already) and split it into two 'chunks' (arrays) A-M and N-Z?

Psuedo-code:

 loop through array
 array_shift()
 if element is A-M add to the A-M array, else add to N-Z array

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk 
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
I wish I was on a Cincinnati street corner holding a clean dog!
*/


-- 
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




Re: [PHP] V basic newbie problem

2002-07-03 Thread Martin Clifford

while($row = mysql_fetch_array($result_set)) {
   $field1 = $row['field1'];
   $field2 = $row['field2'];

   echo trtd width=\50%\\n;
   echo $field1\n;
   echo /tdtd width=\50%\\n;
   echo $field2\n;
   echo /td/tr\n;
}

This will cycle through the rows, adding the values of field1 and field2 to the 
respective variables, then outputting table rows accordingly.

HTH

Martin

 Duncan Ellwood [EMAIL PROTECTED] 07/03/02 10:43AM 
I'm not sure if this is the right place for this but I'm just starting out
with php and MySQL

I have succesfully got a database up and I have managed to populate the
first row of the html table with the first  row of  dynamic content without
too
much problem. I have used the visual enviroment of DW Mx for this and it was
staightforward enough

My problem arises when I want to fill in the subsequent rows of the table
with the subesquent rows from the database. How do I create the recordset
that will pull the info from the relevant subsequent rows for my columns?

The code for the first row and first column entry is:

?php echo $row_RsSingStanDailybb['DailyBB']; ?

but in the row below in the html table I want to refer to the second row DB
entry for DailyBB but I cant see how to go about this:( The Repeat server
behaviour in DW Mx simply puts all the values in one html cell which is not
what I wish to achieve. Basically I want the html table to match the
database but have only succeeded in getting the first row to display so
far:(

I'm sure this is simple but its my first time at all this and any help would
be appreciated:)

TIA




-- 
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




[PHP] Another Regex Question (General)

2002-07-03 Thread Martin Clifford

This may sound like a stupid question, but... within a regular expression, are the 
values in brackets evaluated consecutively, or no?  For example:

Does [a-zA-Z0-9] (yes, I know [:alnum:] is the same) mean that there can be a number, 
but it has to follow a letter?  Or would you just do [a-zA-Z][0-9] to do that?

Elementry, my dear newbie.  Hehe.  Thanks all!

Martin


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




Re: [PHP] Authentication

2002-07-03 Thread Martin Clifford

Sessions make life so much eaiser, in my opinion.  I used to do what you do, passing 
from one page the next.  Now, when a user successfully logs in, ONE line of code 
passes all the necessary variables from page to page without me having to do a damn 
thing.

I don't personally see TOO much wrong with passing the encrypted password along, 
especially since you aren't displaying it in the URI's query string.  BUT, if someone 
DID get a hold of the encrypted password, they can run millions of words through md5() 
until one matched.  I would hope that people aren't bored enough to do that, but past 
actions have proved that wrong.

The magic line:  session_start().  That's it.  It holds ALL information about the 
session, and makes my life SO much eaiser.

HTH

Martin

 Peter [EMAIL PROTECTED] 07/03/02 03:32PM 
On my site, when a user logs in, their password is encrypted using md5() and
the username and encrypted password is then passed from page to page using
hidden form inputs (clicking on a link submits the form using POST).
Does anyone have any comments on this method e.g. security wise? I know I
could use sessions or cookies but is it relly necessary?



-- 
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




Re: [PHP] How to start hello program

2002-07-03 Thread Martin Clifford

What address are you using the run the program?

Try using http://localhost/hello.php and see if that works.  I don't use IIS, so I 
couldn't tell you anything relating to configuration.

 Varsha Agarwal [EMAIL PROTECTED] 07/03/02 03:42PM 
Hi,
I am completely new to PHP and webserver things. I
followed instructions in the online manual of PHP and
installed it on my Win2000 machine which has IIS
istalled. I have written a hello.php program. I am
stuck here. The manual does not say how to run it. I
tried to open it in internet explorer, but it shows a
blank page.
I know this is a foolish Q, but please help me.

Thanks,
Varsha

__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.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




Re: [PHP] GET data in URL

2002-07-03 Thread Martin Clifford

PHP now comes with register_globals set to OFF by default, as far as I'm aware.  You 
can access the variables using $_POST['variable'] and $_GET['variable'], or turn 
register_globals back ON. :o)

Martin

 Jay [EMAIL PROTECTED] 07/03/02 03:46PM 
I just installed php 4.2.1 and i have a couple of URL's that pass variables
through links (www.domain.com/index.php?test=123) and when I run that it
comes up on the next page and the test variable is empty?  I can't figure
this out but if I had to guess I would think it's some setting in the
php.ini?

Any thoughts?

Thanks!


-- 
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




[PHP] Regular Expression Problem

2002-07-02 Thread Martin Clifford

Hey all!

I'm trying to get this darn eregi_replace() to work, but it doesn't produce any 
results at all.

I want it to find all occurances of PHP variables.  Here is the regexp

$output = eregi_replace(^[\$]{1,2}[a-zA-Z][0-9]+$, b\\1/b, $var);

As you might guess this is for a syntax highlighting function I am trying to write.  
Anyone have any ideas why it's not working?  Please copy me directly, as I'm on the 
digest.  Thanks!

Martin


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




Re: [PHP] Regular Expression Problem

2002-07-02 Thread Martin Clifford

Even this:

$output = preg_replace(/^[\$]{1,2}[a-zA-Z][0-9]+$/, b\\1/b, $var);
echo $output;

Doesn't work.  It just takes whatever you put into $var, then puts it into $output, 
and outputs it to the screen.

I want to change anything resembling a PHP variable, i.e. $var, $$var or $var to 
b$var/b.  Any ideas on how to do that?

 [EMAIL PROTECTED] 07/02/02 01:50PM 
On Wednesday 03 July 2002 01:40, Martin Clifford wrote:
 Hey all!

 I'm trying to get this darn eregi_replace() to work, but it doesn't produce
 any results at all.

 I want it to find all occurances of PHP variables.  Here is the regexp

 $output = eregi_replace(^[\$]{1,2}[a-zA-Z][0-9]+$, b\\1/b, $var);

 As you might guess this is for a syntax highlighting function I am trying
 to write.  Anyone have any ideas why it's not working?  Please copy me
 directly, as I'm on the digest.  Thanks!

Your regex looks suspiciously like a PCRE!

Try changing eregi_replace to preg_replace.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk 
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Reichel's Law:
A body on vacation tends to remain on vacation unless acted upon by
an outside force.
*/



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




  1   2   >