puddin 0 Junior Poster in Training

Forget above message.... I tried to send this message and edit above, but I timed out see below pkease.

Thanks again for your reply:

No I get error with your code, it's the sessions: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING ,Buy I tried other methods and...

When I send the message, I can get the message to go into to the users session location username message etc... and it displays on the session users message page, it looks Great! BUT!

The Mysql column only holds one message for each user at a time... How do I insert all of the in going messages for the user and display them all?

HERE IS MY DATABASE LAYOUT:

id  //    email     //    username  // from   //  message    // userid    //  password  
1   //    lshaw.ca  //    Lucy      // John   //  Hi Lucy:   // Lucy      //  ''            
2   //    liho.com  //    Lisa      // Mike   //  Hi Lisa:   // Lisa      //  ''            

Than the id and members list goes on and on.... Now,

How do I program the mysql id usernames column to hold all messages for each user? I am using Mysql 4.0

NOTE: If ithe message does not go into the usernames id row and starts a new row , it does not have the email_address and etc... to know to select after correctly so I end up back like I was last nightm
It must go into the usersname id row - not list in …

puddin 0 Junior Poster in Training

Thanks again for your reply:

My problem is... When I send the message, I have no problem getting them to go to the session users ID and displaying for them on the users message page, it looks Great! BUT!

The Mysql column only holds one message for each user at a time... How do I insert all in going messages, that the mysql will hold them in the same column for the same username?
Can I program the mysql column to hold all messages and than easily select it to release all the messages? I am using Mysql 4.0


Do you know how to make a session user message system that members can send and receive back and forth messages to each other? and view them as a member on the site like we do here.

Example: Like for instance you are a member you come in, your in your session the page says hello to you by username , and you click on the message page and you see oh! you have 3 messages... and all is great! You read them and you choose to delete or hold on to them!

Have you ever did this? How in the world do I construct that? I thought I had it and the bloody thing is not understanding it's in the session and it's saying hello to the user... Too much

That Join code would of worked perfect if only , it …

puddin 0 Junior Poster in Training

Thanks for your reply; I'm so stressed out...

Gee I do not exactly know what you mean, I am still learning the terminology, but I do know I did it like you suggested I think, see below:

<?php
include’db.php’;
$query = "SELECT messages.user_id, members.username ".
"FROM messages, members ".
"WHERE messages.user_id = members.username";
$result = mysql_query($query) or die(mysql_error());

// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
echo $row. " - ". $row;
echo "<br />";
}
?>

Even though I have the script above this one confirming the user is in a $_SESSION
it is not understanding it is in a users session... It is just doing as the script states:

And it prints all the users’ names and messages.... do you get what I mean... I am at this for days I am like a mess to say it mild.

How can I correct it that it verifies it is in the users $_SESSION of that specific user and it SELECTS that specific users’ messages only... I need to write it in one script... it seems HELP!

Oh I hope you know the answer, Thanks so much, puddin

puddin 0 Junior Poster in Training

I'm dizzy trying to figure out what I should do, I will treasure whoever can help me!

When a user comes to the site they are automatically in their own $_SESSION, they are greeted by their username, it looks professional really nice... If the person is not a member they are redirected... I luv it!
I am using this script:

<?
    include 'db.php';

 // get the variables from home page
   $password = $_SESSION['password'];  
   $email_address = $_SESSION['email_address']; 

   $sql_check = mysql_query("SELECT username FROM members WHERE password='$password' AND
   email_address='$email_address'");  

   $username = mysql_fetch_array($sql_check, MYSQL_BOTH); //MYSQL_BOTH;
   $sql_check_num = mysql_num_rows($sql_check); 
   if($sql_check_num == 0){ 

   echo ("");
 } else {
   echo ucfirst($username['username']);
}

// Define post fields into simple variables 
$email_address = $_SESSION['email_address']; 
$password = $_SESSION['password']; 

/* Let's strip some slashes in case the user entered 
any escaped characters. */ 

$email_address = stripslashes($email_address); 
$password = stripslashes($password); 

/* Do some error checking on the form posted fields */ 

if((!$email_address) || (!$password)){ 
    echo '<STRONG><br><br>Enter required fields as indicated below
          <br>If you are a member!</STRONG><a href="login_form.php"><u> Login Here</u></a>
          <br><STRONG>To become a member!</STRONG><a href="join_form.php"><u> Join Here</u>
          </a><br><br />'; 
    if(!$email_address){ 
        echo "<font color='#000000'>Email address is a required field.</font><br />"; 
    } 
    if(!$password){ 
        echo "<font color='#000000'>Password is a required field.</font><br />";
}
       exit(); // if the error checking has failed, we'll exit the script! 
} 
?> 

Now I want to let my users message each other. I have created a second table just for the messages, it includes the user_id= the to username and from=who sent the message and message=the message.

I must …

puddin 0 Junior Poster in Training

Thanks so much

Can anyone please tell me. I have Mysql 4.0 my users are listed by auto increment not null

On the site I offer you a form to send a member a message you fill out the form. The form inputs are named = message from and user_id,


I created for that a second Table to hold all the messages where that is named = message from and user_id as I explained above, okay!


Your message goes to the mysql database and goes into the columns.

My Big Question is:

How now when a user comes on and is in their users sessions and on the page I have the users sessions username coming up and saying hello to the user -

Do I select the messages for that user from the other table -
By the users username.

I am so stressed I see other sites even this site has it, members send messages to each other it all works.

I am reading my head off I can't find what I need a lot is because I am new and I do not know the terminology. Your help will be treasured...
How do I program this to work??? Thanks, Puddin

puddin 0 Junior Poster in Training

I want to show you this is what I have now:

HERE IT IS GETTING WHO THE MESSAGE IS FROM THE SENDER

<?php
include 'db.php';
// get the variables from home page
$password = $_SESSION;
$email_address = $_SESSION;

$sql_check = mysql_query("SELECT fm FROM myd WHERE id='2'");

$fm = mysql_fetch_array($sql_check, MYSQL_BOTH); //MYSQL_BOTH;

$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){

echo ("");
} else {
echo ("");
}
?>
</p>

