Jump to content

foevah

Members
  • Posts

    162
  • Joined

  • Last visited

    Never

Everything posted by foevah

  1. I'm trying to apply THIS to my blog entry form where the images uploaded will have the expanding image effect attached to them! Ive uploaded an image called cat_small.gif using the form in the code below that I got from a phpfreaks tutorial. I uploaded an image called cat_big.gif using my ftp program because I dont want the bigger image to appear in the blog entries, I only want it to appear on rollover. Right now the images upload to a directory called files and currently they dont appear in my blog entrys alongside text. Can someone tell me how to get the images to appear in the blog entry form alongside the text please!? ??? I hope getting the images to load in the blog entry form is easy because I know my next question is harder! What I'm trying to do is get the javascript that does the expanding image effect on rollover to display all images with the suffix _big.gif on all images entered into the blog! :o Here's the code for my blog page. I've managed to add my own smiley faces and I hope I can apply something similar achieve this image expand effect! (The image upload form is at the end of the code) <script type="text/javascript"> function addsmiley(string) { var newtext = string; document.addthread.entry.value += newtext; document.addthread.entry.focus(); return; } </script> <?php if (isset($_POST['submit'])) { $title = htmlspecialchars(strip_tags($_POST['title'])); $entry = $_POST['entry']; $entry = nl2br($entry); if (!get_magic_quotes_gpc()) { $title = addslashes($title); $entry = addslashes($entry); } mysql_connect ('localhost', 'USERNAME', 'PASSWORD') ; mysql_select_db ('DB_USERNAME'); $sql = "INSERT INTO php_blog (title,entry) VALUES ('$title','$entry')"; $result = mysql_query($sql) or print("Can't insert into table php_blog.<br />" . $sql . "<br />" . mysql_error()); if ($result != false) { print "Your entry has successfully been entered into the database."; } mysql_close(); } ?> <form name="addthread" method="post" action="<?php echo $_SERVER['../PHP_SELF']; ?>"> <p><strong><label for="title">Title:</label></strong> <input type="text" name="title" name="title" size="40" /></p> <img src="../images/smile.gif" width="15" height="15" onClick="addsmiley('')"> <p><textarea name="entry" cols="80" rows="20" id="entry"> </textarea></p> <p><input type="submit" name="submit" id="submit" value="Submit"></p> </form> <form name="form1" method="post" action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <br> <input type="submit" name="Submit" value="Submit"> <? if(isset( $Submit )) { //If the Submitbutton was pressed do: if ($_FILES['imagefile']['type'] == "image/gif"){ copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']) or die ("Could not copy"); echo ""; echo "Name: ".$_FILES['imagefile']['name'].""; echo "Size: ".$_FILES['imagefile']['size'].""; echo "Type: ".$_FILES['imagefile']['type'].""; echo "Copy Done...."; } else { echo "<br><br>"; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } ?> </form>
  2. ah ha yes! thank you every much designactionlocutus and arbol! You are both life and hacker savers! Bless.
  3. do you mean add ; at the end? So it would look like this: <?php if (($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 350000)) ; //create the directory if doesn't exists (should have write permissons) if(!is_dir("./files")) mkdir("./files", 0755); //move the uploaded file move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']); chmod("./files/".$_FILES['Filedata']['name'], 0777); ?> I just tried that and it still accepts gifs
  4. I've got a script that lets me upload anything but when I try to make it secure by adding code that only accepts a certain image file type and size, it doesn't work anymore!? Heres a link to the working flash uploader http://www.jamesgardner.lincoln.ac.uk/upload_flash8/upload.swf all the images uploaded are stored here http://www.jamesgardner.lincoln.ac.uk/upload_flash8/files/ This script below works: <?php //create the directory if doesn't exists (should have write permissons) if(!is_dir("./files")) mkdir("./files", 0755); //move the uploaded file move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']); chmod("./files/".$_FILES['Filedata']['name'], 0777); ?> When I add the following line of code to the script above it doesnt work!? <?php if (($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 350000)) { //create the directory if doesn't exists (should have write permissons) if(!is_dir("./files")) mkdir("./files", 0755); //move the uploaded file move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']); chmod("./files/".$_FILES['Filedata']['name'], 0777); ?> What am I doing wrong? Please can someone help me!
  5. refresh this url the code is cleaer and you can see the image larger then the speechbubble background. I dont want to resize the images im using to fit in the speechbubble bg so id like the background to resize with the image. :o
  6. This is the result from istockphoto http://www.jamesgardner.lincoln.ac.uk/imagexpand/imagexpand04.htm
  7. It's not what I want tho.. I can make an image enlarge on rollover like this already. http://www.jamesgardner.lincoln.ac.uk/imagexpand/imagexpand02.html The speechbubble background image on all the rollovers from istockphoto are all the same size. On skaffers all the speechbubble bg's adjust to match each image. I've been looking for this effect :-\
  8. ok I attached those scripts to this attempt http://www.jamesgardner.lincoln.ac.uk/imagexpand/ier3.html the image doesnt expand.. I searched google for lightbox and the examples I found are doing what I want. http://www.huddletogether.com/projects/lightbox2/ They provide a tutorial of how to do it but its not what Im after. If anyone knows a tutorial of how to do this please let me know!
  9. This is my attempt with a normal speechbubble but the main image doesnt load on rollover: http://www.jamesgardner.lincoln.ac.uk/imagexpand/imagexpand02.html This method isn't doing what I want. I need to change the text with the image.
  10. Ok these are my attempts at taking the code out of skaffers source http://www.jamesgardner.lincoln.ac.uk/imagexpand/ier3.html http://www.jamesgardner.lincoln.ac.uk/imagexpand/ier.html http://www.jamesgardner.lincoln.ac.uk/imagexpand/imageexpand.html Surprise.. Surprise It doesnt work ??? When I saved the skaffers webpage to my desktop and edited it in dreamweaver some of the code I couldnt edit because its in templates which are locked.. I've never used templates before so I have no idea why the code is in grey and locked.
  11. Hi everyone! I saw this website http://www.skaffers.com and when you roll over an image a speech bubble opens and the picture expands! I saved the skaffers webpage to my desktop and I tried to customize it but I dont know how to adjust it to my cause. I can't get the picture to load on rollover either. I made a blog using codegrrl blog tutorials. What id like to do is post a picture that expands on rollover using my blog entry form. Please can someone let me know if this is possible and how to go about doing this! Thanks and all the best!
  12. this is for out of print music. its going to be very similar to cdbaby
  13. Hi im looking for a way to upload artist albums with the option to make all or some of the tracks stream using php and flash. You can see an example of what Im talking about here: [url=http://cdbaby.com/cd/rsbrown]cdbaby.com[/url] When you click on a track you it streams the song thru flash. Does anyone know the best way to do this so you can upload a form for albums like the following: Artist/Group: Album Title: [b]tracks:[/b] Release Year: Record Label: Description: How can I attatch the flash to the tracks category and choose which tracks will have a snippet on? Any suggestion would be great thanks!! Merry Christmas and have a happy new year! :D
  14. ok im guessing that was the wrong way of doing it aswel.. The page [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/newblog/alter.php]alter.php[/url] page adds a password to the table by using the following code: [code] <?php mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('username'); $sql = "ALTER TABLE `php_blog` ADD `password` TINYINT DEFAULT '0' NOT NULL"; $result = mysql_query($sql) or print ("Can't add the column 'password' to the table 'php_blog' in the database.<br />" . $sql . "<br />" . mysql_error()); mysql_close(); if ($result != false) {     echo "The column 'password' was successfully added to your table 'php_blog'"; } ?>[/code] Why isnt this 'alter' code in the insert table page? Should i duplicate this page and change password to username and add username into the the form page.. Heres the form page code [code] <?php $current_month = date("F"); $current_date = date("d"); $current_year = date("Y"); $current_time = date("H:i"); if (isset($_POST['submit'])) {     $month = htmlspecialchars(strip_tags($_POST['month']));     $date = htmlspecialchars(strip_tags($_POST['date']));     $year = htmlspecialchars(strip_tags($_POST['year']));     $time = htmlspecialchars(strip_tags($_POST['time']));     $title = htmlspecialchars(strip_tags($_POST['title']));     $entry = $_POST['entry']; $password = htmlspecialchars(strip_tags($_POST['password']));     $timestamp = strtotime($month . " " . $date . " " . $year . " " . $time);     $entry = nl2br($entry);     if (!get_magic_quotes_gpc()) {         $title = addslashes($title);         $entry = addslashes($entry);     }     mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('username');     $sql = "INSERT INTO php_blog (timestamp,title,entry,password) VALUES ('$timestamp','$title','$entry','$password')";     $result = mysql_query($sql) or print("Can't insert into table php_blog.<br />" . $sql . "<br />" . mysql_error());     if ($result != false) {         print "Your entry has successfully been entered into the database.";     }     mysql_close(); } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><strong><label for="month">Date (month, day, year):</label></strong> <select name="month" id="month"> <option value="<?php echo $current_month; ?>"><?php echo $current_month; ?></option> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <input type="text" name="date" id="date" size="2" value="<?php echo $current_date; ?>" /> <select name="year" id="year"> <option value="<?php echo $current_year; ?>"><?php echo $current_year; ?></option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2008</option> <option value="2010">2010</option> </select> <strong><label for="time">Time:</label></strong> <input type="text" name="time" id="time" size="5" value="<?php echo $current_time; ?>" /></p> <p><strong><label for="title">Title:</label></strong> <input type="text" name="title" name="title" size="40" /></p> <p><strong><label for="password">Password protect?</label></strong> <input type="checkbox" name="password" id="password" value="1" /></p> <p><textarea cols="80" rows="20" name="entry" id="entry"></textarea></p> <p><input type="submit" name="submit" id="submit" value="Submit"></p> </form>[/code]
  15. I added my_username2 and my_password2 to this part of the code but this doesnt work. [code] if (isset($_POST['username']) && $_POST['username'] == $my_username $my_username2) {             if (isset($_POST['pass']) && $_POST['pass'] == $my_password $my_password2) {[/code]
  16. Well theres one way of inserting usernames with passwords into the database and thats with a register form..
  17. Am I asking something thats real simple that noone wants to help because I should know this?? I thought ive done well not getting any errors with this blog. Now im trying something thats out of the tutorial and im looking for advice noone will help.... I thought people were here to help!
  18. Im stuck on trying to add more then one username and password to the blog database!!!!!!!!!! Im asking someone here to help me understand!
  19. well if this is the right idea I need to know how to merge both the tutorials! The tutorial im using to make my blog only tells me how to have one username and password and this other tutorial site explains how to add users when you register... Its not exactly the same as I want but its similar.. ???
  20. Yeh but im trying to modify this tutorial.. Have you got a more constructive suggestion please I found a different tutorial explaing how to add usernames and passwords and ive succussfully been able to work the script [url=http://www.free2code.net/plugins/articles/read.php?id=99]http://www.free2code.net/plugins/articles/read.php?id=99[/url] [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/user_db/register.php]Click here to see my attempt at this script[/url] You can register successfully and [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/user_db/login.php]login here[/url] successfully. The register is a form for adding usernames with passwords to the database. Ive connected to the database in dreamweaver using the MySQL Connection. I just need to figure out how this can be used with the blog im doing lol
  21. Ive been using a tutorial that lets me make my own blog [url=http://codegrrl.com/!/tutorials/category/Build%20A%20Blog/P10/]click here to see the tutorial site[/url] Ive got up to [url=http://codegrrl.com/!/tutorials/view/part_4_passwording_individual_entries/]part 4[/url] without any problems Im just wondering why it doesnt say how to add more usernames and passwords! This code that allows me to have one username and password When you enter the correct username and password from the [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/newblog/]home page[/url] your taken to the entry page for that post. (username and password = TEST) It told me to add [code]$my_username = "TEST"; $my_password = "TEST"; [/code] To the single entry's page which can be found [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/newblog/journal.php]here[/url] This works fine but I want too add more usernames so I tried: [code]$my_username = "TEST"; $my_password = "TEST"; $my_username = "TEST2"; $my_password = "TEST2";  [/code] This didnt work, it only recognized TEST2 and ignored TEST. I also tried [code]$my_username = "TEST"; $my_password = "TEST"; $my_username1 = "TEST2"; $my_password1 = "TEST2";[/code] Heres the full code for the single entry page: [code]<?php include("header.html"); ?> <?php $my_username = "TEST"; $my_password = "TEST"; mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('username'); if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {     die("Invalid ID specified."); } $id = (int)$_GET['id']; $sql = "SELECT * FROM php_blog WHERE id='$id' LIMIT 1"; $result = mysql_query($sql) or print ("Can't select entry from table php_blog.<br />" . $sql . "<br />" . mysql_error()); while($row = mysql_fetch_array($result)) {     $date = date("l F d Y", $row['timestamp']);     $title = stripslashes($row['title']);     $entry = stripslashes($row['entry']);     $password = $row['password'];     if ($password == 1) {         if (isset($_POST['username']) && $_POST['username'] == $my_username) {             if (isset($_POST['pass']) && $_POST['pass'] == $my_password) {                 ?>                 <p><strong><?php echo $title; ?></strong><br /><br />                 <?php echo $entry; ?><br /><br />                 Posted on <?php echo $date; ?></p>                 <?php             }             else { ?>                 <p>Sorry, wrong password.</p>                 <?php             }         }         else {             echo "<p><strong>" . $title . "</strong></p>";             printf("<p>This is a password protected entry. If you have a password, log in below.</p>");             printf("<form method=\"post\" action=\"journal.php?id=%s\"><p><strong><label for=\"username\">Username:</label></strong><br /><input type=\"text\" name=\"username\" id=\"username\" /></p><p><strong><label for=\"pass\">Password:</label></strong><br /><input type=\"password\" name=\"pass\" id=\"pass\" /></p><p><input type=\"submit\" name=\"submit\" id=\"submit\" value=\"submit\" /></p></form>",$id);             print "<hr /><br /><br />";         }     }     else { ?>         <p><strong><?php echo $title; ?></strong><br /><br />         <?php echo $entry; ?><br /><br />         Posted on <?php echo $date; ?></p>         <?php     } } ?>[/code] This code [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/newblog/php_blog_table.php]inserts the table[/url] for the blog: [code] <?php mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('username'); $sql = "CREATE TABLE php_blog (   id int(20) NOT NULL auto_increment,   timestamp int(20) NOT NULL,   title varchar(255) NOT NULL,   entry longtext NOT NULL,   PRIMARY KEY  (id),   UNIQUE KEY id (id) )"; $result = mysql_query($sql) or print ("Can't create the table 'php_blog' in the database.<br />" . $sql . "<br />" . mysql_error()); if ($result != false) {     echo "Table 'php_blog' was successfully created."; } mysql_close(); ?>[/code] I then made a page called [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/newblog/alter.php]alter.php[/url] which adds a password to the table by using the following code: [code] <?php mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('username'); $sql = "ALTER TABLE `php_blog` ADD `password` TINYINT DEFAULT '0' NOT NULL"; $result = mysql_query($sql) or print ("Can't add the column 'password' to the table 'php_blog' in the database.<br />" . $sql . "<br />" . mysql_error()); mysql_close(); if ($result != false) {     echo "The column 'password' was successfully added to your table 'php_blog'"; } ?>[/code] Why isnt this 'alter' code in the insert table page? Im not sure how to add more usernames and passwords. Please someone help!!
  22. I found this tutorial and ive succussfully been able to work the script [url=http://www.free2code.net/plugins/articles/read.php?id=99]http://www.free2code.net/plugins/articles/read.php?id=99[/url] [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/user_db/register.php]Click here to see my attempt at this script[/url] You can register successfully and [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/user_db/login.php]login here[/url] successfully. The register is a form for adding usernames with passwords to the database. Ive connected to the database in dreamweaver using the MySQL Connection. I just need to figure out how this can be used with the blog im doing lol
  23. [quote author=roopurt18 link=topic=113954.msg463447#msg463447 date=1162782115] Usernames and passwords should be stored inside a database.  You should be using the username and password from the submitted form to look up the corresponding row in the database table.  If found, the user exists and if not found, the user does not exist. [/quote] Id like to do what rooport18 said. My database is stored on [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/mpr/php_blog.php]php_blog.php[/url] and the code for this page looks like this: [code]<?php mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('username'); $sql = "CREATE TABLE php_blog (   id int(20) NOT NULL auto_increment,   timestamp int(20) NOT NULL,   title varchar(255) NOT NULL,   entry longtext NOT NULL,   PRIMARY KEY  (id),   UNIQUE KEY id (id) )"; $result = mysql_query($sql) or print ("Can't create the table 'php_blog' in the database.<br />" . $sql . "<br />" . mysql_error()); if ($result != false) {     echo "Table 'php_blog' was successfully created."; } mysql_close(); ?> [/code] Do I need to add a username and password field to that table? Or do I make a new table just for username and password? [url=http://www.webdesignhull.lincoln.ac.uk/jecgardner/mpr/blog_entry_form.php]Heres a link to the submit form[/url] and heres the code: [code] <?php $current_month = date("F"); $current_date = date("d"); $current_year = date("Y"); $current_time = date("H:i"); if (isset($_POST['submit'])) {     $month = htmlspecialchars(strip_tags($_POST['month']));     $date = htmlspecialchars(strip_tags($_POST['date']));     $year = htmlspecialchars(strip_tags($_POST['year']));     $time = htmlspecialchars(strip_tags($_POST['time']));     $title = htmlspecialchars(strip_tags($_POST['title']));     $entry = $_POST['entry'];     $password = htmlspecialchars(strip_tags($_POST['password']));     $timestamp = strtotime($month . " " . $date . " " . $year . " " . $time);     $entry = nl2br($entry);     if (!get_magic_quotes_gpc()) {         $title = addslashes($title);         $entry = addslashes($entry);     } mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('username');     $sql = "INSERT INTO php_blog (timestamp,title,entry,password) VALUES ('$timestamp','$title','$entry','$password')";     $result = mysql_query($sql) or print("Can't insert into table php_blog.<br />" . $sql . "<br />" . mysql_error());     if ($result != false) {         print "Your entry has successfully been entered into the database.";     }     mysql_close(); } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><strong><label for="month">Date (month, day, year):</label></strong> <select name="month" id="month"> <option value="<?php echo $current_month; ?>"><?php echo $current_month; ?></option> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <input type="text" name="date" id="date" size="2" value="<?php echo $current_date; ?>" /> <select name="year" id="year"> <option value="<?php echo $current_year; ?>"><?php echo $current_year; ?></option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2008</option> <option value="2010">2010</option> </select> <strong><label for="time">Time:</label></strong> <input type="text" name="time" id="time" size="5" value="<?php echo $current_time; ?>" /></p> <p><strong><label for="title">Title:</label></strong> <input type="text" name="title" name="title" size="40" /></p> <p><strong><label for="password">Password protect?</label></strong> <input type="checkbox" name="password" id="password" value="1" /></p> <p><textarea cols="80" rows="20" name="entry" id="entry"></textarea></p> <p><input type="submit" name="submit" id="submit" value="Submit"></p> </form>[/code] I fixed this problem.. [quote author=foevah link=topic=113954.msg463449#msg463449 date=1162783725]Any ideas why it doesnt say sorry password is wrong??[/quote]
×
×
  • 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.