Jump to content

Search the Community

Showing results for tags 'modify code'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 2 results

  1. Trying to find a way to combine two scripts. 1. picture upload script that uploads the picture, gives it a new unique name, saves it to a specified directory and saves the unique name path to a user database (basically a user profile picture upload). and 2. A larger user login script I already have worked into my website that allows users to register on the site, view and edit their profile, log in, log out, etc. The issue is in part that I don't understand PHP well enough to figure out how to work these in together and the other part is that they are written a bit differently from each other so it's making it hard to combine them. One of the user profile fields I am using with script 2 is valued "bpic" and is where path to the uploaded picture would go. I have been successful in getting the unique path to save in that field in the database but absolutely can NOT seem to get the picture to actually upload and save in the "avatars" directory no matter what I try. I have determined that because my user script already calls the database, has an "INSERT INTO" database command and has error and success messages, I could take out those aspects of the picture uploading code below so I'm just trying to figure out where to place the "$new_image_name =" and "$bpic = " lines and how and where to code in the "move_uploaded_file" portion so the file actually uploads lol. (These are the two portions of the script below that I have decided I need to use and find a place to paste): $new_image_name = md5( rand (0, 1000) . rand (0, 1000) . rand (0, 1000) . rand (0, 1000) ) .'.jpg'; $bpic = 'avatars/' . $new_image_name; if(move_uploaded_file($_FILES['bpic']['tmp_name'], $bpic)) { } Any help and direction is appreciated! I have been at this for weeks with no success. It took me a while to actually get the picture upload script to work on it's own and upload the file, give it a unique name and save that unique name in both the directory and database so it can be found and displayed correctly. But anyway, the upload picture script works perfect now on it's own, but I gotta figure out how to place it in the script I already have. Upload Picture Script: (note: "bpic" is the field name of the file upload on the form and "$bpic" both references the field in the database and the file path to be created for the pic.) <?php //This is the directory where images will be saved $new_image_name = md5( rand (0, 1000) . rand (0, 1000) . rand (0, 1000) . rand (0, 1000) ) .'.jpg'; $bpic = 'avatars/' . $new_image_name; // Connects to your Database mysql_connect("businessdb1.db.9878324.hostedresource.com", "businessdb1", "Spidey148!") or die(mysql_error()) ; mysql_select_db("businessdb1") or die(mysql_error()) ; //Writes the photo to the server if(move_uploaded_file($_FILES['bpic']['tmp_name'], $bpic)) { //Writes the information to the database mysql_query("INSERT INTO `employees` VALUES ('$bpic')") ; //Tells you if its all ok echo "The file has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> As far as the user upload script goes, I'm not sure which page to work this code into so I don't want to make this post insanely long by posting every potential page (database.php - which I think is it, process.php, session.php, constants.php). The exact same code I am using is downloadable for free here: http://blog.geotitles.com/2011/07/php-login-script/ so you can see exactly how my code is formatted. I understand that's a lot of information and actually quite a bit of work for someone to look at and offer help, but if anyone is up to it, I would really appreciate any advice and help with this as I have been pulling out my hair trying to figure this out and it's going to completing a website that a lot of bands are waiting to sign up for! Thanks so much for your time! -David.
  2. need help with a code i have placed a image instead of a button. but when i click on it it not redirekt to the page its supose to go anyone have the answer for this? excuse my bad english:) <td> <select name=\"upgrade$membership[id]\"> "; for($x=0; $x<count($tpackages); $x++) { $temp_price=($tpackages[$x]*$membership['price']); $includes[content].="<option value=\"".$tpackages[$x]."\">".($tpackages[$x])." ". iif($membership[time_type]=="D","Day"). iif($membership[time_type]=="W","Week"). iif($membership[time_type]=="M","Month"). iif($membership[time_type]=="Y","Year"). iif($membership[time_type]=="L","Lifetime"). " Membership - $cursym $temp_price"; } $includes[content].=" </select> </td> <td><input type=\"image\" src=\"images/paypal.png\" onclick=\"buyupgrade($membership[id],document.form.upgrade$membership[id].value)\" value=\"Buy Now!\"></td>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.