[PHP] Sessions/Browser back button

2002-11-25 Thread Craig
I remember seeing threads debating this before, but is there anyway to
disable/prevent a user from heading back in the browser and getting the
"WARNING: Page has Expired" notice?

Cheers
Craig



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




[PHP] Re: File Write Permission Errors - HELP! URGENT!!!

2002-11-25 Thread Craig
you must give the same permissions to the folder also.


"Phil Powell" <[EMAIL PROTECTED]> wrote in message
0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6">news:0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6...
Hi I have the following code that breaks:

// PLACE NICK INTO NICKNAMES.TXT AND START OFF MESSAGES.TXT
   $fileID = fopen($path . "/nicknames.txt", "a") or die("Could not open " .
$path . "/nicknames.txt");
   chmod($path . "/nicknames.txt", 0755);
   fputs($fileID, $nickname . "\n"); fflush($fileID); fclose($fileID);
   $fileID = fopen($path . "/messages.txt", "a") or die("Could not open " .
$path . "/messages.txt");
   fputs($fileID, "*** WELCOME \"" . $nickname . "\" TO THE ROOM ***");
fflush($fileID); fclose($fileID);


I am getting the following error:
Warning: fopen("/users/ppowell/web/chat/nicknames.txt", "a") - Permission
denied in /users/ppowell/web/chat/chat.php on line 163

I am attempting to write onto the files if they exist, if not, create them
on the fly.  I need the solution in the next 5 minutes - sorry, kind of an
emergency!

If anyone can help, please tell me what to do, the PHP manuals are not
giving me a clear solution as to how to write to a file that does not yet
exist that has to have the permissions of 0755 for both files.

Thanx
Phil




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




[PHP] Re: Php Search Engine

2002-11-25 Thread Craig
hotscripts.com


<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am in need of a search engine. I'd rather do one in PhP. Is there one
> available that I can see or at least get the code for?
>
> I'm a newbie to php. :)
>
>
> Krystal



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




[PHP] Re: If statement w/ multiple conditions

2002-11-26 Thread Craig
Something like this will work...







<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>  I'll be trying to use a routine that checks 4 seperate variables for
> content and need to know the easiest method to do so. The function works
> on 2 conditions; either all the variables are empty and I do something or
> I do something else.
>
> $lineone
> $linetwo
> $linethree
> $linefour
>
>  Would you use
>
> if ($lineone && $linetwo && $linethree && $linefour = "")
>
> Thanks,
>
> Ed
>
>



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




Re: [PHP] If statement w/ multiple conditions

2002-11-26 Thread Craig
Something like this will work...



<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>  The db will include these 4 rows even though they don't store data.
> Eventually they will contain data for contact info as soon as the users
> log in and it prompts them for it.
>
> On Tue, 26 Nov 2002, DL Neil wrote:
>
> > Ed,
> > Assuming there will be a response from the db-tbl, here is another
choice:
> >
> > if ( $lineone . $linetwo . $linethree . $linefour > "" )
> > {
> >//show it to the user and ask if they want to change it
> > }
> > else
> > {
> >//prompt for information
> > }
> >
> > Do you mean that the db-tbl will have a row of data even if the four
fields
> > are empty, or if there is no data (in those fields) will that imply that
> > there is no row (and thus different code needed)?
> > =dn
> >
> >
> > >  All four must be an empty string. I will be pulling the values from a
> > > MySQL database. If these fields are empty I'll be prompting for
> > > information. If any one of them contain anything I'll be showing it to
> > > the user and asking if they want to change it.
> > >
> > > Thanks,
> > >
> > > Ed
> > >
> > >
> > > On Tue, 26 Nov 2002, Ernest E Vogelsinger wrote:
> > >
> > > > At 13:50 26.11.2002, [EMAIL PROTECTED] said:
> > > > [snip]
> > > > > I'll be trying to use a routine that checks 4 seperate variables
for
> > > > >content and need to know the easiest method to do so. The function
> > works
> > > > >on 2 conditions; either all the variables are empty and I do
something
> > or
> > > > >I do something else.
> > > > >
> > > > >$lineone
> > > > >$linetwo
> > > > >$linethree
> > > > >$linefour
> > > > >
> > > > > Would you use
> > > > >
> > > > >if ($lineone && $linetwo && $linethree && $linefour = "")
> > > > [snip]
> > > >
> > > > Your expression yields true if 1-3 are not-empty AND four is an
empty
> > > > string. Not sure if that's what you want.
> > > >
> > > > All empty:
> > > > !($lineone || $linetwo || $linethree || $linefour)
> > > > --or--
> > > > !$lineone && !$linetwo && !$linethree && !$linefour
> > > >
> > > > All set:
> > > > $lineone && $linetwo && $linethree && $linefour
> > > >
> > > >
> > > > --
> > > >>O Ernest E. Vogelsinger
> > > >(\)ICQ #13394035
> > > > ^ http://www.vogelsinger.at/
> > > >
> > > >
> > > >
> > > > --
> > > > 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] Identifying users

2002-11-27 Thread Craig
Anyone know off of hand - Is there a reliable/semi-reliable way of looking
users up by country.

e.g - On the likes of altavista or google, I have noticed that if you type
in www.altavista.com and you are in the uk, it will redirect to
uk.altavista.com, and google aswell for certain countrys.

Anyone any Ideas?

Craig



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




[PHP] images

2002-11-29 Thread Craig
Not sure if this would be anyway possible, hopefull some of you GD gurus
will have an idea.

Basically the scenario is, I have a dirtectory of images(5 to be exact).

What I want to be able to do is something similar to the script below, which
randomizes a gif image selection.  the file is called "image.php", the
person calls it like they would an image:  and boom there
ya have a nice gif image.  But what I want to be able to do is join together
a number of images, so based on certain conditions, a user could call  and this would show maybe two/three/four images joined
together.  I can do this with one fine, but I thought there may be some sort
of GD function that would tackle this.

Thanks for any help,

Craig





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




[PHP] Re: array with session

2002-11-29 Thread Craig
You should have session_start(); on every page that you want to hold the
session.

The way I would do what you are trying to achieve is go the $_SUPERGLOBALS
way..

on the submit_information.php page:

\n";
}
?>

Also, another good way of debugging etc is to use the print_r() function
(http://www.php.net/print_r)

If you do :



This produces a nice formatted look at the the session arrays/structures -
same goes for all arrays.

Hope that helps,

Craig


"Laurence" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> hello everyone,
>
> I'm trying to get some images value from a checkbox putting them in a
session to preserve the data.  The array works perfectly without the
session_start() and session_register.
>
> can anyone help?
>
> html script
>
> 
> 
> 
> 
>
> 
> 
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
> 
> 
> 
>
> php script: submit_information.php
>
>  session_start();
> session_register("Image");
>
> $count = count($Image);
> for ($i=0; $i<$count; $i++)
> {
>   echo $Image[$i];
> }
>
> //I also tried that
> /*foreach ($Image as $i=> $Img)
> {
>  $Img == $Image[$i];
>  echo $Img;
> }*/
>
> ?>
>
>
>
>
> -
> With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits
your needs
>



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




[PHP] Re: array with session

2002-11-29 Thread Craig
Files are attached..

Craig


"Craig" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You should have session_start(); on every page that you want to hold the
> session.
>
> The way I would do what you are trying to achieve is go the $_SUPERGLOBALS
> way..
>
> on the submit_information.php page:
>
>  session_start();
> $_SESSION['image'] = $_POST['image'];
>
> foreach($_SESSION['image'] as $foo){
> echo $foo . "\n";
> }
> ?>
>
> Also, another good way of debugging etc is to use the print_r() function
> (http://www.php.net/print_r)
>
> If you do :
>
> 
>
> This produces a nice formatted look at the the session arrays/structures -
> same goes for all arrays.
>
> Hope that helps,
>
> Craig
>
>
> "Laurence" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > hello everyone,
> >
> > I'm trying to get some images value from a checkbox putting them in a
> session to preserve the data.  The array works perfectly without the
> session_start() and session_register.
> >
> > can anyone help?
> >
> > html script
> >
> > 
> > 
> > 
> > 
> >
> > 
> > 
> >  
> >  
> >  
> >  
> >  
> >  
> >  
> >  
> >  
> >  
> >  
> >  
> >  
> > 
> > 
> > 
> >
> > php script: submit_information.php
> >
> >  > session_start();
> > session_register("Image");
> >
> > $count = count($Image);
> > for ($i=0; $i<$count; $i++)
> > {
> >   echo $Image[$i];
> > }
> >
> > //I also tried that
> > /*foreach ($Image as $i=> $Img)
> > {
> >  $Img == $Image[$i];
> >  echo $Img;
> > }*/
> >
> > ?>
> >
> >
> >
> >
> > -
> > With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits
> your needs
> >
>
>


begin 666 submit_information.php
M/#]P:' -"@T*"7-EPT*#0H)"65C:&\@)&9O;R N("(\8G(^7&XB
M.PT*#0H)?0T*#0H_/@T*/'!R93X-"@D\/W!H<"!P3X-"@D\9F]R;2!A8W1I;VX](G-U8FUI=%]I;F9O#QI;G!U="!T
M>7!E/2)C:&5C:V)O>"(@;F%M93U);6%G95M=('9A;'5E/2));6%G95]S:7@B
M/CQB7!E/2)S=6)M:70B('9A;'5E/2)S=6)M:70B
?/@T*"3PO9F]R;3X-"CPO8F]D>3X-"CPO:'1M;#X-"@``
`
end


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




[PHP] Re: Help on OOP

2002-12-09 Thread Craig
I found this to be a good beginners tutorial on the subject

http://www.onlamp.com/pub/a/php/2002/07/18/php_foundations.html

Craig

"Mohd_q" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I can't distinguish between objects, classes, and functions.
Here is a question - sorry if appear to be rediculous :

--  Can we have a function inside another function?

if anyone can suggest the best tutorial on OBJECTS and CLASSES, I'll be
grateful.





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




[PHP] Months of the year

2003-01-06 Thread Craig
How do I create a drop down list that automatically generates a list of
months for the next 12 months upto and including this month

eg

list labellist value
February  200202
March 2002 03
 ||
 ||
January 200301

Thanks

Craig



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




[PHP] Word Count

2003-01-23 Thread Craig
Is there a way to count the number of words in a string?



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




Re: [PHP] Word Count

2003-01-24 Thread Craig
Using these methods, could you use it to insert additional text before and
after the first word (or the nth word)

e.g.
$text = "This is my text, for placement";
$textWithAddedString = "(word1 start)This(word1 end) is my text, for
placement";




"Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> words, for a programming language, are nothing more than just the spaces.
> So, as previousely was shown - could the mount of spaces in the string
> to get the amount of `words' in between them.
>
>
> --
> Maxim Maletsky
> [EMAIL PROTECTED]
>
>
>
> "Craig" <[EMAIL PROTECTED]> wrote... :
>
> > Is there a way to count the number of words in a string?
> >
> >
> >
> > --
> > 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] tets

