Jump to content

DamienRoche

Members
  • Posts

    282
  • Joined

  • Last visited

    Never

Everything posted by DamienRoche

  1. Note, tables do still have their use and this is one of those cases. Tables are perfect for form layout. Just wrap the entire form in <table> </table> with each row use: <tr><td>Field Id: </td><td><input/></td></tr> That will keep everything flowing smooth. Hope that helps.
  2. Ignore my above post. The post above mine cofused me. Position absolute does not keep the positioning of the div 'fixed' in respect to the screen. And position:fixed is fully supported by ie so not sure what experience brimlow has had. Hope that helps.
  3. You can use position:absolute and then position with top,right,bottom,left attributes: #div{ position:absolute; bottom:0px; } That will keep the div positioned at the bottom of the screen no matter parent or otherwise. Hope that helps.
  4. I have an idea for a captcha. About 2 years ago I read that humans can read a word, and entire paragraphs with all the letters mixed up - as long as the first and last letter of each word remained in the same place. like: tloltay So...why not put this into a captcha. Feed it a list of 6-10 letter words from a text file, mix the middle parts of the words up and present it on the page. How hard would it be for a bot to crack something like that? I imagine it would have to run through a range of possible words, probably check for an anagram first. My first logic to decipher this is: -check for anagram (if 1 anagram -> cracked!) else -put first and last letter into var (if only 1 word can be obtained from mixed letters -> cracked!) So I guess it entirely depends on the ambiguity of the words. One idea I had was to feed it famous phrases and quotes... I'd like some constructive input on this. I feel it's fairly weak, but what would YOU do to make it secure...can you make it secure? Thanks.
  5. Can't believe nobody noticed. I believe it's because the php is inside a html file: test.html You cannot run php inside html files. Save it as php and try again. Hope that helps.
  6. Thanks, I'll look into them. I think your comment about not many people being into php is way off base. Yahoo and facebook are powered by php. In fact, around 40% of the top 100 websites in the world are. Php developers don't get existing code and modify it with what they learn from books. That's what you do in the start. I certainly don't anymore. I imagine, like myself, developers build their own frameworks and apps from scratch. I'd think that's where the big bucks are. Thanks for those sites again, I'll look into 'em. This site leads to a mass of top-class information: http://www.sourcerally.net/regin/15-The-seven-best-PHP-sites
  7. So I have 2: tizag.com w3schools php.net (of course phpfreaks) - but I'm looking for tutorial sites which discus best practices, security, advanced php, oop etc. Does anyone know of any 'exceptional' sites which harbor such information? Thanks.
  8. 2nd just adds extra parantheses around the two...I like the third one. so could 3 be: if (($var && !$var2) || ($var3) || !$var4)) { } ..? that's 8 less key strokes and highlights the broader conditions. Bare in mind, I don't write with a fountain pen so my writing is neater. I reach for the nearest biro (convenience). Thanks. I didn't know I could use !$var to check if variable is false...is that considered bad practice at all, like using $$var?
  9. interesting... So could you do this: if(($var == true && $var2 == false) || ($var3 == true || $var4 == false)){ } On a similar note, do if statements, or a lot of them, use up enough resources to warrant any kind of note? ...being neat...haha, yeh, I certainly wouldn't go to the extent of nesting 1 level if statements (if, and, or). Is it really looked at as best practice? Things like that just seem 'inconvenient'. Saying that, I don't write my code for other people to look at. Looks like I need to step up :-) Thanks.
  10. Just wanted to say....ie7 and "standards compliant" do NOT mix. You must be a having a laugh fronting that battle..? hahahaha. Just try to use absolute positioning, you'll soon see the holes.
  11. You just need to use <b> tags (spaces for clarity): <b> this is bold </b> in css, it's: font-weight:bold; Hope that helps.
  12. Ok, so all I know is that I can't set this value to 1 using a mysql insert or update query, unless there is more than 1 record. Any ideas, anyone? Thanks.
  13. Oh yeh, I didn't even realize. So you know rocky, it should be: function escapeString($string, &$connection) { // depreciated function if (version_compare(phpversion(),"4.3.0", "<")) $string = mysql_escape_string($string); // current function else $string = mysql_real_escape_string($string); return $string; Hope that helps.
  14. That's right. It's all very strange. I've set the null option to 'not null' and set the default for that field to 1. Then I simply inserted data without inserting anything into that field and it's defaulted to 0. This is crazy. I've actually changed it myself from within phpmyadmin and used the mysql query it used to change the value...nothing. I even used an update query (similar to above) to change that value to 1 from a 2, which is what I can enter with the query...still, nothing. Thanks any way. Looks like I'm gonna have to approach this differently.
  15. I've already tried that as well. It does the same thing. It defaults to 0, NULL is treated as blank. I thought maybe that was part of the issue...strange. I can set it to anything past 1, just not 1 itself. Thanks again.
  16. It's quite simple to do: $emailgroup = $_POST['QUERY']; ### use ifs to dynamically set the email variable if($emailgroup == "group1"){ $email = "email1@domain.com" } etc etc Don't forget, clean your user input, especially with contact forms. They can be used for spamming, so ideally a captcha should be implemented. at very least filter the input. Hope that helps.
  17. Hi Dave, that's what I thought, but I can't even insert a number on it's own with a field set to varchar. Thanks any way...hopefully I'll crack it soon.
  18. I figured that. I've messed around with the table/database/column settings but can't come up with anything. Here's the table structure: SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `db1` -- -- -------------------------------------------------------- -- -- Table structure for table `questions` -- CREATE TABLE `questions` ( `id` int(255) NOT NULL auto_increment, `qid` int(100) NOT NULL, `question` varchar(500) NOT NULL, `ans1` varchar(30) NOT NULL, `ans2` varchar(30) NOT NULL, `fol1` int(100) NOT NULL, `fol2` int(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; Thanks for your help.
  19. just to be sure, do this: PUT AT TOP OF PAGE. $a = $_GET['a']; if($a == "logout"){ session_destroy(); header("location:index.php"); } LINK FOR HTML: <a href="?a=logout">logout</a> Make sure the sesion is being destroyed in your code. If so, then it is the actual meta refresh. If you put the above right at the top of your page, there is no need to refresh. Hope that helps.
  20. I have no idea what's happening here. So I have a table. Two of the fields are id and qid. The id is auto_incremented sot hat's not an issue....but when I insert the first data and specifically tell it to set qid as 1, it always sets it as 0. I put the value in the actual sql instead of passing through variable to be sure, but it's still behaving the same.. Here's the function: <?php function addnewq($qtext, $ans1, $ans2, $fol1, $fol2){ global $badfeed; mysql_query("insert into questions (qid,question,ans1,ans2,fol1,fol2) values ('1','$qtext','$ans1','$ans2','$fol1','$fol2')") or die($badfeed[] = "unable to insert data into table"); } ?> Any ideas? Do I need to specify something else to lift this restriction? Thanks.
  21. Ok, well if I say put this code into a string: <?php $var = "value"; ?> <html> <?php include('head.php');?> <?php include('body.php');?> <?php include('foot.php');?> </html> example: $string = "<?php $var = \"value\"; ?> <html> <?php include('head.php');?> <?php include('body.php');?> <?php include('foot.php');?> </html>"; #generate file here and save string into it. ...will it parse that if I put it into a php file?- or generate one with it? Maybe so, not had chance to test. My main concern is if anybody knows of any pitfalls with this. Will the code be parsed as php, simple as...or is there some other element that comes into play that may compromise it? Thanks.
  22. Not sure how to approach this. I want to be able to generate a php file. Can I simply include the php I want to include in the file, in a string/array? Are there any pitfalls to this? Thanks.
  23. Is there a way? If I have the user, password etc, can I simply connect and manipulate the database? What would localhost be replaced with? Thanks.
  24. Not sure where this should go. Will probably be moved... I have this code that constructs my radio buttons: <?php while($fetcha = mysql_fetch_array($answers)){ ?> <div class="survey-a-wrap"><div class="ansback"> <input <?php if($selqid == $fetcha['ansid']){echo "checked='checked' ";}?> class="radbut" type="radio" name="<?php echo $qid; ?>" value="<?php echo $fetcha['ansid']; ?>"/> <?php echo $fetcha['answer'];?></div></div> <?php } ?> No need to tutor me on my style of coding. This suits my needs when using ide's. Any way, as you can see, I have a conditional that if true has the radio button pre-selected. The problem is, I can't seem to change the value on *any* pre-selected radio button. I've even checked by dumping all POST,GET & REQUEST variables but my new selection, other than the pre-selected one isn't submitted. Any ideas? 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.