Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. $querycpw = "UPDATE `users` SET `password` = '".$_POST['newpw']."' WHERE `username` = '".$username."' limit 1"; Why don't you try updating it to the variable that is the result of the hash, rather than the value in POST? Why do you say it does not verify it was typed correctly? It certainly looks like your code is doing that? die ("Passwords do not match"); Are you serious? (edit)md5 is hashing, not encryption.
  2. I bet it was made by a disgruntled customer. Great design though.
  3. Ooops. You'll want to leave the: RewriteEngine on If rewriteengine is not on, then all of the RewriteCond and RewriteRule lines will cause a problem.
  4. You have a 10 second timeout. If the port is not open then you'll have to wait 10 seconds for it to time out and return (I think). I'm guessing that's why it's so slow. To speed it up, I'd fork child threads and have each thread check a pool of ports.
  5. When uncommenting a section, only uncomment the part following the line: # SECTION X If your .htaccess file has a line like this: SECTION 1 You'll receive the 500 error again since it's an invalid apache "command."
  6. Go ahead and put the .htaccess back where it was. A brief explanation. Apache is your web server. Apache has configuration information. Server wide configuration is stored in a file called httpd.conf; httpd.conf is loaded once when Apache starts. Additionally, Apache will look in directories for files named .htaccess. .htaccess files can contain additional configuration information that pertains to a directory and all directories below it. Your 500 internal server error is occurring because your .htaccess file is invalid. In .htaccess, lines starting with # are comments and are ignored by apache. Try the following: RewriteEngine on IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow #deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> # SECTION 1 #AuthName www.eggdonorinfo.com #AuthUserFile /home/eggdonor/public_html/_vti_pvt/service.pwd #AuthGroupFile /home/eggdonor/public_html/_vti_pvt/service.grp # SECTION 2 #RewriteCond %{HTTP_REFERER} !^$ #RewriteCond %{HTTP_REFERER} !^http://csedinc.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://csedinc.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://eggdonorinfo.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://eggdonorinfo.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://robertnicholsesq.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://robertnicholsesq.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.csedinc.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.csedinc.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.eggdonorinfo.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.eggdonorinfo.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.robertnicholsesq.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.robertnicholsesq.com$ [NC] #RewriteRule .*\.(jpg|jpeg|gif|png|bmp|pdf)$ csedinc.com [R,NC] # SECTION 3 #RewriteCond %{HTTP_HOST} ^eggdonorinfo.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.eggdonorinfo.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] # SECTION 4 #RewriteCond %{HTTP_HOST} ^eggdonorboston.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.eggdonorboston.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] # SECTION 5 #RewriteCond %{HTTP_HOST} ^robertnicholsesq.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.robertnicholsesq.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] # SECTION 6 #RewriteCond %{HTTP_HOST} ^nicholsdelislelaw.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.nicholsdelislelaw.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] What I've done there is commented out most of the file. I've left a little of it intact. If foo.txt will load correctly with that .htaccess file in place, then uncomment (by deleting the # marks) each section. Only uncomment one section at a time. Refresh foo.txt in your browser after uncommenting a section. This will tell you which sections of your .htaccess are giving apache problems. I'm guessing #SECTION 1 will bomb apache since it refers to file locations that do not exist on your windows machine. Sections 2 through 6 you should be able to uncomment safely. The line #deny from all (i.e. line 7) probably needs to be deleted altogether.
  7. Is there a file: c:/wamp/www/mysite/.htaccess If yes, post its contents here. Also, rename the .htaccess to foo.htaccess. Move foo.txt that we created earlier to c:/wamp/www/mysite/foo.txt Browse to http://localhost/mysite/foo.txt Does Hello there! still display?
  8. You can do this with a form that consistently reposts to itself. You also need to be familiar with the concept of a state machine. You can find plenty of material online about FSM (Finite State Machines). The short of it is you create a machine (aka program) that has several states. What it does depends on which state it is currently in! <?php define( 'STATE_INIT', 0 ); define( 'STATE_HAVENUM', 1 ); define( 'STATE_ENTERNUMS', 2 ); $state = array_key_exists( 'moveto', $_POST ) ? $_POST['moveto'] : STATE_INIT; $state = in_array( $state, array( STATE_INIT, STATE_HAVENUM, STATE_ENTERNUMS, STATE_FINAL ) ) ? $state : STATE_INIT; // By this point, $state is one of the three states $errors = array(); // We might have errors if( $state == STATE_HAVENUM ) { // Must confirm that the number is a number! $num = array_key_exists( 'num', $_POST ) ? $_POST['num'] : false; $num = is_numeric( $num ) ? ((int)$num) : false; if( $num === false ) { $errors[] = 'You did not enter a number!'; $state -= 1; // Decrease state by 1 } }else if( $state == STATE_ENTERNUMS ) { // Must confirm all entered numbers are numbers! $had_err = false; $total = 0; if( array_key_exists( 'nums', $_POST ) && is_array( $_POST['nums'] ) ) { foreach( $_POST['nums'] as $v ) { if( ! is_numeric( $v ) ) { $had_err = true; break; } $total += $v; } } if( $had_err ) { $errors[] = "Fill out all fields with numbers!"; $state -= 1; } } // Begin our form $form = <<<EOT <form method="post" action="{$_SERVER['REQUEST_URI']}" /> EOT; if( $state == STATE_INIT ) { $moveto = STATE_HAVENUM; $form .= <<<EOT <p> <input type="hidden" name="moveto" value="{$moveto}" /> How many inputs? <input type="text" name="num" value="" size="3" /> </p> <p><input type="submit" name="submit" value="submit" /> EOT; }else if( $state == STATE_HAVENUM ) { $moveto = STATE_ENTERNUMS; $form .= <<<EOT <div> <input type="hidden" name="moveto" value="{$moveto}" /> <input type="hidden" name="num" value="{$_POST['num']}" /> </div> EOT; for( $i = 0; $i < $_POST['num']; $i += 1 ) { $form .= <<<EOT <p><input type="text" name="nums[]" value="" size="3" /></p> EOT; } $form .= <<<EOT <p><input type="submit" name="submit" value="submit" /> EOT; }else if( $state == STATE_ENTERNUMS ) { echo "<p>The total is {$total}</p>"; } $form .= "</form>"; if( count( $errors ) ) { echo '<p>You had errors:</p>'; echo '<ul><li>' . implode( '</li><li>', $errors ) . '</li></ul>'; } echo $form; ?>
  9. Create file: c:/wamp/www/foo.txt Hello there! Browse to: http://localhost/foo.txt Does Hello there! display in your browser?
  10. There are many online articles and tutorials for learning PHP and associated technologies. However I highly recommend most books by O'Reilly. I also recommend O'Reilly's Head First Design Patterns. This book would be the equivalent of being thrown into a pool of object oriented sharks. The examples are also in Java. So why would I recommend this to a complete novice? Because Java and PHP share a very similar syntax and the book will show you many, many design concepts that any developer should know. On top of that, O'Reilly's Head First series are like children's books; they have lots of silly pictures and examples. Basically they're easy to read. Best of luck to you
  11. If I understand correctly: <?php // THIS OPERATES UNDER THE ASSUMPTION // `ItemID`,`AttribID` IS UNIQUE! $attrib_ids = array( 1, 5, 7, 9, 10, 5 ); // Or however many you require $num_ids = count( $attrib_ids ); // We'll need to know how many there are // Assert that all input is numeric foreach( $attrib_ids as $v ) { // this is crude, fix according to your needs if( ! is_numeric( $v ) ) throw new Exception( 'Trying to trash my database, eh?' ); } $attrib_ids = implode( ', ', $attrib_ids ); // The following select should return ItemIDs that have ALL of the attributes specified $select_items_with_all_attribs = " SELECT `ItemID` FROM `attriblink` WHERE `AttribID` IN ( {$attrib_ids} ) GROUP BY `ItemdID` HAVING COUNT(*)={$num_ids} "; // Now you want to select all items in that list and their attributes // If you're using a high enough mysql, use a sub-query $select_final = " SELECT i.*, a.* FROM `attriblink` l INNER JOIN `Items` i ON l.`ItemdID`=i.`ItemID` INNER JOIN `Attributes` a ON l.`AttribID`=a.`AttribID` WHERE l.`ItemID` IN ({$select_items_with_all_attribs}) "; ?> If this doesn't work, post back with your version of MySQL.
  12. Then your PHP code that selects and displays the data is not resilient to modifications in the database design. MySQL and phpMyAdmin are working fine. Your PHP code is broken. How about pasting your CREATE TABLE statement and the associated PHP code that is no longer working.
  13. Does phpMyAdmin successfully add the column to the table?
  14. What exactly are you trying to accomplish?
  15. You can have many more than 10 fields in a table. Be more specific; most of us are men which means we're not mind readers.
  16. http://www.webmasterworld.com/forum88/9457.htm
  17. And another way! <?php echo randdigits( 9 ) . "\n"; echo randdigits( 9 ) . "\n"; echo randdigits( 9 ) . "\n"; echo randdigits( 9 ) . "\n"; echo randdigits( 9 ) . "\n"; echo randdigits( 9 ) . "\n"; echo randdigits( 9 ) . "\n"; echo randdigits( 9 ) . "\n"; /** * Generates $n random digits * * @param int $n */ function randdigits( $n ) { if( ! is_int( $n ) || $n < 1 ) return false; $v = 0; for( $i = 0; $i < $n; $i += 1 ) { $v = ($v * 10) + rand(0,9); } return $v; } ?>
  18. This is usually what I do. To help with uniqueness I usually use some form of: client name + timestamp + random It's hashed in a manner that when you view the final key there is no way to know who it belongs to though or what the original data was.
  19. Browsers have default padding and margin values for elements and not all browsers (or even versions of the same browser) use the same rendering. By explicitly setting them to 0 the designer is able to know flat-out what the "initial" values are for their design. It just makes life easier.
  20. <?php $rows = mysql_query( "select `FirstName`, `LastName`, `NumAttend`, `TableNum` from `Guest` order by `TableNum`" ); if( $rows ) { $current_table = false; while( $row = mysql_fetch_object( $rows ) ) { // I prefer *_fetch_object() as the syntax is easier when getting column data if( $current_table !== $row->TableNum ) { echo <<<EOT <h1>Table {$row->TableNum}</h1> <table> <tbody> <tr> <th>Current Guest</th> <th>Number</th> </tr> EOT; } echo <<<EOT <tr> <td>{$row->FirstName} {$row->LastName}</td> <td>{$row->NumAttend}</td> </tr> EOT; if( $current_table !== $row->TableNum ) { echo <<<EOT </tbody> </table> EOT; } $current_table = $row->TableNum; } }else{ echo "No table data."; } ?>
  21. Ah. But if the SVN is on the same machine then the export should run fairly quickly. Even if it's not, as in my case at work, I export on MachineA, zip the file, SSH it to production, and then unzip it. Regardless of how many files the project contains and how many are updated, I recommend exporting the entire version. The reason is that when you created that version you tested it with all of the files. If you decide to do only update those two files on the server, but accidentally miss one, then you run the risk of introducing bugs. Surely exporting the entire project, even with hundreds of files, can't take more than a few minutes?
  22. What's the table structure and what's the HTML output you want to create? Chances are you can do this with a single query and one loop over the record set. (edit) I shouldn't reply to these things when I'm tired. Perform a select firstname, lastname, tablenum from thetable order by tablenum and then create a single loop. Each time the $row['tablenum'] field changes value, close the "current" html table and start a new one.
  23. It's a personal preference thing. I much prefer to filter the repo based on project and then releases and branches for the project. Part of this is because I manage a dozen or so projects, some with 20 or 30 versions. When I go to export the latest and greatest version of ProjectA, I only want to see the versions for that project and not the other 120 versions from all my other projects. I'm not quite sure what you mean by this. When I export: /repos/ProjectA/tags/v0.0.10 to /var/www/ProjectA it only exports the folders and files under "/repos/ProjectA/tags/v0.0.10"
×
×
  • 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.