2003-04-03 Thread Craig
test



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



[PHP] MSSQL using Sybase FreeTDS

2003-04-03 Thread Craig
Hey all,

Im hoping someone can shed some light on this for me:

Im running PHP 4.31 on RH Advanced Server 2.1

I am connecting, to M$SQL Server 2000  using FreeTDS -- with Sybase support,
and Im stumped on 1 thing:

CODE:






The above code works fine, except when one of the fields e.g client_name -
Has a quoted string or an apostrophe in it, it just spews the following
error:

Warning: Sybase error: Line 1: Incorrect syntax near 's'. (severity 15) in
/var/www/html/clients/pages/add_client.php on line 17

Has anyone experienced this, and if so know of a possible solution?? I have
used addslashes() etc but still no joy.

Thanks in advance.

Craig



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



[PHP] Imgs in Database

2003-06-04 Thread Craig
Im converting a site from asp to php, Its db driven and some images are
stored in the db.

The previous developer stored the image files in a text string format, Im
assuming I have to convert the text back into a binary format, anyone had
any experience with this or can shed some light on this for me?

Regards,

Craig



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



Re: Re[2]: [PHP] Imgs in Database

2003-06-05 Thread Craig
Just for your info..I researched this a bit further..and with a little help
from the manual, the following works a treat.:

Cheers,
Craig



 0)
  {
   $result = mssql_fetch_array($sqry_img);
   Header ("Content-type: image/gif");

   print hex2bin($result['raw_data']);
  }

  @mssql_free_result($sqry_img);
  @mssql_close($conn);

 }
?>





"Alexware" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello Craig & All,
>
> As far I know, you can just echo it to a file and you will get the image
file.
> Of course don't forget the extention.
> Just a simple "for" cycle can do it for you (inside a select).
>
> e.g.:
> $query = "select bin_data,filetype from binary_data";
> $result = mysql_query($query);
> $numofrecords = mysql_num_rows($result);
>
> for ($i=1; $i<=$numofrecords; $i++)
> {
>$type = $ratas->filetype;  // used for type marking some how
>// do open a file with name +$i+content type (e.g. gif or jpg or
>whatsoever)
>
>$datas = mysql_fetch_object($result); // the picture stored in the
database
>$data = $datas->bin_data;
>// echo it to the file opened previously
>// close the file
> }
>
> If I would meet this, I would try this.
>
> Any comments?
>
> --
> Best regards,
>  Alexmailto:[EMAIL PROTECTED]
>
> Wednesday, June 4, 2003, 1:26:47 PM, You wrote:
>
> > An Image file is just text typically
>
> > If you know the format of the images it should be a case of extracting
the
> > 'text' that is the file and sending the appropriate headers...
>
> > - Original Message -
> > From: "Craig" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 04, 2003 12:09 PM
> > Subject: [PHP] Imgs in Database
>
>
> >> Im converting a site from asp to php, Its db driven and some images are
> >> stored in the db.
> >>
> >> The previous developer stored the image files in a text string format,
Im
> >> assuming I have to convert the text back into a binary format, anyone
had
> >> any experience with this or can shed some light on this for me?
> >>
> >> Regards,
> >>
> >> Craig
>



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



[PHP] MSSQL - Previous/Next Paging Results

2003-06-10 Thread Craig
MSSQL seems to be a little bit messier that MySQL..e.g limit clause etc

Anyone know of articles/examples that specifically deal with this issue?

Any insight appreciated.

Craig



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



Re: [PHP] Standalone PHP Client?

2003-06-24 Thread Craig
Have a look here, this may help:

http://www.triplehash.com/content.php?id=26

Regards,

Craig


"Galen P. Zink" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Well, having a solid product that people can look at offline has been a
> major selling point in the past. The customers we cater to appreciate a
> physical product. We could give them HTML that sends them online, but
> we could just as easily give them a card with an URL on it and not
> waste CD media for a 1K shortcut file. I can't confess to completely
> understand these people who really want a local product for something
> that must be uploaded to the internet in the end and is dependent on
> our servers to handle checkout and order processing - it's just a
> psychological thing, I guess.
>
> I'm trying to investigate how hard it would be to get a demo product on
> a CD that basically goes through an installer process and installs some
> back end PHP/MySQL stuff so a demo can be run locally. What exactly
> would be involved in compiling a PHP client with the source myself -
> are there any existing products along these lines? It probably wouldn't
> be practical to develop a whole project our selves, but if there was
> something already out there, we might use it.
>
> -Galen
>
> On Friday, June 20, 2003, at 11:04 AM, Michael A Smith wrote:
>
> > Why not have them all do that? HTML that re-directs? Other than taking
> > the source, compiling yourself, or taking the pre-compiled windows
> > binaries and including them, that's the only way.
> >
> > -Michael
> > On Fri, 2003-06-20 at 09:57, Galen P. Zink wrote:
> >> I work for a small networking company. We're working on a piece of
> >> software that will be run server-side with PHP and MySQL. It allows
> >> the
> >> user to develop an online store and handles all the complex shopping
> >> cart stuff with ease. It is a port of an originally client-side
> >> application. We would like to be able to hand out demo discs that do
> >> not require the internet to try it out - having a standalone try-out
> >> version is a big source of customers.
> >>
> >> Is there any kind of standalone PHP/MySQL engine that could be
> >> reasonably installed from a CD and run on most Windows machines? If
> >> there was some method to compile the PHP into a binary or otherwise
> >> protect it, it would be really good because our company would not be
> >> too excited about handing out the near-complete source to our product
> >> on all the demo discs. It would be nice if there was support for
> >> non-Windows OSes, but Windows is by far the majority in market share
> >> and the other OSes could easily just pop into an HTML document that
> >> directs them to our online version.
> >>
> >> Thanks,
> >>
> >> Galen P. Zink
> >>
> >
>



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



[PHP] Creating a calender / diary

2002-07-24 Thread Craig

i am using dreamweaver mx and want to acheive the following

9:00 task 1
9:30 task 2
10:00   task 3
task 4
task 5
10:30   task 6

i have a recordset that displays the tasks ordered by the time but what i
dont want is to display the time for every item, or if an entry is at 10:15
for example.

Any ideas???


Craig




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




[PHP] Bus Schedule / Time table

2002-09-27 Thread Craig

I have been given the task to program a site in php that displays the
timetable of a local bus company
Does any one have any suggestions into where to look for any info or advice?

Thanks

craig



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




[PHP] Select values in an array???

2002-10-29 Thread Craig
I am trying to pass the values of a select box which can have more than one
value to a page.

In the address bar of the page i have sent to, I have
select=item1&select=item2select=item3&select=item4select=item5&select=item6

on the page i have
echo $select

but only the last item (item6) is being displayed on the page

how do i create an array of all the items in a list on the page?

any help would be gratefully appreciated

craig



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




Re: [PHP] Select values in an array???

2002-10-29 Thread Craig
I have changed the select to slect[] but the next page displays array

how do i display each individual select item in a list

ie

you have selected

item2
item4
item5
.
.
.
.


