Recent content by myscranton

  1. M

    I need help with PHP arrays?

    Hi. This is what I am trying to do, I have an array: $cars = array("honda" => "blue", "ford" => "blue", "toyota" => "red"); How can I get the numbers of the "blue" cars? I don't want to get the names, like "Honda" and "Ford", I want it to return $cars[0] and $cars[1]. Can someone explain to...
  2. M

    Can someone help me figure out to do this with PHP?

    Say I have a variable: $phrase = "The 16th president was Abraham Lincoln". And I have two sentences: $sentences[0] = "The 16th president of the US was Abraham Lincoln"; $sentences[1] = "The 1st president was George Washington". Using PHP, what would be the best way to pick the $sentences...
  3. M

    Tips for writing secure PHP?

    I am working on a log in system for my website. Can someone tell me if this is safe PHP? I am creating a salt with md5 and sha1. Then I am combining the salt with my password and then hashing it again. Is this safe? Also, is this the proper way to read session variables? if($password !=...
  4. M

    How can I do this with PHP?

    I am working on a simple calendar for my website wriiten in PHP. It works fine except I can't figure out how to switch between months. This is what I currently have to move to the previous month, but the problem is it only works once. It'll go back one month but wont work any more. Can anyone...
  5. M

    PLEASE HELP ME!!! PHP!!!!?

    I have been trying for HOURS to create a login page that asks you to answer a security question. Everything seems right but it won't work and I have no clue what to do! I can't figure this out and I really need help! PLEASE HELP! <?php $qry4 = "SELECT COUNT(*) FROM...
  6. M

    PHP doesn't recognize "image/png"? Why?

    This is my code. I am working on an image uploader. JPG and GIF files are uploaded fine. But when it comes to PNG, I get the error that the file type is not supported and it won't upload it? Why? <?php if (isset($_FILES["file"])){ if ((($_FILES["file"]["type"] == "image/jpeg") ||...
  7. M

    I have a PHP MySQL Question?

    I am creating an installer with PHP and MySQL. The user enters a prefix for the database tables. How do I create a table with the prefix in front of it? I have tried this but it does not work: $prefix = $_POST['prefix']; $qry = "CREATE TABLE $prefix.Users id INT NOT NULL AUTO INCREMENT, email...
  8. M

    How do you Upload, Resize, and Save files with PHP?

    I have this code I wrote in PHP which allows a user to upload an image. It then scales it so it is 250px wide. It for the most part works fine. It uploads the picture and if you use imagejpeg() it will show it at reduced size on the screen. BUT, it saves it at its normal size. I want it to be...
  9. M

    How do you do this with PHP?

    I am creating a web application using PHP and MySQL. The webmaster must be able to install this application using an installer I built with PHP. They enter their MySQL database name, username, and password, and it creates tables. That is nice, but how do I make it remember the MySQL db name...
  10. M

    PHP: How to detect MySQL Version?

    How can you #1 detect if MySQL is installed and #2 detect the MySQL version with a PHP script?
  11. M

    What is wrong with my PHP code?

    This is my code, I am creating a forum for my website. I only have one table so far, with the block bad words feature. My database login is correct and it selects the database correctly but it just won't create the table. <?php function setup_db() { $hostname = $_POST['hostname']; $db_name...
  12. M

    I need a PHP script to detect the PHP version?

    A while back I set up phpBB and in the setup, it detected the version of PHP the server was running and printed it to the screen. Now I am in need of this but can't find it anywhere. Does anyone know the script that does this, or where I can find a tutorial?
Back
Top