Jump to content

simcoweb

Members
  • Posts

    1,104
  • Joined

  • Last visited

Everything posted by simcoweb

  1. Ok, gotcha. I misunderstood your first post. I still would like to know the source of the HTML you're looking to strip. Is this coming via a database field or fields?
  2. You'd need to set those as variables then use the 'echo' command. Like this: $Text1 = "blah"; $Text2 = "blah blah"; $Text3 = "blah blah blah"; $Text4 = "blah blah blah blah"; echo $Text1<br \>; echo $Text2<br \>; echo $Text3<br \>; echo $Text4<br \>; Now, the question is... how is that text getting placed into your HTML? Via a form input? In order for it to be extracted it needs to know how it got there. If it's posted via a form then the variables are set by the form field names using the $_POST command and your 'action' script parses the form input and displays the HTML and results of the form. Need a bit more detail on how this is created :)
  3. Did you actually mean to or have this in your code in your SQL query? [code][b]sumthing[/b][/code] with the [b] tags? Or was that part of displaying it here in your post?
  4. You would use something like this in your display for each form field: [code]<INPUT TYPE="text" name="bozo" VALUE="<? echo $bozo ?>"/>[/code] Assuming that each of those variables is already set.
  5. What he's stating is that a variable [i]outside[/i] the function() can't be accessed without actually [i]declaring it[/i] as a [b]global[/b] variable. Like this: Won't work: [code]<?php $life = 42; function meaningOfLife() { print "The meanin of life is being $life<br>"; } meaningOfLife(); ?>[/code] When it prints it doesn't print the value of the $life variable. BUT, if you do this: [code]<?php $life = 42; function meaningOfLife() { global $life; print "The meanin of life is being $life<br>"; } meaningOfLife(); ?>[/code] Then it will work and print the value. You may think that $life is a 'global' variable already. But not within a function it's not unless you declare it. Hope this helps!
  6. It's not that hard. 1. create a custom error page ( I make mine look like the rest of the site with menus and everything. Like this: http://www.templatedepot.com/no-page-here.htm ) 2. edit your .htaccess file with this: ErrorDocument 403 http://www.yoursite.com/403.htm ErrorDocument 404 http://www.yoursite.com/404.htm ErrorDocument 500 http://www.yoursite.com/500.htm Those are the most common errors.
  7. Truthfully the best way is to put an index.htm file in each one ( or index.shtml, index.php, index.html.. it just needs to be an index file) since doing via .htaccess just puts more strain on the server everytime someone attempts to hit one of your folders. Or you can pick up a little utility that not only prevents them from viewing your unprotected folders but logs their IP, redirects them to the page of your choice, and allows you to ban IP's if needed. Check out: [url=http://www.templatedepot.com/snoop-catcher.htm]http://www.templatedepot.com/snoop-catcher.htm[/url]
  8. If you read that part on the form example page he explains that he's not doing any form field validation in the form html itself. Instead he's doing the validation in the register.php file that is called when the form is submitted. If there are errors or empty required fields then it will display one or more of those error messages you posted. What he said: [quote]This form will post to a script called register.php and will do a few things that are essential. We'll put some basic error checking with PHP. I am not including any special Error checking functions on this form because everyone likes to do error checking their own way. I'll basically be checking that the user entered the required fields of this form and if they didn't, we'll put an error message on the page that they post this form to.[/quote] The code doing the verification: [code]/* Do some error checking on the form posted fields */ if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){     echo 'You did not submit the following required information! <br />';     if(!$first_name){         echo "First Name is a required field. Please enter it below.<br />";     }     if(!$last_name){         echo "Last Name is a required field. Please enter it below.<br />";     }     if(!$email_address){         echo "Email Address is a required field. Please enter it below.";     }     if(!$username){         echo "Desired Username is a required field. Please enter it below.<br />";     }     include 'join_form.html'; // Show the form again!     /* End the error checking and if everything is ok, we'll move on to     creating the user account */     exit(); // if the error checking has failed, we'll exit the script! } [/code]
  9. The problem and reason you're having to use the isset function is due to the form stating 'values' for the various fields that are dependent upon the form being parsed first. In other words, the form ACTION is pointed to PHP_SELF which would require the submit button hit before the actual values you have indicated can be displayed in the form fields. Not sure why you want to do that but hey.... :) [code]VALUE="<? echo $phc ?>"[/code] You're asking the form to display something that hasn't been invented yet until they fill out the form and hit submit. Then it will parse these via the $_POST command and display them. But, you're asking them to be displayed right back in the form fields. That's cool if you want to show them the form again with their entries placed in the respective fields. For the data insert error, this is a wild guess, but try moving your include/db_conn.db line [i]ahead[/i] of your query statement. It needs that information present before executing your query command.
  10. I think he means he needs to 'INSERT' data from multiple sources. Is that correct?  ???
  11. I'm no pro :) but the db connection code seems to be off. Here's yours: [code]I am thinking it has something to do with my db connection. db connection - include 'includes/db_conn.txt'; In the .txt I have written this: <? $link =         mysqli_connect('host','username','password','db_name'); In that format! ?>[/code] First, there's a misspell at 'mysqli' which should be 'mysql' without the 'i' in there. Second, typically it's supposed to be this way: [code]mysql_connect('host', 'username', 'password') or die("Where is that dang database"); mysql_select_db('db_name') or die("Where is that dang database!"); [/code] I'm not 100% sure on this also but the included file should probably be a .php extension instead of the .txt. UPDATE: I just noticed another thread pertaining to the 'mysqli' issue. Apparently that's a hybrid style of MySQL with 'Improved' tacked on. My apologies for mentioning the misspell. :)
  12. You can also use an external CSS by just linking to it in your echo statements. Then place your 'class' tags where appropriate.
  13. PayPal handles subscriptions which enable you to have recurring billing :)
  14. Apply for the PayPal Pro setup. Instead of going to the PayPal site during the transaction the entire thing is done on your site and they never know about PayPal. The Pro setup also comes with a virtual terminal so you can manually run transactions as well.
  15. Hi: I have a similar need... adding an image reference to a MySQL database and then summoning the image reference into a web page separately. My setup involves a simple portfolio with an image of the website as part of the display. The way mine works is so similar to the 'news' insertion issue that I thought i'd join this thread instead of starting a new one. My portfolio entries could work the same way where they have an 'id' number assigned. Then, the image could be assigned to that id if i'm understanding correctly. That would match the two up in any case. My first question would be pertaining to your code about the INSERT statement. I'm a noob so bear with me :)  I'm assuming that the INSERT statement for the image has to be a separate INSERT statement from the data... ? In other words, from the form entry input i'm inserting the results into a database. One of the fields is the 'image' field. When i'm writing the INSERT code I have this: [code]mysql_query("INSERT INTO portfolio (site_name, url, description, details, thumbnail) VALUES('$name', '$url', '$descr', '$details', '$image') ") or die(mysql_error());[/code] The variables are as so: [code]$name = $_POST['site_name']; $url = $_POST['url']; $descr = $_POST['description']; $details = $_POST['details']; $image = $_POST['thumbnail']; $uploadDir = "images/";[/code] So, basically I complete the form and upon submit it should open the DB and enter the data. However, the 'image' part is confusing to me since I know that the image itself doesn't reside in the DB but the reference to it does. So, I need to assign the reference...?
  16. Sorry, was gone for 3 days. Thanks for the response and further explanation. I see clearly now what you're talking about. I made the code changes and the image now shows up properly. Thanks!
  17. I'd suggest making an additional step in your upload process. Like a confirmation page before the upload? "Is this the image you wish to upload? If yes click Submit. If no, search below for another image." I'm afraid that doing it in any other way is going to be extremely inconsistent and based upon browsers, versions, security settings, etc. etc. etc.
  18. I'm parsing all this HTML under one echo statement which includes the $image tag utilizing the way you've specified it: [code]echo <<<HTML <head> <title>Your Profile</title> <link rel="stylesheet" type="text/css" href="tdepot.css"> </head> <body> <table border='0' bgcolor='#FFFFFF' cellpadding='2' cellspacing='3' border='0' width='650'> <tr><td rowspan='3' bgcolor='#303030'><font face='Verdana' size='3'><img src="$image"></td> <td bgcolor='C0C0C0'><font class='bodytext'><i>$name</i></td></tr> <tr><td bgcolor='#808080'><font class='bodytext'>$title</td></tr> <tr><td bgcolor='#E9F2E4'><font class='bodytext'>$info</td></tr></table></body> HTML;[/code] After the page is parsed I get this as the image location: [code]http://www.templatedepot.com/%3Cimg%20src='uploads/.gif'%20border='0'/%3E[/code] The <'s are getting replaced somehow in the parsing of the code. Plus, I don't see any reference to the actual picture ID in the img src that's being pulled. You can view the form and try it yourself if you want: http://www.templatedepot.com/layout-test-form.htm. It's basically a test in file uploading and then parsing the data for the screen. :)
  19. Ok, that makes perfect sense. I think I saw it done that way in some other post. Anyway, error message is gone but the image doesn't show. Just a broken link to it.  If I pull up the pic's properties via my browser I get this location: [quote]http://www.templatedepot.com/%3Cimg%20src='uploads/.gif'%20border='0'/%3E[/quote] Something is not parsing correctly obviously.
  20. Yaaaaaaay! That did the trick! Ok, i'm taking notes. Thanks! One more question. HOW would I call this image file into say a table cell? I've tried using <img src="<? echo $image; ?>"> but that produced some other weird error about an 'unexpected ?'. That was before we fixed this code, though. Suggestions? Update: Just tried it again and get this: [quote]Parse error: parse error, unexpected '?' in /home/xxxxxx/public_html/test.php on line 61[/quote] That's this line: [quote]echo "<tr><td rowspan='3' bgcolor='#303030'><font face='Verdana' size='3'><img src="<?php echo $image; ?>"></td>";[/quote]
  21. no problem, it's http://www.templatedepot.com/uploads/ I placed a dummy index page in there so it won't show the directory tree.
  22. ahhh yes, the simplest things. Ok, added the additional right parentheses and now get this: [quote]ERROR: ../uploads/ is not a valid directory[/quote] Ok, before I made this reply I tried: /uploads /uploads/ ../uploads uploads/ all return the same error. Trust me, uploads IS a valid directory. And, the permissions are set at 777 so I know it's writeable.
  23. sanfly, I inserted that code and got this error: [quote]Parse error: parse error, unexpected '{' in /home/xxxxx/public_html/test.php on line 38[/quote] which is this line: [code]38 if(!is_dir($uploadDir){ 39 echo "ERROR: $uploadDir is not a valid directory<br><br>"; 40 exit(); 41 }[/code] the 'test.php' script in relation to the uploads folder is as so: public_html/test.php public_html/uploads
  24. Hi, thanks for the response. I should've mentioned that I've tried every conceivable method of entering that directory: ../uploads ../uploads/ /uploads/ uploads uploads/ All produce the exact same error except for the mention of the directory :(
  25. I have a simple form (code below) just to test the file upload snippet. No matter what I do I get an error message while it's trying to write the temp name and transfer the image to the /uploads folder. Here's the code: [code]$image = "<img src='../uploads". $result['ID']. ".gif' border='0'/>"; // we have to deal with the image upload first if ( move_uploaded_file ($_FILES['image'] ['tmp_name'],       "uploads/{$_FILES['uploadFile'] ['name']}")  )       {  print '<p> The file has been successfully uploaded </p>';       } else       {         switch ($_FILES['uploadFile'] ['error'])         {  case 1:                   print '<p> The file is bigger than this PHP installation allows</p>';                   break;             case 2:                   print '<p> The file is bigger than this form allows</p>';                   break;             case 3:                   print '<p> Only part of the file was uploaded</p>';                   break;             case 4:                   print '<p> No file was uploaded</p>';                   break;         }       }[/code] Here's the form: [code] <html> <title>This is a test PHP page</title> <head></head> <body> <form action='test.php' method='POST' enctype="multipart/form-data"> <input type="hidden" value="MAX_FILE_SIZE" value="100000" /> <table width="600" border="0" align="center"> <tr><td><font class="bodytext">Name:</td><td><input type="texbox" size="20" name="name"></td></tr> <tr><td><font class="bodytext">Title:</td><td><input type="textbox" size="20" name="title"></td></tr> <tr><td><font class="bodytext">Business Summary</td><td><textarea cols="20" rows="6" name="summary"></textarea></td></tr> <tr><td colspan="2"><font class="bodytext">Select an image from your hard drive to upload for your profil</td></tr> <tr><td colspan="2"><input type="file" size="20" name="image"/> <tr><td colspan="2"><input type="submit" value="Send Profile"></form></td></tr> </table> </body> </html>[/code] and here's the dang error message: [code]Warning: move_uploaded_file(uploads/): failed to open stream: Is a directory in /home/xxxxxx/public_html/test.php on line 11 Warning: move_uploaded_file(): Unable to move '/tmp/phpdvlTi9' to '../uploads' in /home/xxxxxx/public_html/test.php on line 11[/code] It's driving me nuts. The permissions on the /uploads file is 777. The permissions on the /tmp folder which is located below the public area is 700. The server configuration will not allow it to be changed. That may be the problem but I don't know for sure until another set of eyes peer at the code to make sure it's not my bone headed code :)
×
×
  • 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.