HERE IT IS PRINTING AND SHOWING THE SENDER THE MESSAGE IS FROM THEM

<p class="fm">
<?echo ucfirst($fm);?>
</p>


HERE IT IS GETTING THE MESSAGE THE SENDER IS SENDING

<?php
include 'db.php';
// get the variables from home page
$password = $_SESSION;
$email_address = $_SESSION;

$sql_check = mysql_query("SELECT mg FROM myd WHERE id='2'");

$mg = mysql_fetch_array($sql_check, MYSQL_BOTH); //MYSQL_BOTH;

$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){

echo ("");
} else {
echo ("");
}
?>

HERE IT IS PRINTING THE MESSAGE FOR THE SENDER TO VIEW
<p class="mb">
<u><?echo ucfirst($mg);?></u>


NOW AS YOU SEE ABOVE THIS MESSAGE IS BEING SENT TO MEMBER ID='2'
THE SENDER GETS TO VIEW THE COMPLETE WHO IT IS FROM AND MESSAGE, THEY LIKE IT ALL IS GOOD, THAN I HAVE A BUTTON THAT THEY CLICK TO CONFIRM AND IT GOES.

MY PROBLEM IS THE ID'S RECIEVING …

puddin 0 Junior Poster in Training

That is really kind of you! Good heavens I am truly pleasantly suprised, Thanks so much!

I did the test_table , brought up the code as test.php and I see it all.
On the Test_table mysql said I had an error with :
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
What is that? I took it out the table is showing with everything else.

You know what I want to ask you is this, Is their a php code that repeats the INSERT INTO the same Id : The ID stays the same of course ID 2 is John for example:
But I need all fm's and mg'g to repeat and store log in Johns Id#2 , is this possible do you know. Cause that is what the idea is right i want all john's messages to log under his ID in the mysql database...
Now I filled out the form but I don't see nothing in the test table what do I do?....

Is it something to do with I needing to add Id's or is it because of this line: ENGINE=InnoDB DEFAULT CHARSET=latin1;
I'm confussed I'm going to look it over...
Thanks again really, puddin

puddin 0 Junior Poster in Training

How can I create this message system, I'm trippin out , it has to be possible! I am wondering if I am going about it the right way, gee it's tuff when we don't know uh!

puddin 0 Junior Poster in Training

Sorry about the typo question, no I thought it would work, but it does not nor without it... if I script it like :
INSERT INTO table_name (id) VALUES ('2') It still creates a new ID.

It echos but it creates a new column a new id in my table,
I need it to go into id=2 than it would display on id2's messages page , you see what I mean... and it doesn't work

puddin 0 Junior Poster in Training

I am a beginner 100% I love working with programming a lot, everytime I learn something new I get this big smile!

I have it setup that that the message is viewed before posting but what you have showed is excellent!, thanks,

I'm still trying to get the INSERT INTO to work, I'm hoping it will not overwrite the last message, any other suggestions on that?

Thanks again, puddin

puddin 0 Junior Poster in Training

This is what I have , it's not working, it's creating a new id and not going into (id) VALUES ('2')

