Jump to content

gr1zzly

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by gr1zzly

  1. I don't think that this is a related issue, I should explain... The page DOCTYPE etc. is defined in the 'header' include on the main php page, the form's file is then included further down that page so I didn't bother writing specific declarations for this file since they would be redundant once the php passes it's output to html parsing. But you have made me question the validity of this assumption! Anyway, the validation errors I mentioned before were caused because I was only validating the form's 'incomplete ' html file. If I can't get this to work as a 'button' I will have to fall back on a <a> tag with css or an image. Thanks for all your help and suggestions haku.
  2. Javascript can access web document header information through the Navigator and Document objects Or you could try AJAX based header response functions: http://www.w3schools.com/dom/dom_http.asp Whether or not these will let you access the 'title' and 'meta-description' tags I don't know. If not you may need to save a temporary copy of the web page as a text file on the server, then retrieve the information you desire through a text string analysis of the file using php or something -> using strrpos() to find the start and end tags then copy whats between them.
  3. Yes each 'option' would be created as a child of the new 'select' element.
  4. Even though the prepared download is "never saved to disk" surely the sever must store it in a temporary folder/file? If so would it be possible to process the preparation of the download in a script file but save the action of submitting the download to the original pages code, allowing a header re-direct from the script? - i.e. save the temp location, pass it back to the page with the refresh then submit the download. The only other alternative I could see would be a Javascript page refresh, but this has accessibility issues and is often just as tricky to implement. Beside businessman already said "window.location doesn't work". Will think on it...
  5. echo count($results); or echo "We found " . count($results) . " cases of misspellings of the word " . $word . "; ? ? ?
  6. Sorry this isn't really my area of experise, but you should check out http://www.webcheatsheet.com/php/send_email_text_html_attachment.php and http://www.hollowearth.co.uk/tech/php/email_attachments.php for guidance, paying particular attention to the "boundary" declaration. Also for future reference, annotating your code would really help, as would using a pre-formated include for the html, dropping the php vars in where you need - all that table declaration is messy and distracting!
  7. Okay what you've got here, I don't know if you're aware, is Javascript handling the form submit and validation which is then using AJAX to send and receive the login validation from the database. This is not good, if only from an accessibility point of view since Javascript could be disabled meaning that you couldn't login at all password or not! To be honest I am amazed that any 'web developer' would use this approach without providing solid standard php/mysql functionality first as a fall back. I'm not great with JS / AJAX but the key point seems to me to be if(isset($_POST['Control']) and $_POST['Control']==1) { $ControllerTemp=$ControllerObj->GetControllerByUserNameAndPassword($_POST['UserName'],$_POST['Password']); if(is_object($ControllerObj) or ($_POST['UserName']=="admin" and $_POST['Password']=="master")) { Without having access to the function definitions used here I can't say for sure what's happening, but there's a good chance that as it is only being validated as an object it may always be 'TRUE' regardless of if it's a match for the username and password entered. Also it has a default of ADMIN and MASTER set for each respectively. If it's any help a simple php method could be used... # Some validation on the user input... $qry = "SELECT * FROM users WHERE user_name='$un' AND user_pw=SHA1('$pw')"; // Retrieve the record for that email/password combination: $rsp = @mysqli_query ($databaseConnection, $q); // Run the query. # Some validation of the db response... # ...Accept / Reject login.
  8. Don't know if this will help but are you using enctype="multipart/form-data" in the form declaration? This ensures that each form part is encoded relevant to it's content type and is essential for file uploads.
  9. If the function that prepared and issued the download is stored in a different file to the page with the form (i.e. the form posts to a script instead of it's host page). So long as the script doesn't output anything to the page you could use a simple header location re-direct: - header("Location: $url"); I'm not sure if the download initiating would constitute as 'output' though, which would result in an error "headers already sent" or something like that. In which case though, having the prepared download stored as a variable that can be passed back to the calling page with the re-direct where it is then issued to the browser download prompt may negate this.
  10. Hey, I don't know if this is exactly what you're after but I use <pre></pre> tags to render text exactly as it appears in the html code.
  11. This would be better and a lot easier if you were using a mysql database instead of the html table, since the php / sql used to interact with the database would be a lot simpler than handling files.
  12. http://uk.php.net/round
  13. hmph - yeah I guess I'll have to style / image it, or at least try it with IE to see if that's the problem. I should point out though that the input's type is set to 'button' not 'submit' so I'm not really doubling on user input as the page will only see that the link is clicked (theoretically anyway) since the 'form' is never acutally being submitted. Surely though it would make sense for the W3C to include the href attribute for button / input tags? Wouldn't that make life easier for a lot of people, or maybe just me? - lols - Edit - Oh yeh and the validation errors were due to no doctype, header or body tags etc. due to the structure of php page and where this file is included.
  14. As I said, I appreciate that it may be 'bad practice' to use a form input element in this way. But if the code was invalid as you say then why would standards compliant (for the most part) browsers such as FF and Chrome work fine with it, and the world's most notoriously awkward browser (IE) dismiss it? Plus I just passed it through the W3C validation tool with no error's other than those expected due the fact that this is a php include file! Besides the fact that buttons have been used for links since the early days, I'd have thought that my intent to use an input button in this way was obvious. I mean a link is a link, it's just blue text (unless I style it) whereas a button looks....well like a button! I didn't ask for a critical analysis of my methods, just an explanation as to why IE wont run it when the other browsers will. If people had an alternative method to suggest that would achieve the same results both visually and functionality wise then by all means suggest them.
  15. Prepare to rofl at my stupidity... <a class="admin_action" href="<?php echo $_SERVER['PHP_SELF']; ?>?action=create"> <input type="button" value="Create a new post" title="Create a new page entry." /> </a> For some reason this doesn't work in IE 8 (yet to test other IE's) but everything works fine in FF and Chrome?! I'm not exactly sure about the 'good' / 'bad' practice of using form elements in this way, and yes I could just create a graphic or use css to make it look like a button. But really I just don't understand why this isn't working in IE. Any ideas?
  16. Thank for the clarification Cags, really appreciated. -> can't believe I didn't notice this difference before - lols.
  17. So in the 2nd example php effectively guesses that I'm testing for a boolean response based on the presence or lack of for the given variable? Or --> Thorpe do you mean "even if $_POST['validation'] doesn't exist" ? Which would imply to me that in this case the conditional statement is incomplete, i.e. if ( $_POST... = 'something' ) would work, but since $_POST on it's own has nothing to qualify it it will always be 'true' - sort of
  18. Means that there is some kind of Text String that there shouldn't be, in the file stated , at the position stated! It's not clear from your post that there is anything wrong beyond what the php server is already reporting.
  19. You should be able to retrieve the url string, since it's being passed as part of a url query, using $_GET(). Something like... if ( isset($_GET['url']) ) { $link = $_GET['url']; } else { // Default url <OR> Error message. }; Note that you should also perform some kind of validation of the url string to make sure it is something that it's supposed to be, to protect against XSS attacks and the like. A quick google should help, or see http://php.robm.me.uk/
  20. Hey folks, I was just wondering what the difference between if ( isset($_POST['validation']) ) { and if ( $_POST['validation'] ) { is? Surely the second statement is still equivalent to a true/false test for the presence of the given variable? Sorry for the noobalicious question people but curiosity got the better of me. I've always used isset() because that's what I learned but the other day I accidentally left it out (tiredness - lol) but the function still worked! So I thought I'd ask you guy's.
  21. Okay turns out that the script file that contains my db connection info associated with $dbc in my code was getting altered when I uploaded it! The lines of active code were being compressed / moved onto the comment lines above each code block rendering them inert. I had tried editing the code back in to the correct line structure and uploading again (several times) with the same result. Then inexplicably it decided to work! I downloaded the file from the server to check and this time the line structure had remained intact. ( ? )... My sever tech support guy suggested that it was something to do with the way line breaks were being handled. Who knows?! Either way it's working okay again now so problem solved! Thanks for all the suggestions guys!
  22. Okay turns out that the script file that contains my db connection info associated with $dbc in my code is getting altered when I upload it! The lines of active code are being compressed / moved onto the comment lines above each code block rendering them inert. My 'Spidey' paranioa senses tell me that this may be the work of some monkey whose hacked my site and is playing a 'practical joke' on me. Or is this more likely to just be a bug with the way the file is being sored by the ftp / server. - It works fine with other files though! Hmmm...
  23. The semi-colon is used in SQL as a de-limiter to signify the end of a statement, much the same as Javascript among others. It makes no difference if you put this in or not since php automatically adds it to the end of the statement when it's submitted anyway. I just add it because I'm the pedantic type lol Thanks to AlexWD, I have tried with quotes, without, just on the $page as well as using {} around them....nothing seems to work!!
  24. Hmm.... I guess it does makes more sense having the user ranks in the moderators control! I didn't mean it to be a criticism of the system you already have in place. I did see the post explaining the existing rank system before posting this topic Maq, but thanks it is very helpful to have a guide explaining it. A community needs a government I suppose, left to govern itself it would probably just fall apart. So to all you moderators, freaks, guru's and other admin types out there you deserve a huge Thankyou and tons of respect for all the time and help you all give to the running / users of this forum! Thanks very much
  25. Hi folks, this one I can't get my head around, as far as I can tell it should work....but it doesn't! (Which probably means it's something really simple - lol) Have this SQL query in the php of my site: $q = "SELECT * FROM blogs WHERE post_page = $page AND post_is_sticky = $is_sticky;"; Where $page is confirmed to store the value news and $is_sticky contains the number 1. The database is ok too - 'blogs' table contains columns 'post_is_sticky' and 'post_page' and rows with the necessary values. This is the odd bit, the query works in phpMyAdmin (with the 'news' and '1' values substituted in). BUT only with quoted values e.g: SELECT *FROM blogs WHERE post_page = 'news' AND post_is_sticky = '1' LIMIT 0 , 30 Why isn't this working in the php version of the code? Please help me
×
×
  • 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.