[PHP-DB] Selecting userID

2001-07-13 Thread Brad R. C.

I have attached what I have so far. This version uses a table called
picture_upload and the field name is picture_name.. also in my user
table I have the same field name, but that is from past trying to get it to
work... crap

I got it to upload to the table just fine and copy the file from a temp
source to the image directory I have chosen. So it works... but! it will not
insert into the right userid field, so I took it out and just made it where
they can copy and paste the url into the old way.. defeats the purpose of
uploading but atleast it gives them a place to put their files if they don't
have one :)

Can you take a look at my code below, and tell me how we can make it Select
a userid from the person who is logged in so that that the url can be posted
in the right field. I will try to play with it a little more today, but I
have sun poisoning and I am itching and burning all over... what a pain.

This is for use with vb bulletin board software.. there is a user table with
userid for the id number of the user.. and I am sure I will have to include
the global.php file to find the bbuserinfo that is logged in.



 start code ---
TABLE cellSpacing=0 width=100% align=center border=0
bordercolordark=#00 cellpadding=0
TBODYtrTD bgColor=#00
  TABLE align=center bgColor=#FF border=1 cellPadding=0
cellSpacing=0
  width=100% bordercolor=#FF bordercolorlight=#FF
bordercolordark=#FF
TBODY
TR vAlign=top
  TD vAlign=top align=middle
TABLE borderColor=#00 cellSpacing=0 borderColorDark=#ff
cellPadding=5 width=100% bgColor=#ff
borderColorLight=#00
border=1 height=188

/TABLE
table border=1 width=100% cellspacing=0 cellpadding=0
height=17 bordercolorlight=#00 bordercolor=#00
bordercolordark=#3366CC bgcolor=#3366CC
  tr
TD bgcolor=#3366cc bordercolor=#3366cc
bordercolorlight=#3366CC height=17bfont color=#FF
face=Verdana size=1nbsp;Photo
  Upload Information/font/b
/TD
  /tr
/table
TABLE borderColor=#00 cellSpacing=0 borderColorDark=#ff
cellPadding=5 width=100% bgColor=#ff
borderColorLight=#00
border=1

  tr
td
table class=reg cellSpacing=0
cellPadding=0 width=100% border=0
  tr vAlign=top
font face=Verdana, Arial, Helvetica,
sans-serif size=2
td
  /font
font face=Verdana size=1bVERY, VERY
IMPORTANT - PLEASE READ!br
/b/fontfont face=Verdana size=1If
you
have quot;Turned Onquot; the picture
activation to show your photo, be reminded
that
it is shown to all members and guests that
come
to this site to look around and vote. If
there
is any information that you have given upon
your
part to this site that you don't want others
to
know about, please go into your user control
panel and change it. If you have any
problems
with users and/or guests of this site
because of
your photo or your actions, please notify
one of
the Administrators or Moderators. Also
please
try to limit photos to no more than 500
pixels
in width, and 75kb in size. Reason being is
that
you will probably get a better rating if it
does
not take forever for your picture to
download,
and you also don't want your face to take up
the
whole screen./font
/td
/tr
/table
  /td
  /tr
/TABLE!-- NEXT ---!-- NEXT ---
table border=1 width=100% cellspacing=0 cellpadding=0
height=18 bordercolorlight=#00 bordercolor=#00
bgcolor=#3366CC bordercolordark=#3366CC
  tr
  TD width=357 bgColor=#3366CC height=18 bordercolor=#3366CC
bordercolorlight=#3366CC bordercolordark=#3366CCfont face=Verdana
size=1nbsp;/fontbfont color=#FF face=Verdana
size=1Upload
Form/font/b/TD
  /tr
/table
TABLE borderColor=#00 cellSpacing=0 borderColorDark=#ff
cellPadding=5 width=100% bgColor=#ff
borderColorLight=#00
border=1

  tr
TD
 

[PHP-DB] Image Uploading into Database with ID

2001-07-12 Thread Brad R. C.

I don't know how many of you are familiar with Vb (www.vbulletin.com) but I
am using the message board software and adding all that I can to it! :)

I am wanting my users to be able to add a photo to their profiles. So I am
trying to intergrate a upload script, that will upload the address to the
image (stored on the site) into the correct ID number of the user.

I have made it where it will upload the file to the correct folder and will
put a link in the database, but I cannot figure it all out. Listed below is
what I have in a .php file, but if you are familiar with the templates and
everything with vb, then I will post the code I have that is not working.

This code below works great.. but has not ability to add the image path or
anything to the correct user with ID.

--- code snippet = test.php ---
form enctype=multipart/form-data method=post  action=?php echo
$PHP_SELF ?
Upload a Photobr
input type=File name=picture size=25
brbr
input type=submit name=submit value=Upload
/form

?php
// Information needed to connect to the database
define(SQL_SERVER, localhost);
define(SQL_UID, USERNAME);
define(SQL_PWD, PASSWORD);
define(SQL_DB, DATABASE NAME);

// After the file has been chosen and they click submit this will happen
if ($submit) {

$connection = mysql_pconnect(SQL_SERVER, SQL_UID, SQL_PWD);

mysql_select_db(SQL_DB, $connection);

$sql = INSERT INTO user (picture_name) .
VALUES ('$picture_name');
mysql_query($sql);

exec(cp $picture /root/to/the/images/$picture_name);

// Echo's out the file that was upload to show that it succeeded.
echo temp file: $picturebr\n;
echo file name: $picture_namebr\n;
echo file size: $picture_sizebr\n;
echo file type: $picture_typebr\n;
echo br\n;
echo img src=images/$picture_namebr\n;

return 0;
}

?
--- code snippet = test.php ---

Here is what I altered the form code to look like for the modify and
registration templates.

--- code ---
tr bgcolor={firstaltcolor}
td valign=topnormalfontbUpload Picture :/bbr
smallfontPlease select a photo from your hard drive to post on the
site./smallfont/normalfont/td
td valign=topinput type=File class=bginput name=picture_name
size=25/td/tr
--- end code ---

I think for this to work properly it will have to not be called
picture_name but something along the lines of $bbuserinfo[picture_name]
to work... not for sure yet.


After that here is some of the code I have that replaces the submission part
of the above code. Since I added the form and everything to an already
existing if action statement I just added the below code to that but.. it
does not seem to work.

--- code ---
  // Photo Upload
  if ($picture_name !=) {
$picture_name=$picture_name;
exec(cp $picture /root/to/the/images/$picture_name);
  } else {
$picture_name=;
  }
  // End Photo Upload
--- end code ---

and for it to go along with the $bbuserinfo[picture_name] idea here is what
the code should look like :

--- code 
  // Photo Upload
  if ($bbuserinfo[picture_name] !=) {
$bbuserinfo[picture_name]=$bbuserinfo[picture_name];
exec(cp $picture /root/to/the/images/$picture_name);
  } else {
$bbuserinfo[picture_name]=;
  }
  // End Photo Upload
--- end code ---

The if action already looks for an ID.. if 0 it fails, else it continues...
so can anyone help me figure this one out... or tell me what a good command
is for selecting the ID out of the database for the user that is logged in..

thanks
BradC


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