"Rick Emery" <[EMAIL PROTECTED]> wrote in message
news:05e401c27f60$52399a90$0500a8c0@;honeybee...
> I've used it without "multiple" many times
> - Original Message -
> From: "John Nichel" <[EMAIL PROTECTED]>
> To: "Rick Emery" <[EMAIL PROTECTED]>
> Cc: "Craig" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, October 29, 2002 9:33 AM
> Subject: Re: [PHP] Select values in an array???
>
>
> You do if you want to select multiple values from a select element.
> Otherwise, you can only select one.
>
> Rick Emery wrote:
> > You don't even need the word "multiple"
> > - Original Message -
> > From: "John Nichel" <[EMAIL PROTECTED]>
> > To: "Craig" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Tuesday, October 29, 2002 9:27 AM
> > Subject: Re: [PHP] Select values in an array???
> >
> >
> > Change the name of your select field to "select[]"
> >
> > 
> >
> > Craig wrote:
> >
> >>I am trying to pass the values of a select box which can have more than
one
> >>value to a page.
> >>
> >>In the address bar of the page i have sent to, I have
>
>>select=item1&select=item2select=item3&select=item4select=item5&select=item
6
> >>
> >>on the page i have
> >>echo $select
> >>
> >>but only the last item (item6) is being displayed on the page
> >>
> >>how do i create an array of all the items in a list on the page?
> >>
> >>any help would be gratefully appreciated
> >>
> >>craig
> >>
> >>
> >>
> >
> >
> >
> >
>
>
>
>



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




[PHP] finding a value in an array

2002-11-04 Thread Craig
I have a database table that holds the values of IDs in the format
1,2,3,4,5,67,x,x,x,x,x,x

I am using a dynamic select list menu that displays a list of items from a
2nd table with the values set to their unique ids
eg
item 1
item2
item 3
item 4
item 5

i am trying to use an array search that will highlight the item if the
option value is in the array of the IDs, but with no luck, either all the
ids are highlighted or none at all

Does any one have any suggestions into how to do this

Thanks

Craig



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




[PHP] Re: PHP driven frame

2002-11-05 Thread Craig
Why do you nee to use frames?

Wouldn't it be asier to set hidden fields in the second form and submit the
values of the first form to these hidden fields.
Personally I would submit the form into the same page



"Chris Rehm" <[EMAIL PROTECTED]> wrote in message
news:3DC770B4.9060502@;javadisciple.com...
> I'd just like to see if I can get some feedback from PHP pros to see if
> anyone is doing anything like this.
>
> I've got a request to build a two part form, I was thinking it would be
> a page built with frames, when the top portion is filled out, the
> selections there would determine what page would fill the bottom
> portion. But since the bottom would also be a form for submission, I
> just thought I'd build it with PHP so that hidden fields on it would
> store the data from the top portion. Then, a submit gets all the data on
> one form.
>
> Is anyone doing this? Any problems I'm overlooking? I was thinking of a
> simple javascript action on the upper form to kick off the php for the
> lower frame.
>
> I'd appreciate any feedback regarding this. Is this something I should
> be using PHP for?
>
> --
> Chris Rehm
> [EMAIL PROTECTED]
>
> For all the law is fulfilled in one word, even in this; Thou shalt love
> thy neighbour as thyself.
> Gal. 5: 14
>
>
>



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




[PHP] ACT Based Contact Management System

2002-11-19 Thread Craig
Does anyone know of any sites that offer a web based contact management
system that works in a similar way to ACT?

I want to implement such a system that connects to a mysql database




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




[PHP] PHP Version of Outlook????

2002-11-22 Thread Craig
Does Any one of a web based version of Microsoft Outlook/MSN Hotmail address
book and scheduler





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




Re: [PHP] PHP Version of Outlook????

2002-11-22 Thread Craig
no i want to create a php version of the web based outlook account found on
msn.com


"Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> What does outlook have to do with PHP?
>
> No, there is nothing official has been made. There are some similar apps
> though, very good ones actually.
>
>
> --
> Maxim Maletsky
> [EMAIL PROTECTED]
>
>
>
> "Craig" <[EMAIL PROTECTED]> wrote... :
>
> > Does Any one of a web based version of Microsoft Outlook/MSN Hotmail
address
> > book and scheduler
> >
> >
> >
> >
> >
> > --
> > 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] Testing PHP on a local machine

2002-06-24 Thread Craig

I want to set up a site at home to play with php

I have windows xp pro, dreamweaver MX and mysql

Do I need anything to view live application data locally in my browser

eg a dynamic php website that is on my local machine that i can access and
update?

I hope this makes sense

Can anyone point me  into the right direction, relvant websires etc???


Thanks

Craig



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




Re: [PHP] function echo ' '

2002-06-25 Thread Craig

Can you use

 or is this bad coding?


"René moonen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Use the escape character to output double quotes
>
> echo '';
>
> René
>
> Martin Johansson wrote:
>
> >Is there a way to express php variables inside an echo ' '.
> >
> >I want something like this to work:
> >
> >echo '';
> >
> >I know I can write it like this:
> >echo ' >echo '">';
> >
> >But Its to hard to read the code like this.
> >/Martin
> >
> >
> >
> >
>
>



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




[PHP] Re: Testing PHP on a local machine

2002-06-26 Thread Craig

Thanks for pointing me in the right direction

However, just have a few other questions:-

Do i need to install apache if i use the windows self extracting version?
Can all this be also done on a laptop?

Thanks for all the advice

Craig
"Craig" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...



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




[PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Craig

Is this possible
I want to create a form, similar to an invoicing system that generates a
word document that the user can print out

Any help would be gratefully appreciated.

craig



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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Craig

I know that php can open files.
What I was wondering is if it can :-
Start Word
Open a Word template
Generate fields in the template based on hidden fields and generate the page


"David Otton" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Wed, 10 Jul 2002 15:53:36 +0100, you wrote:
>
> >I want to create a form, similar to an invoicing system that generates a
> >word document that the user can print out
>
> You may have better luck with RTF
> (http://www.phpbuilder.com/columns/nair20020523.php3) or PDF
> (http://www.php.net/manual/en/ref.cpdf.php)...
>
> (but what can the Word format do that HTML can't? Why can't they print
> out an HTML invoice?)
>



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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Craig

I need to be able to keep a record of documents created.

I have found this but failed to get it to work

Version)\n";
$word->visible = 1 ;
$word->Documents->Add();
$word->Selection->Typetext("This is a test");
?>

does anyone recognise this?



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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-11 Thread Craig

Thanks for all the info, i have found a temporary solution which i am
currently going to develop
If anyone is interested, I found the following at

http://www.pscode.com/xq/ASP/txtCodeId.625/lngWid.8/qx/vb/scripts/ShowCode.h
tm

Thanks Again

Craig



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




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

2002-07-11 Thread Craig

Is there a way to create a customised version of the index directory
structure using php?

Eg listing all the pages in the specific directory when an index page isnt
created?



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

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] (OT?) form question

2004-01-07 Thread craig
Hi All,

This may be more of an HTML question - can't find anything 
in the php manual, but I may not know where to look.

Is it possible to put the cursor into a form element  
when a page loads without using javascript?

Thanks,
Craig

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



[PHP] not sure why regex is doing this

2004-01-09 Thread craig
Hi,

I have a text file that I have to parse and insert into a db.
these are a couple of sample lines (they are part of the 
variable $query)

(4536,'golf tournament management',430,0,0),
(1434,'Premium golf balls',,,0),

I have to replace the blank entries (,,) with NULLs,
and I am using this regex:
$query = preg_replace('/,\s*,/',',NULL,', $query, -1);

after this line, only ONE of the ,, sets is replaced
by ,NULL, like this:
(4536,'golf tournament management',430,0,0),
(1434,'Premium golf balls',NULL,,0),

So, my problem is that I have to run the regex twice to
replace both sets of ,, with ,NULL, and I really don't 
want to do that. Why isn't it getting them both with the 
first regex, and how should I modify it to catch them 
both?

TIA,
Craig

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



RE: [PHP] Form validation: client- or server-side?

2004-01-09 Thread craig
> Is there a distinct advantage to doing form validation /
> error checking on
> the server side using PHP?
The actual code you use to validate remains hidden from a potential
malicious user, while javascript code can be seen, so if there is a
hole in your error checking, it can be found easier.

The big advantage to javascript is that it is fast, since a request
isn't sent back to the server, processed, and then sent back. It also
reduces network traffic, and reduces server load.

> That's how I've always done it
> because I know
> PHP better than JavaScript, but wouldn't it make sense to
> validate as much
> of your form as possible using JavaScript before the form was
> ever posted?
> I'm just talking about the basics, like empty required fields, illegal
> characters, string lengths, etc.
even if you partially validate on the client, you still have to validate
on the client side, which seems redundant to me.
>
> What are your preferred methods?  I do an awful lot of
> content management
> with HTML forms, so it's not an entirely spurious question.

I only use javascript for things that I can't do with php, and I can
validate with php.

that's my 2 cents worth,
Craig

>
> --
> Matt Grimm
> Web Developer
> The Health TV Channel, Inc.
> (a non - profit organization)
> 3820 Lake Otis Parkway
> Anchorage, AK 99508
> 907.770.6200 ext. 686
> 907.336.6205 (fax)
> E-mail: [EMAIL PROTECTED]
> Web: www.healthtvchannel.org
>
> --
> 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] not sure why regex is doing this

2004-01-09 Thread craig
Thanks Kelly.

That works just like I wanted, only starting the regex engine
once. Guess I'll have to figure out lookahead.

-Craig

