Jump to content

justAnoob

Members
  • Posts

    561
  • Joined

  • Last visited

    Never

Everything posted by justAnoob

  1. Check out the commented lines <?php session_start(); include "connection.php"; mysql_connect("$host", "$username", "$password") or die("Could not connect."); mysql_select_db("$db_name") or die("Could not find database"); $sendto = mysql_real_escape_string($_POST['sendto']); $subject = mysql_real_escape_string($_POST['subject']); $message = mysql_real_escape_string($_POST['message']); $findit = $_SESSION['id']; //if i comment this line out,, of course the user_id does not get inserted into the database $from = $_SESSION['id']; // so why wouldn't this line work, can i not use 2 variables from the same session variable $result=mysql_query("SELECT id FROM members WHERE username = '$findit'"); $row=mysql_fetch_assoc($result); $user_id = $row['id']; $sql = "INSERT INTO member_messages(user_id, sendto, subject, message, from)VALUES('$findit', '$sendto','$subject','$message', '$from')"; mysql_query($sql) or die('There was an error.'); mysql_close(); ?>
  2. Will try a few things,, will call this solved til later.
  3. what do you mean make a copy ..... this is from the login that defines the session variable <?php $_SESSION['id1'] = "$username"; //something like this,, tried it,, doesn't work $_SESSION['id'] = "$username"; ?>
  4. <?php session_start(); include "connection.php"; mysql_connect("$host", "$username", "$password") or die("Could not connect."); mysql_select_db("$db_name") or die("Could not find database"); $sendto = mysql_real_escape_string($_POST['sendto']); $subject = mysql_real_escape_string($_POST['subject']); $message = mysql_real_escape_string($_POST['message']); $findit = $_SESSION['id']; $from = this needs to be $_SESSION['id'] also,, but it wont let me,, just get an error //read this line $result=mysql_query("SELECT id FROM members WHERE username = '$findit'"); $row=mysql_fetch_assoc($result); $user_id = $row['id']; $sql = "INSERT INTO member_messages(user_id, sendto, subject, message, from)VALUES('$findit', '$sendto','$subject','$message', '$from')"; mysql_query($sql) or die('There was an error.'); mysql_close();
  5. i need to get the username of the user that is signed in to send it to 2 different rows in mysql. one of my variables is $findit = $_SESSION['id']..... i need to use that session id for another variable for another row in the database... and yes,,, i need to have the name in two spots in the database(same table) what can i do to get the username again
  6. users will be upload images to my site. as long as i limit the upload script to only accept image files and no to php, html, etc,,,,, shouldn't I be ok????
  7. My site is almost finished. Could a hacker somehow get access to my php files on my server to alter them or upload a script to alter my site??? Just want to be safe.
  8. don't you hate when you upload a file into the wrong directory
  9. Ummm,,, yeh.... Basically the link doesn't work when I click on the picture.... It just stays at the same page... My page does not recoginize that the picture is a link.. Something is wrong with the one line that I posted... But can't find what it is.
  10. Sorry, you know when your link works properly, you get the cursor change to that little hand.. It is not changing for me,, just stays as the arrow cursor.
  11. What? Need more info. What are you trying to do?
  12. my href doesn't work. i don't see the problem. do you? <?php echo '<div id="apDiv10"><a href="xxxxxxxxxxx.php"><img src="images/picture.png" width="91" height="20" /></a></div>'; ?>
  13. K_little.png is just a picture on the server that I want to display, it does not have a image path in mysql. It is this line of code that I want it to display in. I can get it to display, but not in the format that I want. Here is what is does now. <?php echo "<img src=\"images/K_little.png\">"; ?> K K K column 1 column 2 column 3 column 4 xx xx xx xx xx xx xx xx xx this is how I would like it to be column 1 column 2 column 3 column 4 xx xx xx K xx xx xx K xx xx xx K
  14. K_little.png picture is still echoing above the table. Not in the user info column of my table.
  15. The following works great and display properly except for the part in the table where I want a letter to appear. The letter is just saved in my images folder on my server. The letter will eventually get a link, but I'm not worried about that right now. look below at the commented sections for what my problem is. <?php echo "<tr><td>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; //works good echo "</td><td>"; echo $row['student']; //good echo "</td><td>"; echo $row['description']; //good echo "</td><td>"; echo $row['in_return']; //good echo "</td></td>"; echo '<img src="images/K_little.png">'; //the picture appears,, but not in table format like the rest of echo "</td></tr>"; //rows from mysql. All the info is in mysql, except for the K_little } echo "</table>"; ?> Will this be a problem getting the K_little to appear on the page in the format I would like. Right now the K_little echos above the table and not inside it like the data from mysql. The table will keep displaying students until no more are in the system. So the letter K_little.png picture needs to be displayed in the letter column of the table for each student,,,, Understand??? ------------------------------------------| |student description in return letter | | xxxxx xxxxx xxxx k | | xxxx xxxxx xxxxx k | | xxxxx xxxxx xxxxx k
  16. Still can't get image to display,,, just the image path. <?php // "<img src='/userimages/cars/>" this is the image path where the pics are echo "<tr><td>"; echo $row['imgpath']; //this only echos the actuall image path, not the pic ?> <?php echo "<img src='/userimages/cars/pic.jpg>"; //if i enter one of the picture names in the code, the same picture is for every entry displayed, so atleast i know that the path is correct and the images will display. ?> this might help showing you the whole script. <?php mysql_connect("xxxxxx","xxxxx","xxxxx"); mysql_select_db("xxxxxx"); $sql = mysql_query("SELECT imgpath, item_name, description, in_return FROM xxxxxx"); echo "<table border='0' CELLPADDING=5 STYLE='font-size:16px'>"; echo "<table border=1> <tr> <td><H3>Image </h3></td> <td><H3>Item Name</H3></td> <td><H3>Description</H3></td><td><H3>Seeking</H3></td></tr>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td>"; echo $row['imgpath']; echo "</td><td>"; echo $row['item_name']; echo "</td><td>"; echo $row['description']; echo "</td><td>"; echo $row['in_return']; echo "</td></tr>"; } echo "</table>"; ?> so it has to be something minor to get the images to display for each row of the datase
  17. Here is something that I use to display all the pictures from a folder on my server. Hope this helps. Just change the $imgPath to what your folder configuration is, and change to picture extensions if you want <?php $imgPath = "userimages/Computers"; foreach(glob("$imgPath/{*.jpg,*.png,*.gif}", GLOB_BRACE) as $fname) { echo '<img src="' . $imgPath . '/' . baseName($fname) . '" width="150" border="1"><br/><br/>'; } ?>
  18. I guess the question is how do i let it know that <?php echo $row['imgpath']; ?> is actually this for each image in that row <?php <img src='/userimages/cars/'> ?>
  19. What???,, not sure what your saying.... when user logs in,, just do something like <?php $_SESSION['auth'] = "yes"; ?> Usually once you close the browser, it will kill the session. That is what I have noticed. But I'm new to all this stuff also.
  20. If I put an exact name in the path,,, it works but pulls the same picture for every entry..I would like the pictures to dispaly like the other rows in the database, row by row.. <?php echo "<img src='/userimages/cars/1238640191.jpg'>"; ?>
  21. I tired changing the path to this. /x/x/x is the first 3 letters of my login,,, and xxxxxxx is my full login. But still nothing. <?php echo "<img src='/home/content/x/x/x/xxxxxxx/html/userimages/cars/*.jpg,*.png,*.gif'>"; ?>
  22. Someone told me that the path that is saved in MySQL is not the path that you would call to display the image. But then I read differently on google. So right now the path below is the path that is saved in MySQL. What else could I try. I just get a little box with an "x" inside it instead of a picture. Here is my code. Any help would be much appreciated. Thanks. <?php mysql_connect("*****","******","*******8"); mysql_select_db("*****"); $sql = mysql_query("SELECT imgpath, x, xx, xxx FROM students"); echo "<table border='0' CELLPADDING=5 STYLE='font-size:16px'>"; echo "<tr> <td><H3>Image </h3></td> <td><H3>x</H3></td> <td><H3>xx</H3></td><td><H3>xxx</H3></td></tr>"; // grab all til no more while ($row = mysql_fetch_array($sql)) { // dispaly in table format echo "<tr><td>"; echo "<img src='/userimages/cars/*.jpg,*.png,*.gif'>"; echo "</td><td>"; echo $row['x']; echo "</td><td>"; echo $row['xx']; echo "</td><td>"; echo $row['xxx']; echo "</td></tr>"; } echo "</table>"; ?>
  23. A little red x appears in the where the picture should be. What's wrong? <?php mysql_connect("xxxxxxxxx","xxxxxxxxx","xxxxxxxxx"); mysql_select_db("xxxxxxxx"); $result = mysql_query("SELECT imgpath, student, description, in_return FROM xxxxxx"); while($x=mysql_fetch_array($result)) { $imgpath=$x["imgpath"]; $item_name=$x["student"]; $description=$x["description"]; $in_return=$x["in_return"]; echo "<img src='userimages/computers/'><br>"; echo " Trade Item: $item_name<br>"; echo "Description: $description<br>"; echo " Seeking: $in_return"; } ?>
×
×
  • 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.