Jump to content

tpl41803

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by tpl41803

  1. yes my include statement is working (using require() yes there are php tags in the included file thanks for letting me know about the .inc files, always sort of wondered what the difference between naming a file as .inc or .php was, really... now i know you seem frustrated with me. i'm not a programmer and i've taught myself php by getting help on forms, reading books, etc... i'm not designing anything tremendously complicated (i don't think) i really just want to know how sessions work and i can't find any really good tutorial on it. i wouldn;t have asked if i hadn't looked around first
  2. thanks tried that seems like it's working alright -- not sure what i would see if it wasn't... with your debugging lines i have the same result so not sure what else to do :-/
  3. Also just tried removing the <?php session_start(); $_SESSION['user_name'] = $_POST['user_name']; ?> out of the .inc and put it at the top of each page separately, still doesnt work
  4. Hey everyone, working on a script which passes the user's username between different pages on my site. first page is a login, user submits their username through a form, php scripts process's it and i want the person's username to be displayed on the top of each page (similar to how GMAIL has your email address posted on the top of the page when you're logged in) I am using <?php session_start(); $_SESSION['user_name'] = $_POST['user_name']; ?> to start the session and <?php echo $_SESSION['user_name']; ?> to post the username in the body of my page It works fine until I try to load a new page, the username gets lost in the process and I can't figure out how to keep it posted. I have built my pages using includes -- so these two pieces of code are in what i have named "head.inc" -- this is the very top of my page, which includes all <head> info, the <body> tag, and a few other things which are displayed on every page (menu, etc...) is this variable not being carried because I'm using includes? tried just about everything I can think of, please help!
  5. duh thanks so much gevans i knew it would be something simple like that, i dont know why i didnt try that thanks again :_D
  6. Hey everyone this is a pretty basic function but I can't seem to get it working right. I'm setting up a small form which allows users to input information (name, email address, etc... and a short message). My script writes this info to a flatfile database. I'm using strip_tags() to make sure no strange things happen in the code. right now My code looks like this $copy = "\n$name|$email|$validurl|$response|$date|$link|$quoted|"; $text = strip_tags($copy, '<i><b><br />'); from what I understand all tags except <i><b>and<br /> will be removed, but right now it's still stripping these three tags from my string any help please?? i'm kind of new to php, I know this is a simple issue I just cant wrap my head around it
  7. sorry to waste everyone's time i contacted my server host and they fixed the issue--it was something on their end, everything's working as intended thanks!
  8. Just a quick question -- I have a very nice php script that sorts info from my flat-file db in different ways by name, year, price, model, etc... I've started to notice that my code isn't sorting the information correctly by my price field--everything alphabetical sorts properly, and the short number columns sort right (year, for example) but the price doesn't work if ($sortby == 'title') $sortkey = strtolower($title); if ($sortby == 'year') $sortkey = $year; if ($sortby == 'price') $sortkey = $price; that's the bit of my code that's being problematic--i'm wondering if there's maybe there's a function that sorts this correctly -- or perhaps i need to strip the dollar signs away in order to make it work right. i don't know THAT much about php, i'm really teaching myself so any suggestions would be greatly appreciated, thanks!
  9. thanks for the response it works, but i still get the 403 error when i turn the rewrite engine on i really have no idea what the issue is :-\
  10. Hi all, Someone helped me out with this short .htaccess issue a while back on this form, and it seems that I never actually solved my problem so here it is again: I wanted to write a script that would replace any broken images -- images that are "not found" -- with a default image that says "image not found" -- the site I work on lists used cars for sale and unfortunately the guy who updates the site doesn't always upload pictures when he lists the new cars in the inventory. Thus, I want this default image to display until he gets around to uploadin the actual images I was directed to do this through .htaccess using the rewrite engine -- here's what I'm using currently: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteRule ^(.+)$ /image/noimg.jpg it works perfectly, except that when I log back into my file manager, I am presented with a "403 Error, Access Denied" I have tried several different things to amend this-- I've removed the "rewriteengine on" line, and the images don't get replaced ,but the 403 error goes away. also in my .htaccess i have custom redirect pages, they're in there below the rewrite rules: Options -Indexes ErrorDocument 401 /customerrors/error_401.php ErrorDocument 403 /customerrors/error_403.php ErrorDocument 400 /customerrors/error_400.php ErrorDocument 500 /customerrors/error_500.php ErrorDocument 404 /customerrors/error_404.php any help would be appreciated, thank you!
  11. I figured it out again, hopefully I don't go breaking it-- I just commented out some lines and it worked when I took out the "rewriteengine on" thanks for your help
  12. htdocs/image/noimg.jpg and the .htaccess file is located within the htdocs directory
  13. you know... I got it working, but when i tried to log back into my file manager, i get an access denied 403 error-- i removed the code i added and the error went away, so i'm not sure what the problem is that's causing this. my entire .htaccess file looks like this: Options -Indexes ErrorDocument 401 /customerrors/error_401.php ErrorDocument 403 /customerrors/error_403.php ErrorDocument 400 /customerrors/error_400.php ErrorDocument 500 /customerrors/error_500.php ErrorDocument 404 /customerrors/error_404.php RewriteEngine On RewriteBase /image RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteRule ^(.+)$ noimg.jpg when i remove everything from "rewriteEngine..." down i have no problems--I'm just not familiar enough with .htaccess to figure out what the problem code is. thanks :-D
  14. thanks rhodesa, sorry it took so long for me to get back here your code worked perfectly
  15. I'm wondering if there's any way to replace the "X" icon that shows up when an image is not found on a webpage with a default image. I'm assuming that if this is possible it would be done in CSS I ran a few google searches and looked around breifly on the forms, but I have no idea what to actually search for, CSS Image Not Found Icon doesn't produce the results im looking for thanks
  16. thanks for the reply-- i changed the code around a bit, now sending the information to an email address at my domain, and using a different email at my domain for the 4th header -- so it now reads: mail( "email@mydomain.com", "Comment from CARS Contact Form", "$comments from $name at $email or $phone", "From: email@mydomain.com" ); still no luck with an email going though I'm thinking it might possibly be a problem with the php.ini settings, which I have set as: SMTP = localhost sendmail_path = /usr/sbin/sendmail
  17. hey everyone, been looking around on these forms for a while now, but never posted ive only been working with php for about a month now, and i am literally pulling my hair out trying to make a simple contact form submit information to me via email using the mail () function i wrote the script from several different sources, it's my own technically, but i followed tutorials in books i have and a tutorial i read on thesitewizard.com about sending mail through forms. I've found a lot of conflicting information and tried my own twists on things to make the page suitable to me. but, the bottom line is that when i strip the code of everything except the mailing action, it still doesnt work. the form: <form name="contact" method="post" action="contact_submit.php"> <table> <tr> <td></td><td><span class="alert">*</span> denotes a required field.</p> </tr> <tr> <td>Name<span class="alert">*</span></td> <td><input type="text" name="name" /></td> </tr> <tr> <td>E-Mail<span class="alert">*</span></td> <td><input type="text" name="email" /></td> </tr> <tr> <td>Phone</td> <td><input type="text" name="phone" /></td> </tr> <tr> <td>Comments<span class="alert">*</span></td> <td><textarea name="comments" rows="5" cols="#"></textarea></td> </tr> <tr> <td colspan="2" class="center"><input type="submit" value="Submit" class="button"/> <input type="reset" class="button" /></td> </tr> </table> </form> and the contact_submit.php script: <?php $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $phone = $_REQUEST['phone'] ; $comments = $_REQUEST['comments'] ; if (!isset($_REQUEST['email'])) { header( "Location: contact.php"); } elseif (empty($name) || empty($email) || empty($comments)) { require_once('contact_error.inc'); } elseif ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { require_once('contact_error.inc'); } else { mail( "tpl41803@aol.com", "Comment from CARS Contact Form", $comments, "From: $name at $email or $phone" ); require_once('contact_complete.inc'); } ?> I'm not a professional webdesigner, I've just put together a small site to the best of my ability and I'd appreciate any suggestions at all. thanks
×
×
  • 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.