> -Original Message-
> From: Kelly Hallman [mailto:[EMAIL PROTECTED]
> Sent: January 9, 2004 11:24 AM
> To: craig
> Cc: Php
> Subject: Re: [PHP] not sure why regex is doing this
>
>
> On Fri, 9 Jan 2004, craig wrote:
> > (4536,'golf tournament management',430,0,0),
> > (1434,'Premium golf balls',,,0),
> >
> > I have to replace the blank entries (,,) with NULLs, using
> this regex:
> > $query = preg_replace('/,\s*,/',',NULL,', $query, -1);
> > after this line, only ONE of the ,, sets is replaced by ,NULL, like:
> > (1434,'Premium golf balls',NULL,,0)
>
> The regex does continue trying to make matches, but the point
> at which it
> continues is just past your replacement. In other words, the trailing
> comma in ,NULL, is not considered part of the string to match/replace.
>
> This should do the trick:
> preg_replace('/,\s*(?=[,\)])/', ',NULL', $input);
>
> (?=pattern) is a positive lookahead. It evaluates true if the next
> characters match the pattern, but those characters are not consumed.
>
> So that regex is equivalent to "match a pattern starting with a comma
> followed by any existing spaces, ONLY IF the next character is , or )"
>
> The most robust way you could write this regex is:
> preg_replace('/([,\(])\s*(?=[,\)])/', '\1NULL', $input);
>
> I know you'll probably never have input like (),
> but it would work as expected.
>
> Many tricky regex problems can be solved by lookaheads. There
> is also a
> negative lookahead (?!pattern) ... also note that this is an advanced
> regex feature and won't it work on many regex engines not
> based on PCRE.
>
> --
> Kelly Hallman
> // Ultrafancy
>
> --
> 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 preg_replace

2004-01-19 Thread craig

> Hi Joel,
>
> Thanks for the reply.
>
> I have tried using  "/" to delimit the string  and I get the
> following error
>
> String
>
> $url =
> "/http://www.foo.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL]/";;

you have to escape all of the slashes execpt the first and last that
delineate the regex.

$url =
"/http:\/\/www.foo.com\/maxbid\/Unsubscribe.php?EmailAddress=[MAIL]/";

kinda ugly, but it'll get rid of that error!

HTH,
Craig

>
> Gives the error:
> *Warning*: Unknown modifier '/' in* /test.php* on line *8*
>
> I found out that I could use  ' to delimit from Example 5 in the php
> manual page for preg_replace.
>
> Also I need to  replace only one occurance of the string at a
> time, so I
> can't use str_replace :-( .
>
> Any other suggestions??
>
> Cheers
>
>
> John
>
>
>
>
> joel boonstra wrote:
>
> >On Mon, Jan 19, 2004 at 06:50:37PM +0200, John Clegg wrote:
> >
> >
> >>Hi
> >>
> >>I am having some problems with preg_replace and I wondering
> if someone
> >>could suggest a fix or explain why it is not working.
> >>
> >>
> >>
> >>Here is the Code:
> >>*
> >> >>$code = "blah
http://www.foo.com/Unsubscribe.php?EmailAddress=[MAIL] blah";
>>$url =
"'http://www.foo.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL]'";
>>echo "BEFORE : $code";
>>$replace  = "Foo";
>>$code = preg_replace($url,$replace,$code,1);
>>echo "AFTER: $code";
>>?>
>>**
>>
>>Here is the results of the script:
>>
>>**
>>BEFORE : blah
>>http://www.qxlmaxbid.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL]
blah
>>
>>AFTER: blah
>>http://www.qxlmaxbid.com/maxbid/Unsubscribe.php?EmailAddress=[MAIL]
blah
>>
>>**
>>
>>It should give the following result:
>>
>>**
>>
>>AFTER: blah Foo blah
>>
>>**
>>
>>
>
>preg_replace expects the first argument to be a pattern, which should
be
>enclosed in forward slashes ("//").  So your $url variable should be
>surrounded with slashes.  You have single quotes in your $url variable,
>but I don't think that PHP behaves like perl in letting you use
>whichever delimiter you choose.  Try replacing the single quotes with
>forward slashes.
>
>Additionally, if you're only doing a simple string substitution, you
>should use str_replace instead:
>
>  http://php.net/str_replace
>
>You won't need the "/" delimiters, and it will be faster than using
>preg_replace.
>
>joel
>
>
>

--
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] preg_replce ' for use with mysql

2004-01-20 Thread craig
> How do I replace all ' with \' in php so that I'm able to use 
> the mysql
> queries. Note that simply using: preg_replace("/'/", "\'", 
> -1) is not what
> I'm looking for, for this does not help me. Let's say I take 
> the address
> from a form and want to enter it into the database as it is. 
> Now, if the
> user enters "'" the above preg_replace will work but if the 
> user himself
> enters "\'" , during replacing, the '\' introduced is nulled 
> by the effect
> of the preceeding back-slash, and the mysql query becomes 
> somthing like:
> mysq_insert ("insert into students (id, address) values (3, '\\'')");
> 
> How do I get around this problem? Is there any function which helps
> to insert everything into the mysql database as it is (does 
> auto-escaping).

Couldn't be simpler, just use mysql_escape_string. It escapes a string 
for use in a mysql_query.

-craig 

> Nirnimesh.
> IIIT-Hyd.
> India.
> 
> -- 
> 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] Flash .swf outside webroot: width and height problems

2004-01-20 Thread craig
Thx for the fast response.
>
> Yes, I am doing that with the images... works fine. I also
> thought about
> using either an iframe or a div to control the size of the
> movie. It would
> have been nicer to be able to use a regular object tag, as it
> gives you more
> control over how the movie displayed.
>
> But I guess you can't write the tag and just do a  VALUE="show.php?id=xy" etc. and have the show.php output the header...
>
> May have to go for the div/iframe solution. If anyone can
> think of another
> way, I'd be happy to try it.

I have a couple of pages that are sprinkled with flash, this is how I
got it to
work (from the macromedia site)
-sorry for the bad word wrapping

http://download.macromedia.com/pub/shockwave/cabs/flash/swflas
h.cab#version=6,0,29,0" width="200" height="640">
   
   
   http://www.macromedia.com/go/getflashplayer";
type="application/x-shockwave-flash" width="200" height="640">


hope that helps,
Craig

> Thank you, John.
>
> toby
>
> - Original Message -
> From: "CPT John W. Holmes" <[EMAIL PROTECTED]>
> To: "Toby Irmer" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, January 20, 2004 7:12 PM
> Subject: Re: [PHP] Flash .swf outside webroot: width and
> height problems
>
>
> > From: "Toby Irmer" <[EMAIL PROTECTED]>
> >
> > > I am trying to display an .swf-file that is stored
> outside the webroot.
> > >
> > > Just sending the header and doing a readfile on the swf
> results in the
> swf
> > > being displayed with the maximum available width and height.
> > >
> > > Does anyone know a way of displaying Flash with its
> correct dimensions
> if
> > it
> > > is stored outside the webroot?
> >
> > Do you just have a "flash.php" file that sends the flash
> headers and data?
> > If so, then there's probably not a way just using that method.
> >
> > You can embed it within a HTML page, though, maybe inside a
> div to control
> > the size?
> >
> > 
> > 
> > 
> >
> > Obviously not the correct syntax b/c I don't know it, but
> you get the
> idea,
> > I hope... This is the same method you'd control the height
> and width of a
> > PHP generated image
> >
> > 
> >
> > ---John Holmes...
> >
> > --
> > 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] textfields showing php tags & code

2004-01-21 Thread craig
Hi All,
This one has me stumped, it worked yesterday, but not today,
and I didn't change anything (as far as I know).

This is some of the code from a function which is now showing the
 code inside the textareas, rather than
the passed value from the function call.

any ideas are greatly appreciated.

Craig

