+ Reply to Thread
Results 1 to 9 of 9
Like Tree2Likes
  • 1 Post By begamer26
  • 1 Post By begamer26

Thread: Profile pic feature for my login script - NO CODES NEEDED

  1. #1
    begamer26 is offline x10Hosting Member begamer26 is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    24

    Talking Profile pic feature for my login script - NO CODES NEEDED

    Okay I have succesfully created a login/register/accountpage php script but now I want to add onto that and create a feature that allows you to create a profile picture and keep it as YOUR profile picture. I dont need any codes as I will create the myself for the sake of learning but if you need to, to explain then thats fine

    Im using WAMP for now so every feature on here is on there and im using HTML, PHP, MYSQL out of them
    dinomirt96 likes this.

  2. #2
    supajason's Avatar
    supajason is offline x10 Lieutenant supajason is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    England........:-)
    Posts
    288

    Re: Profile pic feature for my login script - NO CODES NEEDED

    What do you mean by create a profile picture?

    Do you mean; the user makes(draws lines, circles etc) the picture on your site or the user can upload the picture from there computer or a URL?
    supajason was here

  3. #3
    begamer26 is offline x10Hosting Member begamer26 is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    24

    Re: Profile pic feature for my login script - NO CODES NEEDED

    Quote Originally Posted by supajason View Post
    What do you mean by create a profile picture?

    Do you mean; the user makes(draws lines, circles etc) the picture on your site or the user can upload the picture from there computer or a URL?
    From there computer!

  4. #4
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: Profile pic feature for my login script - NO CODES NEEDED

    well here is the basic of it:

    1| upload script
    11| check for valid file type / file size
    12| where to store the files
    13| how to make the relation
    2| database to store the relation of user to their picture

  5. #5
    begamer26 is offline x10Hosting Member begamer26 is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    24

    Re: Profile pic feature for my login script - NO CODES NEEDED

    Okay I can upload the file, write the directory into the database but I cant get it to display it? heres a selection of my code, tell me whats wrong please -
    Code:
            <table width="130" border="1">
              <tr>
                <td height="130"><img src="
       <?php
    			  $COOKIE=$_COOKIE['username'];
    $con = mysql_connect("localhost","root","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("begamer", $con);
    $result = mysql_query("SELECT profilepic FROM users
    WHERE username='$COOKIE';");
    while($row = mysql_fetch_array($result))
      {
      $row['profilepic'];
      }
    ?> " width="100%" height="100%"></td>
              </tr>
            </table>
    Last edited by begamer26; 04-02-2010 at 12:36 PM. Reason: Wrong XP
    karimirt47 likes this.

  6. #6
    begamer26 is offline x10Hosting Member begamer26 is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    24

    Re: Profile pic feature for my login script - NO CODES NEEDED

    No Worry's I fugured it out! 8P I was using an un-needed loop
    Code:
    <?php
         $COOKIE=$_COOKIE['username'];
    $con = mysql_connect("localhost","root","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("begamer", $con);
    $result = mysql_query("SELECT profilepic FROM users
    WHERE username='$COOKIE';");
    $row = mysql_fetch_array($result);
    echo($row['profilepic']);
    ?>

  7. #7
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Profile pic feature for my login script - NO CODES NEEDED

    Your script is open to SQL injection. Switch to using PDO and prepared statements. The DB connection should be placed in a function to isolate DB user credentials and improve reliability and security. Read "Writing MySQL Scripts with PHP and PDO" for more.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  8. #8
    begamer26 is offline x10Hosting Member begamer26 is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    24

    Re: Profile pic feature for my login script - NO CODES NEEDED

    Quote Originally Posted by misson View Post
    Your script is open to SQL injection. Switch to using PDO and prepared statements. The DB connection should be placed in a function to isolate DB user credentials and improve reliability and security. Read "Writing MySQL Scripts with PHP and PDO" for more.
    Thank's, Ive already protected my login script from mysql injection but forgot to add it t this script XP

  9. #9
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Profile pic feature for my login script - NO CODES NEEDED

    Quote Originally Posted by begamer26 View Post
    forgot to add it t this script
    Exactly why prepared statement parameters are so useful. If you use them, there's nothing to forget, security-wise.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Simple Slideshow script/module needed for CMS
    By stevet70 in forum Programming Help
    Replies: 4
    Last Post: 11-10-2008, 04:10 PM
  2. java script needed
    By tabish3 in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 06-04-2008, 08:57 PM
  3. Script needed for trivia site
    By dwd2000 in forum Programming Help
    Replies: 0
    Last Post: 05-19-2008, 08:01 PM
  4. Replies: 2
    Last Post: 09-26-2007, 08:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers