[PHP] Get First 20 Characters of a Variable or Database Entry

2004-01-21 Thread Dimitri Marshall
Hi there,

How would I go about getting the first 20 characters of a varibale or
database entry. The situation is this, I created a calendar where users can
post events and on the date instead of just a number (the number of events
and the date), I would like to show the first 20-30 characters of the event
name. I could do the whole event name but it could get quite long.

Thanks,
Dimitri Marshall

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



[PHP] Problem with Picture Name

2004-01-06 Thread Dimitri Marshall
Hi there,

Here's the situation:

I had it perfect so that when someone uploaded a picture in a form, it
uploaded to my server and saved the image name etc. in the database. The
problem is, what if someone tries saving a picture with an apostraphe ie (
' ) or (  )? I know this isn't a usual format, and I tried htmlsecialchars
ENT_QUOTES but it still saves the picture name onto the server like such:
photo\#039;.jpg.

Can someone help me out?

Dimitri Marshall

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



Re: [PHP] simple php search

2003-12-05 Thread Dimitri Marshall

Sophie Mattoug [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Paul Duggan wrote:

 if I create a text box:
 
 body
 
 form action=nextpage.html method=GET name=myform
 
  input type=Text name=surname align=TOP size=25br
 
  input type=Submit value=Submit align=MIDDLE
 
 /form
 
 
 how do I go about extracting a surname from a mysql database?
 
 
 
 will it be something along the lines?
 
 select firstname,surname
 from employees
 where surname = textbox.surname;
 
 

 SELECT firstname, surname FROM employees WHERE surname =
 '{$_GET['surname']}'

You might also want to do it this way...

SELECT firstname, surname FROM employees WHERE surname =
\{$_GET['surname']}\

Just in case their name is something like O'Neil, it won't interfere with
your script.

Good luck,
Dimitri Marshall


 
 new to this so im trying to get my head around it, basically i just want
to
 search a mysql database by someones surname.
 
 cheers!
 
 
 
 

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



[PHP] in a Variable

2003-12-02 Thread Dimitri Marshall
Hi there,
I'm sure this is an easy fix, but how do you either prevent users from being
able to input   in a field or make it so that it doesn't affect the code?

Thanks in advance,
Dimitri Marshall

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



Re: [PHP] in a Variable

2003-12-02 Thread Dimitri Marshall
Sorry, what I mean is...

I have a field in a form where users input text.

If the user inputs something like: Hi there, this is a quote and you
should know it.

Then only... Hi there,  get's inserted because of the double quotes.

Is that more clear?

Dimitri Marshall


Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- Dimitri Marshall [EMAIL PROTECTED] wrote:
  how do you either prevent users from being able to input   in a
  field or make it so that it doesn't affect the code?

 Can you give an example of affecting the code? You can store spaces in
 variables just fine.

 Chris

 =
 Chris Shiflett - http://shiflett.org/

 PHP Security Handbook
  Coming mid-2004
 HTTP Developer's Handbook
  http://httphandbook.org/

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



[PHP] Variable in $_FILES?

2003-12-01 Thread Dimitri Marshall
Hi there,
This is what I'm trying to do:

$pic = $_FILES['object$objectNumber'];
$picName = $pic['name'];
$pictmp = $pic['tmp_name'];

$objectNumber is being defined, but for some reason this code won't work.
Can someone tell me why and also what I can do to make it work?

Thanks in advance,
Dimitri Marshall

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



[PHP] Re: Variable in $_FILES?

2003-12-01 Thread Dimitri Marshall
Just to answer my own question, but for reference for anyone else who has
this problem, I made a simple error (not very experienced with PHP). Anyway,
turns out that 'object$objectNumber' is different than 'object'$objectNumber
and also different that just $objectNumber. As most of you know, putting ' '
around a variable makes PHP print it out exactly like that (ie.
'$objectNumber' = $objectNumber in PHP) whereas I just wanted the variable
properties to actually be put into the $_FILES function (or whatever it is).
I couldn't figure out how to put 'object'$objectNumber together so I just
changed it to simply $objectNumber, so it now works.

This is what the code is now:

 $file = $_FILES{$objectNumber};
 $fileName = $file['name'];
 $filetmp = $file['tmp_name'];

... and everything works.

Dimitri Marshall

Dimitri Marshall [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi there,
 This is what I'm trying to do:

 $pic = $_FILES['object$objectNumber'];
 $picName = $pic['name'];
 $pictmp = $pic['tmp_name'];

 $objectNumber is being defined, but for some reason this code won't work.
 Can someone tell me why and also what I can do to make it work?

 Thanks in advance,
 Dimitri Marshall

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



[PHP] Picture Width and Height in $_FILES

2003-12-01 Thread Dimitri Marshall
Hi there,
I've seen the code somewhere but can't remember what it is exactly.
Basically I need to know what the PHP is to get the picture width and
height.

I tried:

 $pic = $_FILES[$objectNumber];
 $width = $pic['width'];
 $height = $pic['height'];

... with no success.

Any help is greatly appreciated.

Thanks,
Dimitri Marshall

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



[PHP] Two Actions in a Form?

2003-11-26 Thread Dimitri Marshall
Hi there,
I realize this is a group for PHP, but this question is related.

What I want to do is have one action in a form execute if the user clicks on
one button, and another action execute if the user clicks on another button.
The actions will point to PHP programs.

Can someone fill me in on what the HTML is for this. I can't remember.

Thanks a bunch in advance,
Dimitri Marshall

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



[PHP] Making a Search Function?

2003-11-17 Thread Dimitri Marshall
Hello...

I'm trying to make a search function for my site. This is how it needs to
work:

First, a user types in a search (ex: niagara falls). All the words then get
seperated or stay together, depending on the what the user selects in the
form. I can figure this out, all I have to do is use the explode() right?

Second, this array needs to search against a description on the database.
What I was thinking is getting the description ($description) and then
exploding that into an array and then comparing all arrays against each
other.

I'm pretty sure there's a way easier way to do this. Could someone enligthin
me?

Greatly appreciate any help in advance,
Dimitri Marshall

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



[PHP] Unique ID

2003-11-11 Thread Dimitri Marshall
Hi there,
Here's my situation:

I'm making a message board and I've decided the best way to go about the
structure is to have 3 tables, two of them will be Posts and Replys.
Now, in order for this ti work, each post has to have a UniqueID - same with
the replys. Looking at another program, I can see that one way to do this is
to do it by rows (ie. count how many rows, add 1, then that is the ID). It
would be unique because no two rows would be 1 for example.

The problem I can see is that the database would become incredibly huge
(size wise I mean). I want to delete the posts after 30 days, and if I
delete the row, then that would mess up the row system.

Any suggestions?

Dimitri Marshall

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



[PHP] Delete after 30 Days

2003-11-10 Thread Dimitri Marshall
Hey,
Here's my situation. I'm making a message board and I want posts to be
deleted after 30 days.

Does anyone know of a script, or how, I can delete an entry on my database
after a certain amount of time (ie. 30 days) automatically.

Dimitri Marshall

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



[PHP] Having trouble with Uploading Files to Server...

2003-11-05 Thread Dimitri Marshall
Hi,
I'm trying to allow users to upload files to my server. I have the
appropriate code (I think) but I'm getting this error message. Can someone
tell me why, and how to fix this?

Warning:
move_uploaded_file(/home/unit-dir/public_html/members/memberpix/dimitrihomel
ess.gif): failed to open stream: Permission denied in
/home/unit-dir/public_html/members/updatehomepage.php on line 36

Warning: move_uploaded_file(): Unable to move '/tmp/php9PUwlg' to
'/home/unit-dir/public_html/members/memberpix/dimitrihomeless.gif' in
/home/unit-dir/public_html/members/updatehomepage.php on line 36
Couldn't upload first image

Thanks,
Dimitri Marshall

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



Re: [PHP] Having trouble with Uploading Files to Server...

2003-11-05 Thread Dimitri Marshall
Wicked... Works, thanks.

Dimitri Marshall

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Web server need permission to write to
 /home/unit-dir/public_html/members/memberpix/ directory. Change the
 directory permissions to 777.

 Dimitri Marshall wrote:

  Hi,
  I'm trying to allow users to upload files to my server. I have the
  appropriate code (I think) but I'm getting this error message. Can
someone
  tell me why, and how to fix this?
 
  Warning:
 
move_uploaded_file(/home/unit-dir/public_html/members/memberpix/dimitrihomel
  ess.gif): failed to open stream: Permission denied in
  /home/unit-dir/public_html/members/updatehomepage.php on line 36
 
  Warning: move_uploaded_file(): Unable to move '/tmp/php9PUwlg' to
  '/home/unit-dir/public_html/members/memberpix/dimitrihomeless.gif' in
  /home/unit-dir/public_html/members/updatehomepage.php on line 36
  Couldn't upload first image
 
  Thanks,
  Dimitri Marshall
 

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



[PHP] FTP_DELETE!

2003-11-05 Thread Dimitri Marshall
Hi,
Just wondering what to put for the resource ftp_stream in the following:

ftp_delete ( resource ftp_stream, string path)

Thanks in advance,
Dimitri Marshall

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



Re: [PHP] FTP_DELETE!

2003-11-05 Thread Dimitri Marshall
Don't know what that is because I don't connect to FTP. The files upload
fine, but I just want to know how to delete them. Is the result of
ftp_connect() the $host in mysql_connect?

Dimitri Marshall

John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Dimitri Marshall wrote:

  Just wondering what to put for the resource ftp_stream in the
following:
 
  ftp_delete ( resource ftp_stream, string path)

 the result of ftp_connect().

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals – www.phparch.com

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



[PHP] FTP_DELETE HELP!

2003-11-05 Thread Dimitri Marshall
Hi,
Just wondering what to put for the resource ftp_stream in the following:

ftp_delete ( resource ftp_stream, string path)

I don't use ftp_connect to allow users to upload files, so I don't know what
the result of ftp_connect is. Is the result of ftp_connect() the $host in
mysql_connect?

Thanks in advance,
Dimitri Marshall

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



[PHP] Re: FTP_DELETE HELP!

2003-11-05 Thread Dimitri Marshall
Problem solved... Thanks everyone!

Dimitri Marshall

Dimitri Marshall [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,
 Just wondering what to put for the resource ftp_stream in the following:

 ftp_delete ( resource ftp_stream, string path)

 I don't use ftp_connect to allow users to upload files, so I don't know
what
 the result of ftp_connect is. Is the result of ftp_connect() the $host in
 mysql_connect?

 Thanks in advance,
 Dimitri Marshall

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



[PHP] Re: Ive lost a zero somewhere

2003-11-05 Thread Dimitri Marshall
$price = 25;
$f_price = sprintf(%01.2f,$price);
echo $f_pricebr;

This will give you 25.00 instead of 25. Maybe put your result into a
variable and then convert it into the decimal number using the sprintf()
function.

Dimitri Marshall

Richard Cook [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a problem with the following

 when i multiply for example 25 . 50 * 3 i get 76 . 5 how would i get PHP
to
 recognise the last 0 ie make it 76 . 50

 Any ideas?


 Regards

 R

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



[PHP] Uploading Files!

2003-11-03 Thread Dimitri Marshall
Hi there,
I'm new to this new PHP thing and man it's frusterating. Anyway, I'm not
gonna tell you my life story, but I just need to know how to allow users to
upload files to my server . I've already made a form with the input
name=whatever type=file and then a program that should get the varibles
[name] and [tmp_name] using $_POST. For some reason it's not working. Could
someone tell me how to do it, or what I'm doing wrong?

Thanks in advance,
Dimitri Marshall

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