function showForm($quantity='', $fname='', $lname='') {
 ?>
   
 
  
   Quantity:
   *

  
   First Name:
   *

  
   Last Name:
   *

  
   
 http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and if statement if a page isnt there using iframes

2002-04-18 Thread Craig

i am using iframes to display a page within a page
the iframe is named and the page is dynamic
the iframe displays a page using generated php.

is there a way of using php to redirect to "nopage.php" if the page does not
exist?



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




[PHP] Re: PHP editor for windows

2002-04-22 Thread Craig

the new ultradev (MX) contains what you need
there is a trial download on the macromedia site


"Julio Nobrega Trabalhando" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> www.phpide.de
>
>   It's called PHP Coder. Don't get the versions by Maguma (last time I
used,
> it was buggy). Instead, go to older downloads and get the PHP Coder file
> named phpide-r2p3setup
>
> --
>
> Julio Nobrega.
>
> Um dia eu chego lá:
> http://sourceforge.net/projects/toca
>
> Ajudei? Salvei? Que tal um presentinho?
> http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
>
>
> ".Ben" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Other than notepad, interdev, ultraedit, etc (which i currently use for
> > editing), does anyone know of a good editor for PHP for Windows, ideally
> > with syntax colouring, etc?
> >
> > Cheers,
> >
> >  .ben
> >
>
>



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




[PHP] Displaying dates

2002-04-25 Thread Craig

How can i display a dynamic page showing last month and next month and the
month before

eg
this moth is 
how do i add 1 to the month or -1 to the month?



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




[PHP] Re: Need help with File Upload

2002-04-25 Thread Craig

have you included the MAX_FILE_SIZE hidden field?
If yes try increasng the value to above the image size
"Walter Enzenhofer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi there,
>
> i´m sorry to post that stupid message, but i really need help in finding
the
> solution to a maybe small problem.
>
>
> I´m trying to do a simple file upload (jpeg) with the "copy" function.
> the destination directory is set to chmod 0777, the files are copied to
this
> directory (with the correct extension .jpg), but if i try to open them,
the
> files seem to be corrupt. (the filesize seems to be o.k.). i tried several
> upload-scripts to test the situation, but the result is everytime the
same.
>
> on my test-server, i´m running Yellow Dog Linux (PPC) with PHP4.0.4pl1.
> I tried the uploads from different browsers.
>
>
> Can anybody pls help me find the bug ??
>
>
> thanx
>
> best regards,
>
> walter
>



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




[PHP] If value is divisible by 2

2002-04-30 Thread Craig

I am trying to write an if statement that says if the value $foo is
divisible by 2 then echo "text"

i have tried mod but it isnt recognised

any ideas?




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




[PHP] Page Numbers

2002-04-30 Thread Craig

Any one know how to display, go to page number on a record list page

eg





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




[PHP] Re: Getting only 255 chars from SQL Server

2002-05-13 Thread Craig

Varchar can only be set to a maximum of 255
Try setting the column  to long text
"Unknown Sender" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have an SQL Server database running on a server on the internet. I
> need to have php connecting to the db and returning values. Simple
> stuff. No problem making the connection and getting data using the mssql
> functions. The weird thing is that 4 of the fields in the table are
> vchar fields of length 800. When getting the data from the db for the
> web page, all that gets returned are the first 255 characters of each
> field. If I use a SQL client to check the db, I see that all 800
> characters are there. And if I use ASP pages I can get all 800
> characters returned on the web page, but using php only gets the first
> 255. I used some php column length functions on the page and it shows
> those 4 fields as length 255.(??)
> Am I missing something? Does php have a limit on the number of
> characters returned from a field? I can use ASP to write the pages I
> guess, but I don't know why php wouldn't work.
>
> Thanks,
> Dave
>



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




[PHP] Looking for web based email

2002-05-17 Thread Craig

I am in the process of developing a website with a webmail system similar in
functions to hotmail
Does anyone have any suggestions for where to start?

thanks

craig



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




Re: [PHP] Looking for web based email

2002-05-17 Thread Craig

Thanks, I have a few to play with now


"Dan Hardiker" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I use http://www.squirrelmail.org/ ... Im actually currently mailing you
> from it - I find it very easy, and extreemly configurable. Its open source
> and developing at a rate of knotts.
> Its very easy to install, although it does currently require cookies...
> but Im urging them to shy away from that ;)
> - Dan
>
> > http://nocc.sourceforge.net/
> > -Jared
> >
> > -Original Message-
> > From: Craig [mailto:[EMAIL PROTECTED]]
> >
> > I am in the process of developing a website with a webmail system
> > similar in functions to hotmail
> > Does anyone have any suggestions for where to start?
>
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
>
>



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




[PHP] email password and username

2002-03-20 Thread Craig

I am trying to create a system where a user can retreive there user name and
password details.

The problem is that the user name /password is in one table and the contact
details are in another. The contact details are refrenced to the username.

I want to acheive the following:
1. A user enters their email address into a form
2. The form submits to the database
3. The form checks the email and picks up the username / password
4. An email is sent to the relevant address with the password details

Can this be done? If so how??

Any comments will be grateful



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




[PHP] File Upload

2002-03-26 Thread Craig

I have developed a file upload facility that allows a user to upload a html
file to a site.
Is there a way to also upload images within the page without creating
several file uploads. The images vary between 0 and x .
Any help would be grateful
Craig



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




[PHP] Re: which php book 2 buy ?

2002-03-26 Thread Craig

php and mysql web development
ISBN 0-672-31784-2

Its got a good example of a php shopping cart system in it too


"Septic Flesh" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I wanna buy a book from amazon . . .but don't know which one..
> Do you know where I will find examples of shopping carts ? (which book ?)
>
> thanks..
>
>
> --
> 
>
> Sapilas@/dev/pinkeye
>
> 
>
>



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




[PHP] Re: PHP- something i don't undestand

2001-07-18 Thread craig

Do it like this

$sqry_linx = mysql_query("SELECT * FROM linx ORDER BY 'linkcat'");

$link = mysql_fetch_array($sqry_linx);

"Yassel Omar Izquierdo Souchay" <[EMAIL PROTECTED]> wrote in message
001c01c10eff$1235ce50$2401020a@yois">news:001c01c10eff$1235ce50$2401020a@yois...
> Hi
> I'm having
> trouble with  this part of code
>
> 9:   $result = mysql_db_query("users", $query);
> 10: $r=mysql_fetch_array($result);
>
> The error message is :
> Warning: Supplied argument is not a valid MySQL result resource in
> c:\inetpub\wwwroot\PhpAndMysqlTest\test2\reg1.php3 on line 9.
>
> Please if somebody knows what it's wrong
> thanks
> Yassel
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Parse error: parse error, unexpected '='

2004-04-20 Thread Craig



"Lasse Motroen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have received some code and am trying to run it. However, I get the
> following error:
>
> *Parse error*: parse error, unexpected '=', expecting ')'
>
> It happens on this line when &$args=array() is reached:
>
> function array_key_remove(&$args=array(), $keys=array(),$replacement=NULL)
>
> I have php-4.2.2-17 and Apache 2.0.40 installed, and am runnig RedHat 9.
> What's wrong, please help.
>
> Regards,
> not-really-too-familiar-with-PHP

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



[PHP] Re: $PHP_SELF problem

2004-04-20 Thread Craig
http://ie.php.net/globals

Instead of $PHP_SELF use $_SERVER['PHP_SELF']

Craig


"Red Wingate" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> [EMAIL PROTECTED] wrote:
>
> > Hi
> >
> > $thisFileName = $PHP_SELF; works in a file just a few lines after the
> > program start.
> >
> > $thisFileName = $PHP_SELF; doesn't work (echo ("Debug: self:
> > $PHP_SELF"); returns Debug: self: ) if it's within function
> > getNavigation() in the Navigation object called by another program.
> >
> You better check the docs on 'global' and $GLOBALS :-)
>
> -- red
>
> > Why?
> >
> > The Navigation object is called like this:
> > include ("Navigation.php4");
> > $myNavigation = new Navigation ("a", "b");
> > $myNavigation->getNavigation();
> >
> > I guess I'm asking $PHP_SELF something confusing. Does it respond
> > "index.php4" which is where the above three lines reside, or
> > Navigation.php4 which is where the actual $PHP_SELF resides.
> >
> > All help appreciated :-)
> >
> > Cheers
> > J

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



[PHP] Re: strange urlencode/decode problem

2004-04-21 Thread Craig
http://ie.php.net/manual/en/function.get-magic-quotes-gpc.php

use stripslashes() :



Cheers



"Victor spång arthursson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Perhaps I'm tired, perhaps I've missed something obvious, but I can't
get this simple thing which I practically does every week to work…

Ok, here is what I do:

Click here to test';

?>

I sidan foo.php skriver jag:



and gets the result:

Delete from whatever where ditten = \'datten\'

The question is why PHP escapes the single qoutes? This has never
happened to me before, except if I have been using addslashes() or
similiar functions…

And they occur even if I don't urlencode at all…

Why!?!?!?!?

Sincerely

Victor Spång Arthursson - Copenhagen

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



[PHP] Re: Form Data Transfer b/w Pages

2004-04-21 Thread Craig
For ease of use, i would create a session and handle it that way or you
could pass it through $_GET[]
Query string.
Would recommend $_SESSION though.
Cheers

"Sobajo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Two forms (form1 and form2 submit to the same controller.php file. The
> controller redirects the page depending on the value of hidden value
> 'page'. I want form data 'username' and 'password' to be available on
> both redirected pages (staff.php and customer.php). How do I accomplish
> this?
>
> 
> 
>
>
>
>
> 
>
> 
> 
>
>
>
>
> 
>
>//controller.php
>   header("Location: http://"; . $_SERVER['HTTP_HOST']
>  . dirname($_SERVER['PHP_SELF'])
>  . "/"
>  . $_POST["page"]);
> ?>
>
>//user.php
>   echo "Staff Name = " . $_POST["username"];
>   echo "Staff Password = " . $_POST["password"];
> ?>
>
>
>//customer.php
>   echo "Customer Name = " . $_POST["username"];
>   echo "Customer Password = " . $_POST["password"];
> ?>

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



[PHP] Re: adding -'s to a numeric string

2004-04-21 Thread Craig
Something like this would work:
=



"Adam Williams" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi, I have a form where I have a user entering in the date in a numeric
> string.  For today they would enter 04212004 and so on...I'm working on
> this date within mysql server, and mssql server handles dates as
> 04-21-2004 when you use convert(varchar,field,110).  So how in PHP can I
> change a variable's value which is 04122004 into 04-21-2204
>
> thanks!

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



[PHP] Re: Remove white space?

2004-04-23 Thread Craig
trim($YOUR_VARIABLE) = Remove whitespace from beginning and end of string
http://ie2.php.net/trim

strtolower($YOUR_VARIABLE) = Makes a string lowercase
http://ie2.php.net/strtolower

Hope that helps



