Jump to content

elviapw

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by elviapw

  1. This error reports 3 times. Help! Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /home/content/-/-/html/wp-includes/functions.wp-styles.php on line 26 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /home/content/-/-/html/wp-includes/functions.wp-scripts.php on line 68 Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /home/content/-/-/html/wp-includes/script-loader.php on line 661
  2. Okay, wonderful, thank you. Now that it's told me there is 1 error, how do I sniff it out? I already knew there was something wrong, but can't figure it out..
  3. I don't -- I've never used it before. Where should I place it?
  4. Hello! This is the code for the header of my blog. It isn't displaying the CSS correctly, and the links aren't working. I think there is something wrong with the PHP, but am totally blind. Any ideas? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php wp_title('//', true, 'right'); ?> <?php bloginfo('name'); ?></title> <meta name="description" content="<?php bloginfo('description'); ?>" /> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/colours.css" type="text/css"/> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> <?php wp_head(); ?> </head> <body id="top" class="<?php echo setColourScheme(); ?>"> <div id="header"> <div class="blog-name"><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></div> <div class="description"><?php bloginfo('description'); ?> </div> <ul id="menu"> <li><a href="<?php echo get_option('home'); ?>/" <?php if(is_home()) {echo 'class="selected"';} ?>>HOME</a></li> <li><a href="http...com">MAG</a></li> <li><a href="http...com">ABOUT</a></li> <li class="last"><a href="http...com">SUBSCRIBE</a></li> </ul> <div class="clearboth"><!-- --></div> </div> </body> Thanks so much! Elvia
  5. I finally figured it out with the following code. Thank you so much for your help! The explanations of the code are much, much better on the version King Philip helped me with -- my notes are pretty bad. To answer your question knsito, I want each person to have a distinct password that I give them and that de-activates after its first use, not a universal password that changes, and not something I have to manually change, if either of those options are what you were suggesting. <html> <head> <title></title> </head> <body> <?php $human = $_REQUEST['human']; if (($human == "elvia" ) || ($human == "roger" ) || ($human == "dano1" )) { $dbh = mysqli_connect("97.74.218.137", "artnet", "Ladybugs1", "artnet"); //search for name in database $sql = "SELECT * FROM artnet WHERE username = '".$human."' LIMIT 1"; $query = mysqli_query($dbh, $sql); // if we had a result if(mysqli_num_rows($query) > 0) { // that means the name was already in the DB echo"NAMES ALREADY HERE!!!!"; } else { echo"YOUGITINNN YES"; // Add to DB $query2 = "INSERT INTO artnet (username) VALUES ('".$human."')"; if (mysqli_query($dbh, $query2)) { echo "NAME IN DATABASE"; } else { echo "NAME NOT IN DB"; } } } else { //else, YOUR NAME IS NOT IN THE PARTY echo"DENIED USERNAME"; } ?> </body> </html> Still adding some error reporting, etc, as suggested by KingPhillip, but in the meantime, I'm wondering now if anyone can suggest the best way to make it impossible to access the page again, after being admitted once, by using the forward and back buttons on the browser. How can you make the page completely inaccessible except by password? THANK YOU!
  6. Getting closer... it still admits anyone whose name is on the list every time. In my table I only have one field called "username" and if anyone logs in, their name is added as a row.. so, I'm not sure I understand the last suggestion. Could you tell me what the table would look like for your suggestion? would it have a field called "viewed" ? Here's what I have now: <html> <head> <title></title> </head> <body> <?php $human = $_REQUEST["human"]; if (($human == "elvia" ) || ($human == "roger" ) || ($human == "dano1" )) { $dbh = mysqli_connect("--"); //search for name in database $sql = ("SELECT * FROM artnet WHERE username = '.$human.' "); $query = mysqli_query($dbh, $sql); if ($query) { echo"YOU GET IN"; $sql2 = ("INSERT into artnet (username) VALUES ('$human')"); //or, YOU ALREADY GOT IN ONCE } else { echo"NAMES ALREADY HERE"; } } //else, YOUR NAME IS NOT IN THE PARTY else { echo"DENIED"; } ?> </body> </html>
  7. more progress on php, but it always returns the "YOU ALREADY SAW IT" message. Can't get it to admit me if I'm a new user. <html> <head> <title></title> </head> <body> <?php $human = $_REQUEST["human"]; if (($human == "elvia" ) || ($human == "roger" ) || ($human == "tally" ) ) { $dbh = mysqli_connect("--"); //search for name in database $sql = ("SELECT * FROM artnet WHERE username = '.$human.' "); $query = mysqli_query($dbh,$sql); if (!$query) { echo"YOU GET IN"; // ENTER NAME IN DATABASE $sql2 = ("INSERT into artnet (username) VALUES ($human)"); $query2 = mysqli_query($dbh,$sql2); //NOW YOU GET IN } else { echo"YOU ALREADY SAWIT"; } } ?> </body> </html>
  8. Here the code so far. I've limited the ambition to having only a username and no password. Here is the form where users can enter their usernames: <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>login</title> </head> <body> <form action="LOGINONCE.php" method="post"> <font color="#66FF99" style="font-style:italic" face="Times"> please enter username</font><br/><br /><input type="text" name="human" /><br /><br/> <input type="submit" name="Submit" value="lawgg in!"/><br /> </form> </body> </html> And her is the PHP I am working on. To reiterate, I'm trying to admit users to the webpage ONLY if they have not visited before. If they have visited before, they will be denied. I'm starting out with two users for simplification's sake. <html> <head> <title></title> </head> <body> <?php $human = $_REQUEST["human"]; if (($human == "elvia" ) || ($human = "tom")) { $dbh = mysqli_connect("--", "--", "--", "--"); //search for username in database to see if person has already entered $query = mysqli_query("SELECT * FROM artnet WHERE username = '.$human.' "); //If person is not in database, then their name is entered into the database and they are admitted to the site //If they are already in the database, they are denied access to the site } ?> </body> </html> As you can see I do not know how to admit the user ONLY if their name does not already appear in the database. Can anyone help with the coding on this? Thank you!
  9. I'm trying to write a script that will allow a user to sign in with a password I've given them. The password can only be used to access the page once, and then it will be automatically disabled. I'm having trouble conceptualizing how to do this. Does anyone have any suggestions for the simplest way to do this? Thanks so much!
  10. I wrote a php form that allows members to log in and post to a blog. I'm wondering if there is a simple way to make sure that whenever a url is posted to the form, it will automatically be converted to a link so as to be clickable when it appears on the blog. I'm not sure which code to modify for this task -- the code that displays the information from the form, or on the form itself. I'm happy to post the code once I know which one makes more sense. Thanks for your help!
  11. I've made a blog where users can post and make comments on each others' posts. I'd like to make it possible to click on the name of the person who made a post in order to see ALL the posts they have made. In order to do this, my plan was to pass the name of the poster through the URL to the page "personal.php", and then display the posts WHERE the name of the poster matches the name in the field 'Human' in my mysql table. I think I must be going about this all wrong. Help! Here is the php code for the page so far (it includes a maximum of 10 rows per page stipulation): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <div style='border-style:solid; border-width:1px; width:100px; bordercolor:white; cellpadding=:20; position: absolute; top: 20px; left:200px; width:800px; text-align: left'> <?php $dbh = mysqli_connect("", "", "", ""); $pagenum = $_GET['pagenum']; if (!(isset($pagenum))) { $pagenum = 1; } $sql = "SELECT * FROM Posts"; $query = mysqli_query($dbh,$sql); while($feed = mysqli_fetch_assoc($query)) { $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $id = $feed['id']; $human = $feed['Human']; $pic = $feed['image_url']; $pic2 = $feed['image_url2']; $pic3 = $feed['image_url3']; $personal = $_GET['human']; echo "personal $personal$personal$personal/$human"; $sql3= "SELECT * FROM Posts ORDER BY id DESC $max"; $query3 = mysqli_query($dbh,$sql3); $rows = mysqli_num_rows($query3); $page_rows = 10; $last = ceil($rows/$page_rows); if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; echo "<a style='text-decoration:none' href='personal.php?human=$human'><font style='font-style:italic;font-size:11px' face='Times' align='left'>$human</font></a><br/>"; echo "<font style='font-size:11px' face='Times' align='left'>$date</font><br/><br/>"; echo "<font face='Georgia, Times New Roman, Times, serif' color='#999999'>$title</font><br/>\n"; echo " <p>$post</p><br/>\n"; if ( !empty($feed['image_url']) ) { echo "<img src= '$pic'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url2']) ) { echo "<img src= '$pic2'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url3']) ) { echo "<img src= '$pic3'/><br/><br/>"; } else { echo " "; } echo "<div align='right'>"; echo " <a style='text-decoration:none' href='comment1.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3&human=$human'><font color='#FFCC33' style='font-style:italic' face='Times'>comment on this post</font><br/></a>\n"; echo " <a style='text-decoration:none' href='delete.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3&human=$human'><font color='#66FF99' style='font-style:italic' face='Times'>delete this post</font><br/></a>\n"; $sql4 = "SELECT comment_id FROM Comments WHERE comment_id=$id"; $query4 = mysqli_query($dbh,$sql4); if($query4) { $feed2 = mysqli_fetch_assoc($query4); $commentid = $feed2['comment_id']; if ( !empty($feed2['comment_id']) ) { echo " <a style='text-decoration:none' href='viewcomments.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'><font color='#66FF99' style='font-style:italic' face='Times'> see comments on this post</font><br/></a>\n"; } else { echo "no comments yet"; } } echo "</div><hr />"; } echo "</center>"; echo "<font color='#FF6600'><center><br/>Page $pagenum of $last</center></font>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <center> <<-First </center></a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <center> <-Previous </center></a> "; } if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'> <center> Next -> </center></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'> <center> Last ->> </center> </a> "; } echo"</body> </html>" ?> </body> </html> and here's the link to the page from the main page: echo "<a style='text-decoration:none' href='personal.php?human=$human'><font style='font-style:italic;font-size:11px' face='Times' align='left'>$human</font></a><br/>";
  12. I've created a website where users can post entries. I want to alter the PHP so that after displaying the 10 most recent posts, the user can click "next" to see the next ten. I don't really know how to go about this, though I'm sure it's a common problem. here is the code so far: <?php $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date, Human, image_url, image_url2, image_url3, id FROM Posts ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); echo "<html> <head></head><title>velcome</title> <body><center> <font style='color:#00FFFF;font-family:futura,helvetica; font-size:240px'> TITLE </font></center> <div style='background: white; border-width: medium; font-family:times; font-size:16px; float: left; position: absolute; top: 615px; width:80px'> <br/><br/><br/><br/> <a style='text-decoration:none' href='http://eadersdigest.com/projecks/projecks.html'><font color='#99CC00'><i>projecks</i></font></a><br/> <a style='text-decoration:none' href='http://--/members.html'><font color='#99CC00'><i>digestion</i></font></a> <br/><br/><br/> frendz >><br/> <a style='text-decoration:none' href='http://--/login.html'><font color='#FF6600'><i>LAWG IN</i></font></a> <br/><br/> </div> <table style='border-style:solid; margin-left: auto; margin-right: auto; margin-top: 40px; width:800px' bordercolor='#999999' cellpadding='20'>"; if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_assoc($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $id = $feed['id']; $human = $feed['Human']; $pic = $feed['image_url']; $pic2 = $feed['image_url2']; $pic3 = $feed['image_url3']; echo "<tr >\n"; echo "<td >\n"; echo "<a href='archive.php'><font face='Georgia, Times New Roman, Times, serif' color='#999999'>$title</font></a>\n"; echo "<div align='right'>$date</div><br/>"; echo "<div align='right'>$human</div><br/>"; echo " <p>$post</p><br/>\n"; if ( !empty($feed['image_url']) ) { echo "<img src= '$pic'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url2']) ) { echo "<img src= '$pic2'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url3']) ) { echo "<img src= '$pic3'/><br/><br/>"; } else { echo " "; } echo "<div align='right'>"; echo " <a style='text-decoration:none' href='comment1.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'><font color='#FFCC33' style='font-style:italic' face='Times'>comment on this post</font><br/></a>\n"; echo " <a style='text-decoration:none' href='delete.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'><font color='#66FF99' style='font-style:italic' face='Times'>delete this post</font><br/></a>\n"; $sql2 = "SELECT comment_id FROM Comments WHERE comment_id=$id"; $query2 = mysqli_query($dbh,$sql2); if($query2) { $feed2 = mysqli_fetch_assoc($query2); $commentid = $feed2['comment_id']; if ( !empty($feed2['comment_id']) ) { echo " <a style='text-decoration:none' href='viewcomments.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'><font color='#66FF99' style='font-style:italic' face='Times'> see comments on this post</font><br/></a>\n"; } else { echo "no comments yet"; } } echo "</div><hr />"; echo "</td >\n"; echo "</tr>\n"; } echo "</table>\n"; echo "</center>"; echo"<a style='text-decoration:none' href='http://--/archive.php'><font color='#FF6600'><center><br/>archive</center></font></a>"; } echo"</body> </html>" ?>
  13. yes, of course. i'm so sorry -- i tried to take out the html formatting because it is very clumsy and i figured it would just add to the confusion. but here's the whole ugly thing: <?php $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date, image_url, image_url2, image_url3, id, comment, comment_id, person FROM Posts, Comments ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); echo "<html> <head></head><title>velcome</title> <body><center> <font style='color:#00FFFF;font-family:futura,helvetica; font-size:240px'> EATERS DIGEST </font></center> <div style='background: white; border-width: medium; font-family:times; font-size:16px; float: left; position: absolute; top: 615px; width:80px'> <br/><br/><br/><br/> <a style='text-decoration:none' href='http://eadersdigest.com/projecks/projecks.html'><font color='#99CC00'><i>projecks</i></font></a><br/><br/> <a style='text-decoration:none' href='http://eadersdigest.com/members.html'><font color='#99CC00'><i>digestion</i></font></a> <br/><br/><br/> frendz >><br/> <a style='text-decoration:none' href='http://eadersdigest.com/login.html'><font color='#FF6600'><i>LAWG IN</i></font></a> <br/><br/> </div> <table style='border-style:solid; margin-left: auto; margin-right: auto; margin-top: 40px; width:800px' bordercolor='#999999' cellpadding='14'>"; if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_array($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $id = $feed['id']; $pic = $feed['image_url']; $pic2 = $feed['image_url2']; $pic3 = $feed['image_url3']; echo "<tr >\n"; echo "<td >\n"; echo "<a href=\'archive.php'><font face='Georgia, Times New Roman, Times, serif' color='#999999'>$title $id</font></a>\n"; echo "<p>$date</p><br/>"; echo " <p>$post</p><br/>\n"; if ( !empty($feed['image_url']) ) { echo "<img src= '$pic'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url2']) ) { echo "<img src= '$pic2'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url3']) ) { echo "<img src= '$pic3'/><br/><br/>"; } else { echo " "; } echo " <a href='delete.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'>delete</a>\n"; echo " <a href='comment1.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'>comment on this post</a>\n"; $comment = $feed['comment']; $person = $feed['person']; $commentid = $feed['comment_id']; if ( ($commentid == $id) ) { echo "comments <br/> $person <br/> $comment"; } else { echo " "; } echo "<hr />\n"; echo "</td >\n"; echo "</tr>\n"; } echo "</table>\n"; echo "</center>"; echo"<a style='text-decoration:none' href='http://eadersdigest.com/archive.php'><font color='#FF6600'><center>archive</center></font></a>"; } echo"</body> </html>" ?>
  14. I'm trying to make it possible for users to comment on other users' posts on a website. Both the comments and the posts are stored in a mysql database (the images are linked to a server). I've managed to get the page to display ONE comment linked with the correct post, but when more than one comment is made on the same post, the ENTIRE post displays itself twice. In fact, EVERY post displays itself twice. How can I make this work better? Here's the code: <?php $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date, image_url, image_url2, image_url3, id, comment, comment_id, person FROM Posts, Comments ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); echo "<html> <head></head><title>velcome</title> <body> if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_array($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $id = $feed['id']; $pic = $feed['image_url']; $pic2 = $feed['image_url2']; $pic3 = $feed['image_url3']; echo "<tr >\n"; echo "<td >\n"; echo "<p>$date</p><br/>"; echo " <p>$post</p><br/>\n"; if ( !empty($feed['image_url']) ) { echo "<img src= '$pic'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url2']) ) { echo "<img src= '$pic2'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url3']) ) { echo "<img src= '$pic3'/><br/><br/>"; } else { echo " "; } echo " <a href='delete.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'>delete</a>\n"; echo " <a href='comment1.php?id=$id&Title=$title&Content=$post&Date=$date&image_url=$pic&image_url2=$pic2&image_url3=$pic3'>comment on this post</a>\n"; $comment = $feed['comment']; $person = $feed['person']; $commentid = $feed['comment_id']; if ( ($commentid == $id) ) { echo "comments <br/> $person <br/> $comment"; } else { echo " "; } echo "<hr />\n"; echo "</td >\n"; echo "</tr>\n"; } echo "</table>\n"; } echo"</body> </html>" ?>
  15. I'm stumped-- I'm trying to display more than one image from a server via its url in a mysql database. the first image works fine, but the second two images just won't show up. I've checked the database and I know the image_url2 is there for the second image I want to display. here's the code: <?php $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date, image_url FROM Posts ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_array($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $pic = $feed['image_url']; $pic2 = $feed['image_url2']; $pic3 = $feed['image_url3']; echo "<tr >\n"; echo "<td >\n"; echo "<a href=\'archive.php'><font face='Georgia, Times New Roman, Times, serif' color='#999999'>$title</font></a>\n"; echo "<p>$date</p><br/>"; echo " <p>$post</p><br/>\n"; if ( !empty($feed['image_url']) ) { echo "<img src= '$pic'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url2']) ) { echo "<img src= '$pic2'/><br/><br/>"; } else { echo " "; } if ( !empty($feed['image_url3']) ) { echo "<img src= '$pic3'/><br/><br/>"; } else { echo " "; } echo " <a href='delete.php'>delete this p0st</a>\n"; echo "<hr />\n"; echo "</td >\n"; echo "</tr>\n"; } echo "</table>\n"; echo "</center>"; echo"<a style='text-decoration:none' href='/archive.php'><font color='#FF6600'><center>archive</center></font></a>"; } echo"</body> </html>" ?>
  16. the whole function works if i have $newname = dirname(__FILE__).'/posts/'.$filename; but as soon as i change it to $newname = '/posts/'.$filename; it stops working. can anyone help me with this??
  17. YES! it works! the image displays. wonderful. thank you. but suddenly i have encountered another problem, maybe not linked to the first. suddenly when i try to post a new picture i get this error message: Warning: move_uploaded_file(/posts/lemonade.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/content/e/l/v/elviapw/html/posted.php on line 16 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpjEv1eY' to '/posts/lemonade.jpg' in /home/content/e/l/v/elviapw/html/posted.php on line 16 Error: A problem occurred during file upload!lemonade qww22 22ee which is very strange, because the form worked fine before, and because i KNOW that the folder exists and contains images. HELP!
  18. it won't let me modify my above post, so i'm reposting below with the modified pary in bold (so sorry for the inconvenience) you're right-- i had taken out "img_src" from the request list... now the code reads like this: $sql = "SELECT Title,Content,Date, image_url FROM Posts ORDER BY id DESC"; but it makes no difference! somehow, the images still show up as little icons instead of the real thing. when i echo out "$pic", it prints the URL just fine. i tried changing the input form so that the url gets saved in lots of different ways: /posts/ggallin.jpg /home/content/e/l/v/elviapw/html/posts/ggallin.jpg dirname/posts/ggallin.jpg websitename.com/posts/ggallin.jpg all of these urls print directly when i ask it to print $pic. so i know the image_url can be retrieved from the database, but for some reason the image itself just won't show up on the page. it will show up if type the url /posts/ggallin.jp directly into the <img src> tag (only this url), but i want the images to appear within the posts automatically when they are uploaded. any more thoughts?? i'm totally stumped!! here's the portion of code under question one more time: $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date, image_url FROM Posts ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_array($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $pic = $feed['image_url']; echo "<img src='$pic;' />";
  19. you're right-- i had taken out "img_src" from the request list... now the code reads like this: $sql = "SELECT Title,Content,Date, image_url FROM Posts ORDER BY id DESC"; but it makes no difference! somehow, the images still show up as little icons instead of the real thing. when i echo out "$pic", it prints the URL just fine. i tried changing the input form so that the url gets saved in lots of different ways: /posts/ggallin.jpg /home/content/e/l/v/elviapw/html/posts/ggallin.jpg dirname/posts/ggallin.jpg websitename.com/posts/ggallin.jpg all of these urls print directly when i ask it to print $pic. so i know the image_url can be retrieved from the database, but for some reason the image itself just won't show up on the page. it will show up if type any of the above urls directly into the <img src> tag, but i want the images to appear within the posts automatically when they are uploaded. any more thoughts?? i'm totally stumped!! here's the portion of code under question one more time: $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date, image_url FROM Posts ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_array($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $pic = $feed['image_url']; echo "<img src='$pic;' />";
  20. I have created a php form that allows a user to upload text and an image to a server. the text and the image url are stored in a mysql server. the aim is to retrieve the image from the server, according to the information stored in the database, and to display the image and the text on the website. all the text works, but the image won't show up-- only a small icon where the image should be. i know that images CAN show up on the website, because a direct img src link works just fine. i'm going to post all three forms to make it easier to see how they connect. first, here is the html script: <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>post</title> </head> <body> POST<br/><br/> <form enctype="multipart/form-data" action="posted.php" method="POST"> title:<br /> <input type="text" name="title" size="93"/> (optional)<br /> date: <br/> <input type="text" name="date" /> (JAN 10 09)<br/> words:<br /> <textarea rows="50" cols="80" name="post"></textarea><br /> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> picture: <input name="uploaded_file" type="file" /><br /> <input type="submit" value="POST DIT" /> </form> </body> </html> and here is the php script that uploads the information to the mysql database and the image to the server: <?php //Сheck that we have a file if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) { //Check if the file is JPEG image and its size is less than 350Kb $filename = basename($_FILES['uploaded_file']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 350000)) { //Determine the path to which we want to save this file $newname = '/posts/'.$filename; //Check if the file with the same name is already exists on the server if (!file_exists($newname)) { //Attempt to move the uploaded file to it's new place if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) { echo "It's done! The file has been saved as: ".$newname; } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists"; } } else { echo "Error: Only .jpg images under 350Kb are accepted for upload"; } } else { echo "Error: No file uploaded"; } mysql_connect("--", "--", "--", "--") or die(mysql_error()) ; mysql_select_db("--") or die(mysql_error()) ; $title = $_POST['title']; $post = $_POST['post']; $date = $_POST['date']; $id= mysql_insert_id(); $size= ($_FILES["uploaded_file"]["size"]); mysql_query("INSERT INTO Posts (Title,Content,Date, image_url, image_name, image_type, image_size) VALUES ('$title', '$post', '$date', '$newname', '$filename', '$ext', '$size')" ); echo "$title $post $date"; ?> and here is the php form that SHOULD display the images and all the text: <?php $dbh = mysqli_connect("--", "--", "--", "--"); $sql = "SELECT Title,Content,Date FROM Posts ORDER BY id DESC"; $query = mysqli_query($dbh,$sql); echo "<html> <head></head><title>velcome</title> <body> if($query) { $rows = mysqli_num_rows($query); for($i = 0; $i < $rows; $i++) { $feed = mysqli_fetch_array($query); $title = $feed['Title']; $post = $feed['Content']; $date = $feed['Date']; $pic = $feed['image_url']; echo "<tr >\n"; echo "<td >\n"; echo "<a href=\'archive.php'><font face='Georgia, Times New Roman, Times, serif' color='#999999'>$title</font></a>\n"; echo "<p>$date</p><br/>"; echo " <p>$post</p><br/>\n"; echo "<img src='$pic'/>"; echo " <a href='delete.php'>delete this p0st</a>\n"; echo "<hr />\n"; echo "</td >\n"; echo "</tr>\n"; } echo "</table>\n"; } echo"</body> </html>" ?> i have been struggling with this for a long time, thank you for your help!
  21. when I remove the image size information (just for now, to troubleshoot), the image appears in the database. i know the problem is only related to the sizing.
  22. Help! I'm pretty new to PHP so I think I may be missing some basic concepts. I'm trying to create a form that uses PHP to allow a user to upload text and an image to a mysql database. Here is the form: <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>post</title> </head> <body> POST<br/><br/> <form enctype="multipart/form-data" action="posted.php" method="POST"> title:<br /> <input type="text" name="title" size="93"/> (optional)<br /> date: <br/> <input type="text" name="date" /> (JAN 10 09)<br/> words:<br /> <textarea rows="50" cols="80" name="post"></textarea><br /> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> picture: <input name="userfile" type="file" /><br /> <input type="submit" value="POST DIT" /> </form> </body> </html> and here is the PHP: <?php mysql_connect("--", "--", "--", "--") or die(mysql_error()) ; mysql_select_db("--") or die(mysql_error()) ; $title = $_POST['title']; $post = $_POST['post']; $date = $_POST['date']; $id= mysql_insert_id(); $imgData = addslashes ($_FILES['userfile']); $size = getimagesize ($_FILES['userfile']); mysql_query("INSERT INTO Posts (Title,Content,Date, image_type, image, image_size, image_name) VALUES ('$title', '$post', '$date', '{$size['mime']}', '$imgData', {$size[3]}', '{$_FILES['userfile']}')") ; echo "$title $post $date $id"; ?> The idea is that this PHP script (which is very simple) will take the information from the form and insert in into the database. The text information works, but NONE of the image information does. I don't want to create two separate tables in PHP because I want all the text and images to be linked via the same automatic ID number. I don't think I have a problem with mysql -- the problem is with the PHP. The code returns the following error: Warning: getimagesize(Array) [function.getimagesize]: failed to open stream: No such file or directory in /home/content/e/l/v/elviapw/html/posted.php on line 18 I have been struggling with this for weeks. Please help!
  23. thanks for the suggestions! i made sure that the images folder and subfolders were readable/writable/executable by anyone, and tried adding the missing sets of parentheses to the code as bubbasheeko suggested. BUT unfortunately still no luck... could it be a problem with the way i have my target folder formatted? here's the code with the new parentheses: <?php $target = "/images/posts"; $target = $target . basename ($_FILES['picture']); $title = $_POST['title']; $post = $_POST['post']; $date = $_POST['date']; $picture = $_FILES['picture']; mysql_connect("--", "--", "--", "--") or die(mysql_error()) ; mysql_select_db("dbname") or die(mysql_error()) ; mysql_query("INSERT INTO Posts (Number,Title,Content,Date,Picture) VALUES (null,'$title', '$post', '$date', '$picture')") ; if(move_uploaded_file ($_FILES['picture'], $target)) { echo "The file ". basename ($_FILES['picture']). " has been uploaded, and your information has been added to the directory"; } else { echo "Sorry, there was a problem uploading your file."; } ?>
×
×
  • 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.