<?php
include'db.php';
$sql = mysql_query("INSERT INTO myd (id, fm, mg, last_login)VALUES
('$2','$fm','$mg', now())") or die (mysql_error());

if(!$sql){
echo 'There has been an error creating your account. Please contact the webmaster.';
} else {
echo("");
}
?>

Now in mysql table under fm and mg They Represent: who the message is fm=from and the mg=message : I have them set as a blob: Do you think that is correct?

I did that thinking it could hold a lot of messages : You see I want my users to be able to message each other - and when they click on their message button - They can view all their messages sent by other members -

I want to add a delete button beside each message so the user can delete their messages as they desire.

I have my message form setup great ,

You write your message,
It automatically goes to the mysql table correctly
Postes your message in the right users id -
Than it posts your messsage correctly on the users page
who you sent your message to...

Last it automatically includes that the message is from you...

But when a second message is sent it erases your message. I was using UPDATE now I am trying …

puddin 0 Junior Poster in Training

Thanks so much for your reply,

Now I am trying to use your suggestion , I think you may be right. But with INSERT INTO when I try to add the user id # like in UPDATE I can add the user id -Like this: id='2'");

But with INSERT INTO It does not work! I would appreciate any help again, Thank-you , puddin

puddin 0 Junior Poster in Training

Hello Pro Programmers!

Can you help me, Please!!!

What I want to do is let my users message each other, I have my form and message page setup I love it! It’s working the messages are going in the right ID’S in the Mysql database, BUT! It is overwriting as soon as the next message is sent.

I want it to save all messages not overwrite any at all and let the user delete the messages as they so wish to delete

Can I do this is it possible? I have it set up so far on mysql MSG with TEXT Do I use blob instead, can you tell me the php code so it does not overwrite in the mysql database and saves all the messages…

Thank-You Pro Programmers, puddin

puddin 0 Junior Poster in Training

Hello Pro Programmers!

Can you help me, Please!!!

What I want to do is let my users message each other, I have my form and message page setup I love it! It’s working the messages are going in the right ID’S in the Mysql database, BUT! It is overwriting as soon as the next message is sent.

I want it to save all messages not overwrite any at all and let the user delete the messages as they so wish to delete

Can I do this is it possible? I have it set up so far on mysql MSG with TEXT Do I use blob instead, can you tell me the php code so it does not overwrite in the mysql database and saves all the messages…

Thank-You Pro Programmers, puddin

puddin 0 Junior Poster in Training

Thank-you...


Your help has been appreciated, but now the Gif photos won't come up... I have tried replacing ImageCreateTrueColor with so many other image commands but i cannot get it. How does it accept both and bmp.... Thanks again, puddin

puddin 0 Junior Poster in Training

I AM POSTING A SECOND TIME ON THIS. I NEED SOMEONE TO HELP!!!

TO TELL ME WHERE MY MISTAKE IS: THE JPEG PHOTOS DO NOT DISPLAY CLEARLY AT ALL.... CAN YOU HELP PLEASE!!!

Thank-you Kindly, Puddin

____________________
This Is My User Form
Is The Error Here?
____________________

<?php
include 'db.php';

// initialization
$photo_upload;
$counter = 1;

if( $_GET )
$number_of_fields = (int)($_GET);


// Lets build the Photo Uploading fields
while( $counter <= $number_of_fields )
{
$photo_upload;

__HTML_END;
$counter++;
}
// Final Output
echo <<<__HTML_END

<!-Insert the photo fields here -->
$photo_upload
<html>
<head>
<title>Lets upload Photos</title>
</head>

<body>
<table class="image" cellpadding="1" cellspacing="0">
<tr>
<td>
<form name="photo_filename" action="photo1.php" method="post" enctype="multipart/form-data">
<font color=#FFFFFF><b>
Photo:
<input name="aphoto_filename[]" type="file">
Caption: <textarea name='namea' cols='20' rows='1'></textarea>
<input type='submit' name='submit' value='Add Photos'/>
<input type="HIDDEN" name="$session_name" value="$session_id"></font>
</form>
</td>
</tr>
</table>
</body>
</html>
__HTML_END;
?>

AND...
________________________________________________________
This Is The 2nd Page Process That Stores The Photo And Displays It.
Is The Error Here?
________________________________________________________

<?php
include 'db.php';

// initialization
$result_final = "";
$counter = 0;
// List of our known photo types
$known_photo_types = array(
'image/pjpeg'=>"jpg",
'image/jpeg'=>"jpg",
'image/jpg'=>"jpg",
'image/png'=>"png",
'image/x-png'=>"png",

puddin 0 Junior Poster in Training

I have tried and again I cannot figure it out. Everything is working...

Only the jpg, JEPG like these do not show up correctly... Can you see the mistake? If you do please spell it out for me. Much appreciated, again, puddin.

Here is my form and process photo code:

_________________________
THIS IS THE FORM
_________________________

<?php
include 'db.php';

// initialization
  $photo_upload['aphoto_filename'];
  $counter = 1;

if( $_GET['number_of_fields'] )
$number_of_fields = (int)($_GET['number_of_fields']);


// Lets build the Photo Uploading fields
while( $counter <= $number_of_fields )
{
$photo_upload;

__HTML_END;
$counter++;
}
// Final Output
echo <<<__HTML_END

<!-Insert the photo fields here -->
$photo_upload
<html>
<head>
<title>Lets upload Photos</title>
</head>

<body>
<table class="image" cellpadding="1" cellspacing="0">
<tr>
<td> 
<form name="photo_filename" action="photo1.php" method="post" enctype="multipart/form-data">
<font color=#FFFFFF><b> 
Photo: 
<input name="aphoto_filename[]" type="file">
Caption: <textarea name='namea' cols='20' rows='1'></textarea>
<input type='submit' name='submit' value='Add Photos'/>
<input type="HIDDEN" name="$session_name"  value="$session_id"></font>
</form>
</td>
</tr>
</table>
</body>
</html>
__HTML_END;
?>

________________________________________________________
THIS IS IT'S 2nd PAGE PROCESS THAT STORE'S IT AND DISPLAYS
________________________________________________________

<?php
  include 'db.php';

  // initialization
  $result_final = "";
  $counter = 0;
  // List of our known photo types
  $known_photo_types = array( 
          'image/pjpeg'=>"jpg",
          'image/jpeg'=>"jpg",
          'image/jpg'=>"jpg",
          'image/png'=>"png",
          'image/x-png'=>"png",
          'image/gif'=>"gif",
          'image/bmp'=>"bmp"
         );

  // GD Function List
  $gd_function_suffix = array( 
            'image/pjpeg' => 'JPEG',
            'image/jpeg' => 'JPEG',
            'image/gif' => 'GIF',
            'image/bmp' => 'WBMP',
            'image/x-png' => 'PNG'
          );
   // Fetch the photo array sent by preuploads.php
  $photos_uploaded = $_FILES['aphoto_filename']; 


  // Fetch the photo caption array
  $_POST['namea'];

   while( $counter <= count($photos_uploaded) )
  {

   if($photos_uploaded['size'][$counter] > 0)
    {
      if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))
       {      
        $result_final .= "File …
puddin 0 Junior Poster in Training

Hello,

When I select my images they are opening. Only the jpg will not come in clearly. If you know the code to correct this can you please tell me, Thanks puddin

Here is my code:

<?php
include'db.php';
 // get the variables from home page
   $password = $_SESSION['password'];  
   $email_address = $_SESSION['email_address'];

        $sql_check = mysql_query("SELECT aphoto_filename FROM myd WHERE email_address='$email_address'AND password='$password'");
         $aphoto_filename = mysql_fetch_array($sql_check, MYSQL_BOTH); //MYSQL_BOTH;

         $sql_check_num = mysql_num_rows($sql_check);
         if($sql_check_num == 0){ 


         echo ("You do not have a photo uploaded, please upload a photo");
       } else {
         echo "<img src='".$images_dir."/".$aphoto_filename['aphoto_filename']."'>" ;
}
?>
</p>

It brings in gif photos perfect, but not jpg's!

puddin 0 Junior Poster in Training

Hello and a BIG Thank-You!!! To you who have helped me...

This I think will be my last image question. Okay the user uploaded a picture , it went to the (Photos directory) (Name and Type Show) Great!... Next to the (Mysql Database under aphoto_filename) Again with (Name and Type Showing) Excellent!, It is in the users Mysql Database listing with all their other information. So Perfect! Last it shows up Beautiful!

Brick Wall I'm exhausted even missed school trying to solve it, I cannot do that again.
PROBLEM TO BE SOLVED:

When the user leaves the photo view page, I cannot get their photo to stay reappear. It remains in the photos directory and in the mysql database... When I try calling it... It only displays the image name and type I need it to open.

Please See My Code Below and Thank A Zillion!

<?
include'db.php';

$sql_check = mysql_query("SELECT aphoto_filename FROM gallery_photos WHERE email_address='".($email_address)."'AND password='".($password)."'" );

$aphoto_filename = mysql_fetch_array($sql_check,
MYSQL_ASSOC); //MYSQL_ASSOC;
        $sql_check_num = mysql_num_rows($sql_check); 
        if($sql_check_num == 0){ 

         if ($type == "image/pjpeg") {    
     imagejpeg($img); 
   } else if ($type == "image/x-png") {
     imagepng($img);
   } else if ($type == "image/gif") {
     imagegif($img);
   }
   $handle = fopen($aphoto_filename['tmp_name'], $images_dir."/$filename". "wb");

          echo ("");
        } else {
          echo $aphoto_filename['aphoto_filename'];
        }   

?>

P.S I actually have... aphoto, bphoto, cphoto and dphoto ... When anyone wants to see the users photo I need the photos to open. Thanks again soooooo much, puddin

puddin 0 Junior Poster in Training

Hello ,

If you know the answer please simplify it for me. I am so discouraged trying to figure this out. I'll be very grateful, Thanks ahead a time!

When I insert my (2) selected photos in my photo form , they show two pictures but it repeats only (1) of the pictures. it shows up double.

Next it goes to the directory as one image name and type.

Next in the database I have photo1 and photo2 it logs in photo1 and photo2 the same image though,

but in name1 and name2 it logs the name correctly but no type!

For the life of me I cannot get the pictures to show up as the two seperate photos I am inserting, and log in the database as photo1 and photo2 as two seperate photos... They log photo1 and photo2 as the same name and type... CAN you HELP!

Easily I select cat.gif and dog.gif on display only cat.gif displays twice ...

In the directory it logs only once cat.gif ...

In the database it logs repeated cat.gif in photo1 and photo2 ....

In the database under name1 it is logging cat and in name2 it is logging dog correctly but no type!

How can I write it correctly that two photos are being selected and not just one... Here is my code:

____________________
THIS IS THE PHOTO_FORM

<?php
include 'db.php';

// initialization
  $photo_upload;
  $counter = 1;

if( $_GET['number_of_fields'] )
$number_of_fields = (int)($_GET['number_of_fields']);

// Firstly Lets build the Category …
puddin 0 Junior Poster in Training

Thank-you kindly Barnamos,

I figured out with "Your reply" to get the picture name in the name field... I am trying to clean up the text field so it will list a second and if I want to allow a third picture , I actually want to allow 4.

I cannot figure it out. It only reads photo_filename as the name, when I try to make the second input pic_filename it doesn't take... Can you maybe tell me how to do this.

Thank-you again you have helped me as lot. I spend hours and I am in school having to study French.... ohhh it's tuff!

THIS IS WHAT I HAVE NOW:

--------------------------

THE PREUPLOAD PAGE
<?php
       include 'db.php';

    // initialization
   $photo_upload;
   $counter = 1;

  if( $_GET['number_of_fields'] )
  $number_of_fields = (int)($_GET['number_of_fields']);

  // Firstly Lets build the Category List
  $result = mysql_query( "SELECT category_id,category_name FROM gallery_category" );
  while( $row = mysql_fetch_array( $result ) )
  {
  $photo_category_list .=<<<__HTML_END
  <option value="$row[0]">$row[1]</option>\n
__HTML_END;
  }
  mysql_free_result( $result );  

  // Lets build the Photo Uploading fields
  while( $counter <= $number_of_fields )
  {
  $photo_upload;

__HTML_END;
  $counter++;
  }
// Final Output
echo <<<__HTML_END


<!-Insert the photo fields here -->
$photo_upload

 <html>
<head>
  <title>Lets upload Photos</title>
</head>
<body>
<table>
<tr>
   <td>     
<form name="upload_form" action="photos.php" method="post" enctype="multipart/form-data">
<p><b> 
Photo:  
<input name="photo_filename[]" type="file">
Caption:
<textarea name='name' cols='20' rows='1'></textarea></p><br>
<p>Photo:
<input name="pic_filename[]" type="file">
Caption:<textarea name='name2' cols='20' rows='1'></textarea></p>


<tr>
  <td>
       <input type='submit' name='submit' value='Add Photos' />
  </td>
</tr>
</table>
</form>
</body>
</html>
__HTML_END;
?>



-----------------------------
THE PICTURE VIEW PAGE:
------------------------------
<?php
  include 'db.php';


  // …
puddin 0 Junior Poster in Training

I understand your upset. I went crazy with sessions I have it working but still I do not completely understand it.

I will just show you what I have linking each page through my site and I have like 7 pages, I hope it helps you. I also have my pages setup , that if you try and enter, the page tells you, you must login in or signup... This worked for me:

If you look you will see it has two parts:

<?
include 'db.php';


// get the variables from home page
$password = $_SESSION;
$email_address = $_SESSION;



$sql_check = mysql_query("SELECT username FROM gallery_photos WHERE password='$password' AND email_address='$email_address'");


$username = mysql_fetch_array($sql_check,
MYSQL_ASSOC); //MYSQL_ASSOC;
$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){


echo ("");
} else {
echo ucfirst($username);
}

and

// Define post fields into simple variables
$email_address = $_SESSION;
$password = $_SESSION;


/* Let's strip some slashes in case the user entered
any escaped characters. */


$email_address = stripslashes($email_address);
$password = stripslashes($password);


/* Do some error checking on the form posted fields */


if((!$email_address) || (!$password)){
echo '<STRONG><br><br>Enter required fields as indicated below
<br>If you are a member!</STRONG><a
href="login_form.php"><u> Login Here</u></a>
<br><STRONG>To become a member!</STRONG><a
href="join_form.php"><u> Join Here</u>
</a><BR><br />';
if(!$email_address){
echo "<font color='#000000'>Email address is a required
field.</font><br />";
}
if(!$password){
echo "<font color='#000000'>Password is a required
field.</font><br />";
}
exit(); // if the error checking has failed, we'll exit the script!
}
?>
</p>

P.S And of course at the very top of the page you …

puddin 0 Junior Poster in Training

Hello.

I have an image system kinda working, when it uploads however it is uoloading calling all the images ARRAY.gif or ARRAY.jpg

Can you see what I should do that it correctly list the images name. The code is two parts. The preupload form page NEXT To The photos.php page where you see your image...

Thanks kindly any help is appreciated!

------------------------------

This is the preupload.php page
<?php
  include 'db.php';

// initialization
  $photo_upload_fields = "";
  $counter = 1;

// default number of fields
  $number_of_fields = 4; 

// If you want more fields, then the call to this page should be like, 
// preuploads.php?number_of_fields=20

  if( $_GET['number_of_fields'] )
  $number_of_fields = (int)($_GET['number_of_fields']);

  if( $_GET['category_name'] )
  $category_name =($_GET['category_name']);

  if( $_GET['name'] )
  $name =($_GET['name']);


// Firstly Lets build the Category List
  $result = mysql_query( "SELECT category_id,category_name FROM   
  gallery_category" );
  while( $row = mysql_fetch_array( $result ) )
  {
  $photo_category_list .=<<<__HTML_END
  <option value="$row[0]">$row[5]</option>\n  


__HTML_END;
  }
  mysql_free_result( $result );  

// Lets build the Photo Uploading fields
  while( $counter <= $number_of_fields )
  {
$photo_upload_fields.=<<<__HTML_END
<tr>
  <td>
       Photo {$counter}:
      <input name='photo_filename[]' type='file' />
  </td>
</tr>
<tr>
  <td>
       Caption:
      <textarea name='name[]' cols='80' rows='1'></textarea>
  </td>
</tr>
__HTML_END;
  $counter++;
  }

// Final Output
echo <<<__HTML_END
<html>
<head>
  <title>Lets upload Photos</title>
</head>
<body>
<form enctype='multipart/form-data' action='photos.php' method='post' name='upload_form'>
<table width='90%' border='0' align='center' style='width: 90%;'>
<tr>
  <td>
    Select Category
    <select name='category'>
    $photo_category
    <option>Woman
    <option>Man
      </select>
  </td>
</tr>

<tr>
  <td>
    <p>&nbsp;</p>
  </td>
</tr>

<!-Insert the photo fields here -->
$photo_upload_fields
<tr>
  <td>
          <input type='submit' name='submit' value='Add Photos' />
  </td>
</tr>
</table>
</form>
</body>
</html>
__HTML_END;
?> …
puddin 0 Junior Poster in Training

Good Day, PHP Members HELP W/DB Images


I am desperately trying to allow the user to put selected images into the database and than view them in the photo gallery. If you know the method please tell me. I have tried for 3 days.

I have in my database table with all other member slots so to say (this)

short_title varchar = 50
mime_ type varchar = 50
file_data Binary = blob

Once the file goes in, it looks like this:
----------------------------
[BLOB - 9 Bytes]

And the short-title enters
-----------------------------

I cannot get the mime type to appear.
-----------------------------

My code looks like this:

<form "method="POST" action="photos.php" name="imagefrm" enctype="multipart/form-data">
<input type="file" name="file_data" size="20">&nbsp;
<br>
<input type="text" name="short_title" size="20"> Short Description
<br>
<input type="Submit" name="Submit" value="Upload">
<input type="HIDDEN" name="$session_name" value="$session_id">
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
</H3>
</form>

<p class="vp">
<form name="Photo Gallery "method="POST" action="photoview.php">
<input type="Submit" value="View">
<input type="HIDDEN" name="$session_name" value="$session_id">
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
</p>
</form>

<H3 class="pic">
<?php
include 'db.php';

// get the variables from home page
$password = $_SESSION;
$email_address = $_SESSION;

$sql_update = mysql_query("UPDATE myd SET file_data='file_date',
short_title='$short_title', mime_type='$mime_type' WHERE
email_address='$email_address' AND password='$password'");

$fileHandle = fopen($file_data, "r");
$fileContent = stripslashes($file_data);

// P.S I have used: fread() fscanf() and others all I get is …

puddin 0 Junior Poster in Training

DO YOU KNOW WHY THIS IS NOT WORKING ALL THE TIME ONLY SOMETIMES!

okay on my Login Page I Have At The Very Top

<?php
session_start();
?>

FOLLOWED BY THE LOGIN FORM THAT GOES TO welcome.php PAGE

<table class="form">
<form name="login_form" method="POST" action="welcome.php">
<tr>
<td>
<p class="b">Email Address<br>
<input name="email_address" type="text" "$email_address" value="">
</p>



<p class="c">Password<br>
<input name="password" type="password" "$password" value="">
</p>


<p class="d">
<input type="HIDDEN" name="$session_name"  value="$session_id">
</p>


<p class="e"><input type="submit" name="Submit" value="Activate Here!">
</p>
</form>
</td>
</tr>
</table>

AS SHOWN THIS GOES TO THE welcome.php PAGE - NOW ON THE welcome.php PAGE AT THE VERY TOP I AGAIN HAVE :

<?php
session_start();
?>

FOLLOWED BY THIS CODE SECURITY AND THE USER IS GREETED BY NAME: Thanks To DGStudios! Helping me with that code.

<?
include 'db.php';


// get the variables from home page
$password = $_REQUEST;
$email_address = $_REQUEST;



$sql_check = mysql_query("SELECT username FROM myd WHERE password='$password' AND
email_address='$email_address'");
$username = mysql_fetch_array($sql_check, MYSQL_ASSOC); //MYSQL_ASSOC;
$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){


echo ("You Must Login Or Signup!");
} else {
echo 'Welcome '.$username;
}


// Define post fields into simple variables
$email_address = $_REQUEST;
$password = $_REQUEST;


/* Let's strip some slashes in case the user entered
any escaped characters. */


$email_address = stripslashes($email_address);
$password = stripslashes($password);


/* Do some error checking on the form posted fields */


if((!$email_address) || (!$password)){
echo '<STRONG><br><br>Enter required fields as indicated below
<br>If you are a member!</STRONG><a href="login_form.php"><u> Login Here</u></a>
<br><STRONG>To become a member!</STRONG><a href="join_form.php"><u> Join Here</u>
</a><BR><br />';
if(!$email_address){ …
puddin 0 Junior Poster in Training

Hi DGStudios,

I think hope you are seeing it poorly because of the browser - it is working on Internet explorer browser. I will figure out the different browsers for sure. So far Internet explorer browser seems Fine. I think you had a look from a different Browser! It has to be...

I will also look for that book! Is that the name dynamic pages. Like i'm going back to a few libraries this week! Good luck with what you are doing, Cheers!

puddin 0 Junior Poster in Training

You are a very nice person DGStudios

Thank-you so much you really made my day a big happy difference for me. I told my family and friends’ today “Good people do still exist in the world - I was referring to you! That was super of you!

I never thought to eliminate the update code and for the second part - I never seen a code like that so, I’d of not figured it out. I am so grateful to you really thanks a lot!
I am now closer to finishing my site.

The user is in and the address bar is perfect! It just shows the page as it should
www.puddinpatchdatematch.com /welcome.php - and the user can go back and forth without getting an error page - Thanks to you!

So I only now need to figure out how:

1) Again now that the user is in - When they click on any of the links like: your picture gallery or create your profile etc… The page has to come in without the address bar changing.

The address bar has to stay the same – mate1 uses this format how I do not know but it seems like a very safe neat and tidy format to use. The Welcome username is always displayed and the user is clearly in their account. It’s personalized I love it!

I do have it working thank goodness - That if the user is …

puddin 0 Junior Poster in Training

I contacted them and explained. Thaey did something cause it is working fine so it was something from their end for sure! it's working fine now. Thanks

puddin 0 Junior Poster in Training

Thanks for your reply , I am trying to still understand this and I should of added in i am trying to call the username of the email_address and password user that is in the database.

Now when they just signin not signup they only now need to enter their password and email_address and I have my request like this:

<?
include 'db.php';

// get the variables from home page
$password = $_REQUEST;
$email_address = $_REQUEST;

$sql_check = mysql_query("UPDATE members SET (the update) WHERE password='password'
AND email_address='$email_address'");
$sql_check = mysql_query("SELECT * FROM members WHERE password='$password' AND
email_address='$email_address'");


$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){

echo ("<STRONG>You must be a member!</STRONG>");
} else {
echo ("Welcome")," ", $username["username"];
}

?>

Because the form is only taking their email and password if I request username it is not working, My question is how can I get their username to Post and say Welcome to them with their username - how do i query and get their username to Post! I would be so happy if you could tell me, Thanks!

puddin 0 Junior Poster in Training

Hello

I read sessions and php but it's not exactly registering in my head that I understand it easily. On my site someone signups all is good they get their email and register sign in.

I have them signup with a Desired Username, Email address and Password okay. Now when they come back to sign in all that is required is their Email address and Password and I want them to be greeted once in by their desired username.

It is doing it but only keeping the first desired username, it doesn't register the new user it only keeps listing the 1st persons username. If you know what I should do I'd be really grateful! This is what I have

<?
include 'db.php';


// get the variables from home page
$password = $_REQUEST;
$email_address = $_REQUEST;


$sql_check = mysql_query("UPDATE members WHERE password='$password' AND
email_address='$email_address'");
$sql_check = mysql_query("SELECT * FROM members WHERE
password='$password' AND
email_address='$email_address'");


$SQL="SELECT * FROM members";
$RESULT=mysql_query($SQL);


//Get the result:
$username=mysql_fetch_array($RESULT);


$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){



//Display it:


echo ("<STRONG>You must be a member!</STRONG>");
} else {
echo ("Welcome")," ", $username["username"];
}


?>
puddin 0 Junior Poster in Training

Yes I will do that thanks,

I just said I going to double check I was not sure about the server that they could be be having a problem I'm actually shocked. No one should be ever touching my files but I wanted to post it and ask, I did not change anything in it and it worked perfect.

Geeee Wiz ... Thanks again!

puddin 0 Junior Poster in Training

Thanks for all your replies.

Here it is have you ever seen www.mate1.com. They have a site design I want to do. You signup get in and are brought to a page that is “Your Account

You have many link options, add your description, add your photo etc...

Now I signed in and none of my information is in the address bar, so I obviously did not get in with GET, nor does it seem did I get in with POST cause I can click on any link and click back without an error page... So I ask how this is done.

Better… I click on any link and the address bar never changes, so the pages I am clicking on are someway included with a very cool format I want to learn to do as well... That’s what I want to learn... Ohhhh I need a good paying job so I can hire a teacher to show me, I am sure I will be familiar with what I will be told cause I have read so much....

puddin 0 Junior Poster in Training

Thanks for all your replies. Here it is have you ever seen www.mate1.com. They have a site design I want to do. You signup get in and are brought to a page that is “ Your Account

You have many link options, add your description, add your photo etc...

Now I signed in and none of my information is in the address bar, so I obviously did not get in with GET, nor does it seem did I get in with POST cause I can click on any link and click back without an error page... So I ask how this is done. Better…

I click on any link and the address bar never changes, so the pages I am clicking on are someway included with a very cool format I want to learn to do as well...

That’s what I want to learn... Ohhhh I need a good paying job so I can hire a teacher to show me, I am sure I will be familiar with what I will be told cause I have read so much....

puddin 0 Junior Poster in Training

I do not know exactly how to do that... I wish I did! But it was working fine. I am convinced it is my server , you mean the people I host my webpage with. Ohhhh It's so upsetting. I so much want to learn this php and know how to bring it all together... Thanks for your reply

puddin 0 Junior Poster in Training

I am so stressed,


My membership signup was working fine. Now it's not emailing. It is entering into the database fine but not emailing can someone tell me what is the problem, Thanks Kindly I'm Exhausted...

To session_id is to the person who just signed up.

// Let's mail the user!
$to = "$session_id";
$subject = "Your Membership at Puddin Patch Date Match!";
$message = "Dear $username,
Thank you for registering at our website, http://www.puddinpatchdatematch.com!

You are two steps away from logging in and accessing our exclusive members area.

To activate your membership,
please click here: http://www.puddinpatchdatematch.com/login_form.php

Once you activate your memebership, you will be able to login
with the following information:
Password: $password
email_address: $email_address
Thanks!

The Webmaster

This is an automated response, please do not reply!";

mail($email_address, $subject, $message,
"From: www.puddinpatchdatematch.com Webmaster<admin@mydomain.com>\n
X-Mailer: PHP/" . phpversion());
echo 'Your membership information has been mailed to your email address!
Please check it and follow the directions!';
}

?>


</body>
</html>

puddin 0 Junior Poster in Training

Okay How Does The Pros Do It!

The user fills out the entry form and becomes activated. But I don't want the Post method because the user cannot go back without getting an error... And

I don't want the GET method because it shows in the address bar...

How do I do it. Let the user become activated and browse throughout the site freely without Get Or Post...

puddin 0 Junior Poster in Training

Hi

My php page will have links okay

I need to know how when a link is clicked for the php page to reappear with the include file but not automatically

I want the Include file only on click not include automatically...

I have it like this and it keeps including automatically....


<a href="http://www.puddinpatchdatematch.com/open.php<?include 'opener.inc'?>">Profiles</a>


PLZ Can you tell me how to correct this... Hours wasted PLZ Help!!!!

puddin 0 Junior Poster in Training

PHP Pros PLEASE Explain To Me : I have a page profiles.php

Now on the profiles.php page are several links and when the user clicks one of the links The address bar does not change -

The user sees the selected page they clicked maybe they clicked
add your photo or full in your profile etc... They are clicked through But!

In the address bar it shows profile.php so somehow these pages are on that page " Talk about Rock My World Please Tell Me How Do I This "

I Am Learning PHP - Is It PHP That Performs This


Much appreciated Thanks Puddin

puddin 0 Junior Poster in Training

ABOUT PART TWO...

The PART TWO ABOVE goes on the same page ...


<?
session_start();
?>

Goes at the very top of the page and the other part goes on the same page. Place it where you want it to show on your webpage

<?
echo $_REQUEST;
?>


It looks very nice but after viewing going to a next page and click try to go back you get an error message ... It won't go back. If you know how to correct this please let me know, Thanks!

puddin 0 Junior Poster in Training

Sorry here is the complete way to do it!

PART ONE:

On your FORM page add this part to the address:

?$username=<?echo $_POST["username"]?>"> After the .php address

I wanted the username to show up on my next page - $username is my variable

The link has to look like below with the above part added to the FORM address and any other links you want it to work with:

You start by adding it to your FORM address it looks like this:

<form action="welcome.php?$username=<?echo $_POST["username"]?>" method="post">
Username:<input type="text" name="username" value="" size="10">
&nbsp;&nbsp;Email Address:<INPUT TYPE="password" size=10 name="email_address">
&nbsp;<input type="submit" value= "Submit">
&nbsp;<input type="reset" value="Reset">
</form>


Than any other links you add to look like this:
<a href="http://www.your_link_page.php?$username=<?echo $_POST["username"]?>">


PART TWO:

On the page you want it to show up on at the very top of the page have :
<?
session_start();
?>
Check this session_start(); may need t be on both pages.

And last place this on the page you want to display your variable:
<?
echo $_REQUEST;
?>

It looks really nice and works Great!

puddin 0 Junior Poster in Training

I just got it!

echo $_REQUEST;


I hope this helps someone.

puddin 0 Junior Poster in Training

How to use sessions is what I am trying to understand!

I have the username on the 2nd page all is good, I have the username attached to the address
on the 3rd page,Like so,
http://www.puddinpatchdatematch.com/welcomed.php?$username=puddin
But I cannot get it to post on the darn page!

HOW DO I GET IT TO POST ON THE PAGE!!!

puddin 0 Junior Poster in Training

Hello,

Q.

With php I know we can Create a Form and have it POST to read on the next page. Great! NOW can it post to a third page, without using a form again. I just want to carry the users name around, so to say.

Design so my pages are personalized showing the users name whatever page they go to.

You see the username is Posting on page 2 this is what i want...
But! When the user clicks a next 3rd page I cannot get their name to show automatically - I want it to show like it did on page 2, It can't be the user has to enter their username on a form again and again.

P.S - My register_global are off and I have no access to my php.ini file
none of these can be configured, So I need to know how to do it without what register_globals OFF and the php.ini file default at 0 ....


The answer will be much appreciated! A big Thank-you

puddin 0 Junior Poster in Training

Thank-you for replying me, it is working! I cannot switch at this time, I feel awful! I will certainlly consider you if I get a second site (Which is very likely) and I will recommend you! I Promise.
Now I must fine tune (learn) how to script my php ...

Thank-you again so much

puddin 0 Junior Poster in Training

Hi,

I am with a web host using mysql 4.0 and phpmyadmin 2.5.5 p\1

I am trying to get my html user form on my website to insert into mysql database. I keep getting:

Error! Could not select the database: Access denied for user: 'match.match.com@10.80.0.%' to database 'mydb'

Can you tell me is this error because the web host has not set permission for me Or what else it may be. Last...

I am new to mysql and phpmyadmin but i feel i am understanding it good enough to perform small functions.

And one of the fellas at the hosting company suggested maybe i best go with a dedicated server.

Can you tell me, to have a small online site with user login be able to use mysql and php myadmin smoothly is a dedicated server the way i should go! Thank-You

puddin 0 Junior Poster in Training

Hi I am so Desperate!

I am using a server internic.ca to host my website my package includes
MySQL with phpMyAdmin 2.5.5-p\1
I seem to be able to make the table fine beyond that I cannot understand…
How do I use this phpMyAdmin 2.5.5-p\1
I am trying to setup a Membership System it consist of several
Php files – I cannot figure out how to bring them in…
My public directory doesn’t let them work,
Adding them in the Tables SQL doesn’t work….
Can Anyone Please Help In Giving Me Some Direction;
much appreciated! Thanks

puddin 0 Junior Poster in Training

on the index.php page under create new database listed is no Priviligies. How can i correct this.

it seem to be working fine but then i think i played around with priviligies to get mamboserver working. after that all my databases were gone and i can't seem to add new databases as NO PRIVILIGIES is stopping me doing it.
Thanks in advance.

I had the same problem, 1st however it let's you create a database name do that - Example: users_ (The underscore must be after the name ok save that)

Now be sure you have Editedphp your password and saved it...

Now do you know your Username from your server... It is usually is your websites name but it has a first part than a .(Dot) followed by your websites name.com
Example: your websites name is john.com - Your user name would be : john.john.com

Okay after you have that Go to log on but! -
Erase everything on the Username and Password entry. Start new Re-Type It All Correctly In The Username and Password - It should work fine, Good Luck!

puddin 0 Junior Poster in Training

Hi I am so Desperate!

I use a server internic.ca which host my website and offers me
MySQL with phpMyAdmin 2.5.5-p\1

I seem to be able to make the table fine beyond that I cannot understand…
How do I use this phpMyAdmin 2.5.5-p\1
I am trying to setup a Membership System it consist of several
Php files – I cannot figure out how to bring them in…

My public directory doesn’t let them work,
Adding them in the Tables SQL doesn’t work….
Can Anyone Please Help In Giving Me Some Direction,

This would sincerely be much appreciated!