"Robert Sossomon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am pulling data from a MySQL DB and I need to remove the whitespace on
> the variable and turn it to lowercase.
>
> 
>
> $get_items = "select * from PFS_items";
> $get_items_res = mysql_query($get_items) or die(mysql_error());
> while ($items = mysql_fetch_array($get_items_res))
> {
>  $item_id = $items[id];
>  $item_num = $items[item_num];
>
> 
>
> Overtime I need to rewrite my DB loading script to handle this for me,
> but right now I need to band-aid it so that I can auto-generate pages
> and get them loaded into a catalog.
>
> Thanks!
>
> Robert

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



Re: [PHP] Button ???

2004-04-23 Thread Craig
This has nothing to do with PHP.

Its javascript, http://www.jguru.com/faq/view.jsp?EID=280434
Please keep to topic.

Thanks

"Brent Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> > Something like this:
> >
> > 
>
> Hi
>
> Yes this is correct
> But how do you get it from an active to disabled state
>
> Kind Regards
> Brent Clark

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



[PHP] Re: insert twice pb

2004-04-23 Thread Craig
Try this and see what happens:




"Ronald Rahal" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Why this code is inserting twice in the database ?
>
>
>
>
>   if (   (isset($_POST['empfullname'])) && (isset($_POST['empmidname']))
> && (isset($_POST['empbdate']))
>  && (isset($_POST['emptitle']))&& (isset($_POST['departement']))  )
>  {
>  $empfullname=$HTTP_POST_VARS['empfullname'];
>  $empmidname=$HTTP_POST_VARS['empmidname'];
>  $empbdate=$HTTP_POST_VARS['empbdate'];
>  $empjobtitle=$HTTP_POST_VARS['emptitle'];
>  $empdepartement=$HTTP_POST_VARS['departement'];
>
>  $insert="insert into employee values
> ('','$empfullname','$empmidname','$empbdate','$empjobtitle','$empdeparte
> ment','','')";
> $exec=mysql_query($insert);
> if(!$exec)
> die("Unable To Insert Into Employees Due To An
> Error");
>
> }
>
>  ?>
>

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



[PHP] Re: WDDX

2004-05-17 Thread Craig
take a look on http://www.phpclasses.org

Good luck,
Craig

"Dave Avent" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
>
> Does anyone know if there is a WDDX Class for PHP. I have googled and
> checked phpclasses.org. I am unable to recompile my webserver so I cannot
> include wddx support that way, so if anyone can help me with any
suggestions
> I would be very gratefull
>
> Cheers
>
> Dave

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



[PHP] Re: Distance and info

2004-05-19 Thread Craig
Probably useing something like this, not altogether sure.
http://www.maxmind.com/geoip/

"Brent Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all
>
> I have a question regarding phpclasses.org.
>
> There is a section, where is says, "Find the closest mirror".
>
> My question is, does anyone know how do they determine the distance (Sits
on
> the right of the screen) and also
> the details for "Your approximate location".
> Cause its pretty acurrate.
>
> Kind Regards
> Brent Clark

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



[PHP] Re: send mail error

2004-05-20 Thread Craig
On windows I believe this will work:

ini_set("sendmail_from",[EMAIL PROTECTED]);

Try that. http://www.php.net/ini_set

HTH

Craig

"Tassos T" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hello,
>
> i  face a problem with send mail via php.
> i have a server with ms IIS and i have not access to php.ini
> how i send a email with php script with auto add the sendmail_from into
> php.ini ?
>
> PS. i write a php script to send email but i receive the follow error
> message
>
> mail(): "sendmail_from" not set in php.ini or custom "From:" header
> missing in *...
>
>
> *please advise
>
> Thanks
>
> Tassos

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



[PHP] Re: Simple MySQL/PHP Query

2004-05-20 Thread Craig
Is the text the same on every page?

Where you print your body, concatenate the string you want to your content
variable.

HTH



"Nick Wilson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> First off, yeah, it's a dumb Q ;-) but I cant remember enuf about mysql
> to know if I need a php script or it might be done from the command
> line...
>
> I have a DB that has a field called 'body' -> it holds the body of html
> pages of course... What I need to do, is add to the very end of each
> html page, one short peice of text.. not a footer, just an adition to
> every page.
>
> How do I do that? - Do I need to select the body, then add the text to
> it, then UPDATE it, or can i just appened somthing to what's already
> there?
>
> Many thx!
> -- 
> Nick W

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Constants are useful when a variable will remain exactly the same (constant)
through
the life of a script.  e.g a script I wrote to calculate dates be it in the
past or future
would have constant values for how many seconds are in a day or a week. to
be used
in calculations.
e.g:

define("SECONDSINWEEK", 604800); // Number of seconds in week
 define("SECONDSINDAY", 86400); // Number of seconds in day
 $iDayOfWeek = 1; // 0 to 6 - 0 being Sunday
 $iNumWeeks = 12; // Number of weeks to lookback
 $iOffsetTimestamp = 0; // Initialize this var
 $iCurTime = time();
 $iCurDay = date("w", $iCurTime);

^^^ The above constants will always be what they are defined as. Constant
:-)
Also another advantage of using constants, is that it can make your code
easier
to read. Usually constant names are declare in uppercase, which helps to
break
up your code.

HTH

Craig



"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone explain to me the value of using defined custom constants,
> in the context of good coding practice.
>
> I don't recall ever seeing define() used in the scripts I've seen and
> only the characteristics are described in the my php book and the php
> manual; but, not the use.
>
> Thanks.

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Have a look here also: http://ie2.php.net/define


"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone explain to me the value of using defined custom constants,
> in the context of good coding practice.
>
> I don't recall ever seeing define() used in the scripts I've seen and
> only the characteristics are described in the my php book and the php
> manual; but, not the use.
>
> Thanks.

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
yes, constants have global scope also :-)

"Craig" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Have a look here also: http://ie2.php.net/define
>
>
> "Al" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Can someone explain to me the value of using defined custom constants,
> > in the context of good coding practice.
> >
> > I don't recall ever seeing define() used in the scripts I've seen and
> > only the characteristics are described in the my php book and the php
> > manual; but, not the use.
> >
> > Thanks.

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



[PHP] Re: Simplistic PHP tutorial

2004-05-25 Thread Craig
Personally I would buy a book on programming in general or maybe just go
straight for a
PHP beginners book.

But this is pretty straight forward from the ground up:
http://www.w3schools.com/php/default.asp

HTH
Craig

"Neal" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I've looked at the php.net tutorial, and though I'm learning some things
>  from it, it's still a bit over my head. It seems to presuppose a comfort
> level with programming which I do not have.
>
> Can anyone recommend a simple, hand-holding, introductory tutorial
> suitable for someone with no programming experience to speak of?

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



[PHP] Re: Now I can't start the session either...

2004-05-25 Thread Craig
Can you post your whole file?


"Brian Dunning" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Here is the top of my file:
>
>  // Start the session
> session_start();
>
> Which looks OK to me, but it returns:
>
> Parse error: parse error, unexpected T_STRING in
> c:\inetpub\wwwroot\palms\htdocs\start-selling.php on line 3
>
> What's going on here??
>
> - Brian

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



[PHP] Re: Now I can't start the session either...

2004-05-25 Thread Craig
It doesnt necessarily mean the error occured on that line, that may have
been the last executed statement
post a few more lines or we cant help you.

Regards


"Craig" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can you post your whole file?
>
>
> "Brian Dunning" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Here is the top of my file:
> >
> >  > // Start the session
> > session_start();
> >
> > Which looks OK to me, but it returns:
> >
> > Parse error: parse error, unexpected T_STRING in
> > c:\inetpub\wwwroot\palms\htdocs\start-selling.php on line 3
> >
> > What's going on here??
> >
> > - Brian

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



Re: [PHP] Re: test

2004-05-26 Thread Craig
Yeah those damn email always come at same time.
Well on my blocked list now.


"Jordi Canals" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sherri wrote:
> > Woah!
> >
> > Signed up litterally 1 minute ago and I'm already getting spam. From
> > "Advance Credit Suisse Bank"
> >
> Just wait. There are some more waiting for you ;) You should receive the
> "Information Desk" and "Ingram Computer Services" mails yet.

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



Re: [PHP] Re: clearing new pages

2004-05-27 Thread Craig
\n";
?>

Is another option

Craig

"Rick Fletcher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > > Hi,
> > >  a file called a.php prints "hello" to the browser then calls
> > > b.php which prints "goodbye" to the browser.
> > > the output looks like this:
> > >
> > > hello
> > > goodbye
> > >
> > > how do I clear the screen so the end results looks like this:
> >
> > a.php:
> >
> > echo 'hello';
> > header('location: b.php'); exit;
>
> That actually wouldn't work, because once there's output ("echo") you
can't
> send a header.
>
> --Rick

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



[PHP] Re: combining string values

2004-05-27 Thread Craig
Concatenate using: .



HTH

Craig

"Tommy Atherton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hi
>
> I have a problem, I'm trying to combine the value of two strings
> together into a final string. For example
>
> $path = '/tmp/photos/';
> $filename = 'pic1.jpg';
>
> $finalvalue = $path + $filename; (I know that the + is not used its
> there for explanation only)
>
> The value for path will remain constant (for the time being at least
> although) but the value for filename will be read from a database so
> that will change.
>
> Anyone care to help???
>
> thanks in advance
>
> Tommy
>
>
>

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



[PHP] Re: Simple calender

2004-05-31 Thread Craig
Ryan,

with a bit of tweaking you can edit that script to what you want.
heres an example

