Jump to content

mastershake22

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mastershake22's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I use the $image multiple times because php reads linearly (sp?) and every new $image builds off the previous one to combine all the functions into one variable.
  2. I am using an upload page for photos, and When I try to display the photo after it's been uploaded it only displays part of the photo. I realize that that is probably because the file is too big, but if anyone out there knows how to resize an image for display after its been uploaded I would really appreciate the help. This is the get.php page I'm using to display the image <?php $id=$_REQUEST['id']; $image=mysql_query("SELECT*FROM demophotos WHERE id=$id"); $image=mysql_fetch_assoc($image); $image=$image['image']; header ("Content-type: image/jpeg"); echo $image; ?> And this is the photo.php page that I'm using for uploading <?php $file= $_FILES['image'] ['tmp_name']; if (!isset($file)) echo "Please select an image"; else { $image= addslashes(file_get_contents($_FILES['image'] ['tmp_name'])); $image_name= addslashes($_FILES['image'] ['name']); $image_size= getimagesize($_FILES['image'] ['tmp_name']); if ($image_size==FALSE) echo "Well that's not an image now, is it?"; else { if(!$insert= mysql_query("INSERT INTO demophotos(id, name, image) VALUES ('', '$image_name', '$image')")) echo "?"; else { $lastid=mysql_insert_id(); echo "Image uploaded <p /> You're Image: <p /><img src= get.php?id=$lastid>"; } } } ?>
  3. include 'config.php'; $result=mysql_query("SELECT * FROM persons WHERE email='$_POST[email]' AND password='$_POST[password]', $db_name"); //check that at least one row was returned $rowCheck = mysql_num_rows($result); if($rowCheck > 0){ $row = mysql_fetch_array($result); header( "Location: profile.php" ); } else { //if nothing is returned by the query, unsuccessful login code goes here... echo 'Incorrect login name or password. Please try again.'; } ?> [code/]
  4. HI, I'm new to PHP and I'm trying to learn what sessions are and how they work. I'm working on a login page, I have a table in mysql for sessions, and I have a table with users that includes an email address and password. I just want to query the db to see if there is a user with that email, check the password, and start a session. Every "tutorial" i've looked at fails to answer how the session gets stored in the db, what variable I should set the session at to pull a user's information, and how to use that session to actually echo the information. I'm really frustrated and lost so if anyone knows the correct code or can explain the questions I mentioned above I would appreciate it alot. 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.