Selecting userID

From: Date: Fri, 13 Jul 2001 16:21:45 +0000
Subject: Selecting userID
Groups: php.db 
Request: Send a blank email to php-db+get-10385@lists.php.net to get a copy of this message
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="#000000" cellpadding="0"> <TBODY><tr><TD bgColor=#000000> <TABLE align=center bgColor=#FFFFFF border=1 cellPadding=0 cellSpacing=0 width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF"> <TBODY> <TR vAlign=top> <TD vAlign=top align=middle> <TABLE borderColor=#000000 cellSpacing=0 borderColorDark=#ffffff cellPadding=5 width="100%" bgColor=#ffffff borderColorLight=#000000 border=1 height="188"> </TABLE> <table border="1" width="100%" cellspacing="0" cellpadding="0" height="17" bordercolorlight="#000000" bordercolor="#000000" bordercolordark="#3366CC" bgcolor="#3366CC"> <tr> <TD bgcolor="#3366cc" bordercolor="#3366cc" bordercolorlight="#3366CC" height="17"><b><font color="#FFFFFF" face="Verdana" size="1">&nbsp;Photo Upload Information</font></b> </TD> </tr> </table> <TABLE borderColor=#000000 cellSpacing=0 borderColorDark=#ffffff cellPadding=5 width="100%" bgColor=#ffffff borderColorLight=#000000 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="1"><b>VERY, VERY IMPORTANT - PLEASE READ!<br> </b></font><font face="Verdana" size="1">If you have &quot;Turned On&quot; 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="#000000" bordercolor="#000000" bgcolor="#3366CC" bordercolordark="#3366CC"> <tr> <TD width=357 bgColor=#3366CC height="18" bordercolor="#3366CC" bordercolorlight="#3366CC" bordercolordark="#3366CC"><font face="Verdana" size="1">&nbsp;</font><b><font color="#FFFFFF" face="Verdana" size="1">Upload Form</font></b></TD> </tr> </table> <TABLE borderColor=#000000 cellSpacing=0 borderColorDark=#ffffff cellPadding=5 width="100%" bgColor=#ffffff borderColorLight=#000000 border=1> <tr> <TD> <form enctype="multipart/form-data" method="post" action="<?php echo $PHP_SELF ?>"> Upload a Photo<br> <input type="File" name="picture" size="25"><br> <br> <input type="submit" name="submit" value="Upload"> </form> </TD> </tr> </TABLE> </TD> </TR> </TBODY></TABLE> </table> <?php define("SQL_SERVER", "localhost"); define("SQL_UID", "USERNAME"); define("SQL_PWD", "PASSWORD"); define("SQL_DB", "DATABASE NAME"); if ($submit) { $connection = mysql_pconnect(SQL_SERVER, SQL_UID, SQL_PWD); mysql_select_db(SQL_DB, $connection); $sql = "INSERT INTO picture_upload (picture_name) ". "VALUES ('$picture_name')"; mysql_query($sql); exec("cp $picture /home/addicted/public_html/board/ranking/images/$picture_name"); $beefy = "http://www.addictedusers.com/board/ranking/images"; echo "temp file: $picture<br>\n"; echo "file name: $picture_name<br>\n"; echo "file size: $picture_size<br>\n"; echo "file type: $picture_type<br>\n"; echo "<br>\n"; echo "Copy and Paste this url : $beefy/$picture_name<br>\n"; echo "<br>\n"; echo "<img src=images/$picture_name><br>\n"; return 0; } ?> --- end code --- Thanks BradC

« previous php.db (#10385) next »