=
";

 $calendar_html .= "" .
   $month_name . " " . $year . "";

   $calendar_html .= "";
   $calendar_html .= "S";
   $calendar_html .= "M";
   $calendar_html .= "T";
   $calendar_html .= "W";
   $calendar_html .= "T";
   $calendar_html .= "F";
   $calendar_html .= "S";
   $calendar_html .= "";

 $calendar_html .= "";

 //Fill the first week of the month with the appropriate number of
blanks.
 for($week_day = 0; $week_day < $first_week_day; $week_day++)
{
$calendar_html .= " ";
}

 $week_day = $first_week_day;
 for($day_counter = 1; $day_counter <= $days_in_this_month;
$day_counter++)
{
$week_day %= 7;

if($week_day == 0)
   $calendar_html .= "";

   $dispDate = $day_counter . " " . $month_name . " " . $year;

//Do something different for the current day.
if($day == $day_counter)
   $calendar_html .= "" . $day_counter . "";
else
   $calendar_html .= "" .
 $day_counter . "";

$week_day++;
}

 $calendar_html .= "";
 $calendar_html .= "";

 return($calendar_html);
 }


echo calendar(NULL);

?>
=


"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hey,
>
> been looking at a lot of calenders most of them are either too big for my
> use (whole page), not free, in javascript or  too complicated.
>
> I require a calender that is simple, loads fast,small and not javascript,
> the closest I found is at:
> http://scripts.franciscocharrua.com/calendar.php
>
> just two problems with it,
> 1. It does not have the days on top (eg: s,m,t,w,t,f,s - sunday,
> mondayetc)
> 2. (not required but would be nice if it would) allow me to link from the
> days of the calender to some page/s
>
> I guess I could modify the above calender as it pretty good + open
> source...but if anybody is using a calender already which is like the
above
> + the 1 or two points I wroteyour response would be appreciated. ;-)
>
> Thanks,
> -Ryan

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



[PHP] Re: duplicating a row

2004-05-31 Thread Craig
http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html


"Bob Lockie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I want to duplicate a row (back it up - copy to a table with the same
> schema) regardless of the table schema.
> This in MySQL but I need a solution that can be made easily portable to
> other databases.

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



[PHP] random alphanumeric value generator

2004-01-26 Thread craig
Hi,

I am trying to generate a non-sequential random alphanumeric value. 
Just to make things fun, I need to guarantee that each value is unique.

I have a working solution, but it seems retarded to me because there
is a small chance that 2 people might hit the same page at the same 
time, do separate inserts, but both get the same MAX(uiIndex) value.
Is there a  better way to do this?

TIA,
Craig

table defn:
create table randomKey (
   uiIndex int unsigned auto_increment not null primary key,
   cKeychar(20) unique
);

function getKey() {
   //get random number into db. it is guaranteed 
   //unique from db once result = true because 
   //cKey is unique
   $query = 'INSERT INTO randomKey (cKey) VALUES (RAND())';
   while (!$result = mysql_query($query, dbConnect($errorMsg))) { 
  //do nothing, just loop until result = true
   }  

   //now get the random number, and MD5 it to get it alphanumeric
   $query = 'SELECT MAX(uiIndex), cKey FROM randomKey GROUP BY cKey';
   $result = mysql_query($query, dbConnect($errorMsg));
   $row = mysql_fetch_object($result);
   return md5($row->cKey);
}

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



[PHP] SOLVED: [PHP] random alphanumeric value generator

2004-01-26 Thread craig
I love this list!

That's perfect! I was able to simplify the function down even more.

Thanks a lot,
Craig

> -Original Message-
> From: Matt Matijevich [mailto:[EMAIL PROTECTED]
> Sent: January 26, 2004 4:01 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] random alphanumeric value generator
> 
> 
> because it is MySQL, couldn't you just use mysql_insert_id
> http://www.php.net/manual/en/function.mysql-insert-id.php instead of
> this:
> 
>//now get the random number, and MD5 it to get it alphanumeric
>$query = 'SELECT MAX(uiIndex), cKey FROM randomKey GROUP BY cKey';
>$result = mysql_query($query, dbConnect($errorMsg));
>$row = mysql_fetch_object($result);
> 
> use this
> 
>   return md5(mysql_insert_id());
> 
> 
> 

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



RE: [PHP] random?

2004-01-29 Thread craig

> Maybe MySQL's RAND() function isn't very random.
>

>From the mysql manual:

RAND() is not meant to be a perfect random generator, but instead 
a fast way to generate ad hoc random numbers that will be portable 
between platforms for the same MySQL version. 

doesn't help, but at least you know you're not imagining things ;)

-Craig

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



RE: [PHP] eregi_replace help needed

2004-01-29 Thread craig


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: January 29, 2004 8:53 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] eregi_replace help needed
> 
> 
> Hi,
> 
> I want to locate patterns such as
> 
> 12345678
> 1 23 45 67 89
> 1 2 34 567 890
> 
> and replace the pattern string with a new string.
> 
> I tried
> 
> $filter['message'] = eregi_replace("[0-9\s]{4,}",' replaced>', $filter['message']);
> 
> but it does not work on all the above examples.
> 
> Thanks for the assistance!
> 
> Nico
> 

off the top of my head, I don't think '\s' is valid in a character
class, so just use ' ' instead 

try  eregi_replace("[0-9 ]{4,}"

-Craig

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



RE: [PHP] Encoding for uploaded files

2004-01-29 Thread craig
check out http://www.php.net/manual/en/features.file-upload.php,
it spells out the entire upload process

specifally, you want:
$_FILES['userfile']['type'] = The mime type of the file, if 
the browser provided this information. An example would 
be "image/gif". 

-Craig

> -Original Message-
> From: Cesar Cordovez [mailto:[EMAIL PROTECTED]
> Sent: January 29, 2004 10:35 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Encoding for uploaded files
> 
> 
> Hi list!
> 
> How can I know the encoding for an uploaded file?
> 
> 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] transactions

2004-01-29 Thread craig
 > Is there anyway to do something similar to Transactions in mysql?

Yes, use transactions

http://www.mysql.com/doc/en/Transactional_Commands.html

-Craig

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



RE: [PHP] Encoding for uploaded files

2004-01-29 Thread craig
> I don't know if you are right here, or maybe I don't understood 
> correctly... the file type is actually the encoding of the 
> file?  If a 
> file type is text/plain, where is the encoding format?  ISO-8859-1?
> 
> Puzzled!

sorry, I misunderstood the question.
I have no idea of how to get the actual encoding. =(

-Craig

> 
> Cesar
> 
> craig wrote:
> 
> > check out http://www.php.net/manual/en/features.file-upload.php,
> > it spells out the entire upload process
> > 
> > specifally, you want:
> > $_FILES['userfile']['type'] = The mime type of the file, if 
> > the browser provided this information. An example would 
> > be "image/gif". 
> > 
> > -Craig
> > 
> > 
> >>-Original Message-
> >>From: Cesar Cordovez [mailto:[EMAIL PROTECTED]
> >>Sent: January 29, 2004 10:35 AM
> >>To: [EMAIL PROTECTED]
> >>Subject: [PHP] Encoding for uploaded files
> >>
> >>
> >>Hi list!
> >>
> >>How can I know the encoding for an uploaded file?
> >>
> >>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] Re: How check credit card or magnetic card number.

2004-02-02 Thread craig
>   Hi, how i can check credit card or magnetic card number for
> a site of
> electronic commerce that i have to design.
>
> Sorry for my english.
>
> Pedro.
>

I think this should work for you, but it's not production tested yet.

-Craig

function verifyCC($name='', $type='', $number='', $expmonth='',
$expyear='') {
   //make sure all fields are filled in
   if (empty($name) || empty($type) || empty($number) || empty($expyear)
|| empty($expmonth)) {
  return FALSE;
   }

   //verify month makes sense
   if(!is_numeric($expmonth) || $expmonth < 1 || $expmonth > 12) {
  return FALSE;
   }

   // Get the current year
   $currentYear = date('Y');
   expyear = '20' . $expyear;
   settype($currentYear, 'integer');

   //verify year makes sense
   if (!is_numeric($expyear) || $expyear < $currentYear || $expyear >
$currentYear + 10) {
  return FALSE;
   }

   //strip out non-numeric numbers from number
   $number = preg_replace('/[^0-9]/', '', $number);
   $type = strtolower($type);

   //check length and prefix of number
   if ($type == 'mastercard' || $type == 'mc') {
  $validFormat = ereg("^5[1-5][0-9]{14}$", $number);
   }
   elseif ($type == 'visa') {
  $validFormat = ereg("^4[0-9]{12}([0-9]{3})?$", $number);
   }
   elseif ($type == 'amex' || $type == 'american express') {
  $validFormat = ereg("^3[47][0-9]{13}$", $number);
   }
   elseif ($type == 'diners club' || $type == 'dc' || $type = 'diners')
{
  $validFormat = ereg("^3(0[0-5]|[68][0-9])[0-9]{11}$", $number);
   }
   elseif ($type == 'discover' || $type == 'disc') {
  $validFormat = ereg("^6011[0-9]{12}$", $number);
   }
   elseif ($type == 'jcb') {
  $validFormat = ereg("^(3[0-9]{4}|2131|1800)[0-9]{11}$", $number);
   }
   else {
  return FALSE;
   }

   if (!$validFormat) {
  return FALSE;
   }

   //do mod 10 algorithm
   $revNum = strrev($number);
   $sum = 0;

   for($i = 0; $i < strlen($revNum); $i++) {
  $currentNum = substr($revNum, $i, 1);

  //double every second digit
  if($i % 2 == 1) {
 $currentNum *= 2;
  }

  //add digits of 2-digit numbers together
  if($currentNum > 9) {
 $firstNum = $currentNum % 10;
 $secondNum = ($currentNum - $firstNum) / 10;
 $currentNum = $firstNum + $secondNum;
  }

  $sum += $currentNum;
   }

   //check if there's a remainder
   if ($sum % 10 <> 0) {
  return FALSE;
   }

   return TRUE;
}

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



[PHP] problem referencing a mysql object

2004-02-04 Thread craig

Hi,

the problem is that I am trying to use a varible in the objects
attribute name. the offending line of code is:

echo "";

this is giving the warning:
Undefined property:  cPic 

I have tried playing with eval and variable variables to 
get 'cPic$count' to look like 'cPic1' before trying to
use it, but nothing is working. There has to be a way
to do this. Any help is greatly appreciated.

-Craig

while ($row = mysql_fetch_object($result)) {
   //other code...
   $count = 1;
   while ($count <= $row->tiPicCount) {
  echo "";
  ++$count;
   }
   //other code...
}

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



RE: [PHP] Need a way to automate user logout

2004-02-05 Thread craig
> I can write a script in
> perl, php, java, u name it, but how do I have it run on a set
> schedule?
> Thanks
>
> Christian

you will want to use the cron command. run 'man cron' at a shell prompt
to
get the manual page that will explain the finer points. =)

HTH,
Craig

> --
> 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-general list question - [Fwd: Delivery Report (failure) forphp-general@lists.php.net]

2004-02-05 Thread craig

> I get one of these for almost every message I send, usually
> with a delay
> of a few days and always the same error.  I see my posts come from the
> list to me and I see people replying to my messages so the
> list seems to
> be processing my posts.  It's annoying however to keep getting these.
> Anybody else getting this?
>

Yeah, I am getting bundles of these as well...

-Craig

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



RE: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread craig
> Hi,
>
> I have some check boxes in a form and when the form is
> submitted I read the
> checkboxes that have been ticked. However if no checkboxes
> have been ticked
> the following line produces an error, is there a way to suppress this?
>
if (is_array($project))
> foreach ($project as $project_id => $value) {
>   $fields[] = $project_id;
>   $values[] = $value;
> }
>

if (is_array($project))
  foreach ($project as $project_id => $value) {
$fields[] = $project_id;
$values[] = $value;
  }
}

