Jump to content

mohammedsk

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Posts posted by mohammedsk

  1. You are right, I am not sure if images are stored correctly.
    I corrected the error you mentioned, but it did not make a difference.

    Here is the code I use to insert an image:
    [code]
    if(is_uploaded_file($_FILES['userimage']['tmp_name'])) {
            $imgData =addslashes (file_get_contents($_FILES['userimage']['tmp_name']));
            $size = getimagesize($_FILES['userimage']['tmp_name']);
    $real_name = addslashes ($_FILES['userimage']['name']);
    $type = $_FILES['userimage']['type'];

          $sql = "UPDATE profile_image SET image='{$imgData}', type='$type', ".
          size='$size[0]x$size[1]', name='$real_name' WHERE username='$username'";

          mysql_query($sql);
    }
    [/code]
  2. Hi,
    I upload images to MySQL database using PHP. The images are stored correctly, but some images when fetched back to be displayed in the browser comes out to be incomplete. What I mean by incomplete is that that image comes out to be 1/3 less in height.
    As a demonstration check out this link. The first image comes from the database, the second image is in a folder.

    Here are the code two pieces of code I use to display the image.
    [code]
    $result=mysql_query("SELECT size from profile_image where username='mohammed'");
    $row=mysql_fetch_assoc($result);
    //That is the original resolution $size[0]==width, $size[1]==height
    $size=explode("x", $row['size']);

    echo "<img class='userImage' width='$size[0]' height='$size[1]' src=\"fetch_user_image.php?username=mohammed\"><br>";
    [/code]

    [code]
    $sql = "SELECT image, type FROM profile_image WHERE username='mohammed'"; 
    $result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
    list($image, $size) = mysql_fetch_array($result);
     
    // set the header for the image
    header( "Content-type: $type");
    echo $image;
    exit;
    [/code]

    Any help is appreciated,
  3. I am trying to send email using PHP function mail($email, $title, $body).
    It sends to Yahoo and Gmail, but not Hotmail.

    It does not make sense to me.
    Any help will be appreciated.

    [code]
    $header = "Return-Path: me@example.net\n";
    $header .= "X-Sender: me@example.net\n";
    $header .= "From: ME. <me@example.net>\n";
    $header .= "X-Mailer:PHP 5.1\n";
    $header .= "MIME-Version: 1.0\n";

    ini_set(sendmail_form, "me@example.net");

    if (mail("$username", "$title", "$body") == false)
            echo "Activation failed";
    else
    echo "Please check your email for confirmation";
    [/code]


  4. I am trying to write a PHP code that allows me to store my email address and pwssword in the database (e.g hotmail email address).
    When I access the PHP page I just want to click on a link, that will retrieve my email address and password fill them in a login form exactly the same as the hotmail login page. My form has the same action URL hotmail has, ideally, this should work and logs me into hotmail.

    However, everything works fine, but when I click on submit button to login to hotmail through the page I made, hotmail gives an error, "incorrect password."
    By the way, I am not using any password encryption here.

    Do you have any idea what the problem might be, is it the password encryption?
    I searched online for something similar, but no results.

    Thanks,
×
×
  • 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.