HTH,
Craig

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



RE: [PHP] Surpressing a 'foreach' Error Message

2004-02-06 Thread craig
 > craig <mailto:[EMAIL PROTECTED]>
> on Friday, February 06, 2004 2:24 PM said:
> 
> > if (is_array($project))
> >   foreach ($project as $project_id => $value) {
> > $fields[] = $project_id;
> > $values[] = $value;
> >   }
> > }
> 
> you're missing a curly brace after the if ().
> 

my bad, that's what you get when you don't actually
run the code. Thank god for compilers ;)

-Craig

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



[PHP] triple DES encryption

2004-02-09 Thread craig
Hi all,
I have to replicate the file encryption of a desktop bound
application. This means using triple DES, but I can't find 
anything on the web or in the maunual (other than single 
DES).

Does anyone know if it is doable to implement this using php, 
or if I should just tell the client that it can't be done?

TIA,
Craig

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



RE: [PHP] triple DES encryption

2004-02-09 Thread craig
Thanks, I wasn't looking for 3DES.

That should do the trick for me.

Craig

> -Original Message-
> From: Adam Bregenzer [mailto:[EMAIL PROTECTED]
> Sent: February 9, 2004 10:36 AM
> To: craig
> Cc: Php
> Subject: Re: [PHP] triple DES encryption
>
>
> On Mon, 2004-02-09 at 12:36, craig wrote:
> > Hi all,
> > I have to replicate the file encryption of a desktop bound
> > application. This means using triple DES, but I can't find
> > anything on the web or in the maunual (other than single
> > DES).
>
> The mcrypt[1] module will do triple DES as well as stronger encryption
> methods.  In the manual it is referred to as 3DES.
>
> [1] http://www.php.net/mcrypt
>
> --
> Adam Bregenzer
> [EMAIL PROTECTED]
> http://adam.bregenzer.net/
>
> --
> 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] mycrypt 3des (php vs .net)

2004-02-13 Thread craig
Hi all,

I am truly hoping that someone can help with this.
I am making the ecommerce site for a product that
I had nothing to do with the development of. =)

The product is making a licence file using  the .net
3des, but I am not able to get the same output using
the mcrypt 3des.

this is the .net original text and the cipher text:
Golf Genie 5.0
ª:b•#–æaŒž"[EMAIL PROTECTED]">#p0, 7

this is what i get
¿^U`ÎdÀ4`oãõwÑî%  - from Golf Genie 5.0
¿^U`ÎdÀ4!é$”GIø  - from Golf Genie 5.0\r\n


I don't know too much about encyrption, and I have found
the documentation of mcrypt to be the worst of any php
module I have yet used, so i'm not sure of the consequenses
of using cbc versus ecb are, etc.

here is the code i am using.

   $key =
"\x6B\x00\x64\x00\x4E\x00\x44\x00\x38\x00\x37\x00\x5E\x00\x21\x00";
   $input = "Golf Genie 5.0";
   $iv  = "\x2B\x00\x5F\x00\x65\x00\x6B\x00";

   $td = mcrypt_module_open ('tripledes', '', 'cbc', '');
   mcrypt_generic_init ($td, $key, $iv);
   $encrypted_data = mcrypt_generic ($td, $input);
   mcrypt_module_close ($td);

   echo  $encrypted_data;

ps. I can't use mcrypt_generic_deinit - i get 'Fatal error: Call to
undefined function: mcrypt_generic_deinit()... '

thanks in advance,
Craig

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



RE: [PHP] Re: mycrypt 3des (php vs .net)

2004-02-13 Thread craig
 > I am not sure if it will help of if you have already tried
> this but try
> all of the cipher modes available for the tripledes cipher (eg. cfb,
> ecb, etc.).  There may be a difference in the way .net and mcrypt
> produces the cipher text but if that were the case then it
> wouldn't be a
> true tripledes encryption for either the .net or mcrypt encryption
> libraries.  Are you able to view the source of the .net code which
> originally produced the cipher text?  If so then see what mode it is
> using with the tripledes cipher.  And you are right about the
> documentation, it took me awhile to get it working and even longer to
> figure out how it worked.  Good luck,
> Jas

I did check out the .net documentation and it uses cbc, but maybe I'll
try
the other modes for kicks.

-Craig
>
> Craig wrote:
> > Hi all,
> >
> > I am truly hoping that someone can help with this.
> > I am making the ecommerce site for a product that
> > I had nothing to do with the development of. =)
> >
> > The product is making a licence file using  the .net
> > 3des, but I am not able to get the same output using
> > the mcrypt 3des.
> >
> > this is the .net original text and the cipher text:
> > Golf Genie 5.0
> > ª:b•#–æaŒž"[EMAIL PROTECTED]">#p0, 7
> >
> > this is what i get
> > ¿^U`ÎdÀ4`oãõwÑî%  - from Golf Genie 5.0
> > ¿^U`ÎdÀ4!é$”GIø  - from Golf Genie 5.0\r\n
> >
> >
> > I don't know too much about encyrption, and I have found
> > the documentation of mcrypt to be the worst of any php
> > module I have yet used, so i'm not sure of the consequenses
> > of using cbc versus ecb are, etc.
> >
> > here is the code i am using.
> >
> >$key =
> > "\x6B\x00\x64\x00\x4E\x00\x44\x00\x38\x00\x37\x00\x5E\x00\x21\x00";
> >$input = "Golf Genie 5.0";
> >$iv  = "\x2B\x00\x5F\x00\x65\x00\x6B\x00";
> >
> >$td = mcrypt_module_open ('tripledes', '', 'cbc', '');
> >mcrypt_generic_init ($td, $key, $iv);
> >$encrypted_data = mcrypt_generic ($td, $input);
> >mcrypt_module_close ($td);
> >
> >echo  $encrypted_data;
> >
> > ps. I can't use mcrypt_generic_deinit - i get 'Fatal error: Call to
> > undefined function: mcrypt_generic_deinit()... '
> >
> > thanks in advance,
> > Craig
>
> --
> 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] Image Quality Depreciation with GD

2004-02-17 Thread craig

> Greetings, all.  I'm trying to upload and crop an image.  I'm 
> not able 
> to do it without the quality of the image suffering.  I've 
> fiddled with 
> the quality parameter in the imagejpeg function but it seems 
> to have no 
> effect.  I've tried varying values and leaving the parameter out 
> altogether.
> 
> Any pearls of wisdom out there?


if you are using imagecreate(), switch to imagecreatetruecolor().
I got a big improvement from that.

don't think it's a pearl, but I hope it helps,
Craig

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



[PHP] functions and session variables

2004-02-18 Thread craig
Hi,
I just want to verify something that seems counterintuitive
to me. Do you have to pass session variables to functions?
It would seem to me that they should be available anywhere.

I took a cursory look through the manual, but didn't see
anything relevant.

Thanks,
Craig

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



  1   2   3   4   >