Jump to content

Braclayrab

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by Braclayrab

  1. I'm not understanding what you are trying to do...  why are you doing this?  Will making the methods static help?
  2. I heard the 15th god never writes buggy SQL.    :P
  3. What are the datatypes on your columns?  Can you also get the SQL Error Message?  Also, I think thorpe wanted to see how the SQL was actually being executed, all we can see is that you are echoing it.  If you can execute the SQL fine from some other UI then it is likely that you have a problem connecting to your database. if you're using mysql_query() then you can do something like this: mysql_query($szQuery); if(mysql_error() != "") { echo(mysql_error()); } You'd most likely want something more sophisticated eventually but this is good enough to get some debug info during early develpment.
  4. <?php ?> <html>   <head>     <title>foo</title> <head> <body>     <p>this is a paragraph</p>   </body> </html> ;D
  5. Thanks, that's what I ended up doing, works like a charm.
  6. Hi, I'm wondering how to do a Server.Transfer in PHP.  For those who don't know; Server.Transfer is an ASP command that transfers the servers response to another script.  Example: if not Session("bLoggedIn") then     Server.Transfer 'Login.asp' end if Something like that, the details aren't important.  btw, I'm not looking for a response redirect, the nice thing about server.transfer is that the client appears to still be at the original page and there is no need for another trip back to the client and then back to the server. TIA! -Clay UPDATE: I found the Header function but this actually changes the URL that the client sees in the browser... is there a way to avoid this?
  7. I had to look into this(I'm gonna be starting some database work tomorrow anyway) The built-in mysql_select_db function will allow you to query multiple rows/columns all at once. <?php $connection = mysql_connect($_ENV['DATABASE_SERVER'],$username, $password); mysql_select_db("Main", $connection) or die("Unable to select database"); $query="SELECT * FROM _Users"; $result=mysql_query($query) or die('Query failed: ' . mysql_error()); $numrows=mysql_numrows($result); for ( $counter = 0; $counter < $numrows; $counter += 1){ echo(mysql_result($result,$counter,"UserName")."<BR>"); } mysql_close(); ?> So, if you prefer, you can use this.
  8. tbh, I don't know.  I've mostly worked with ASP/MSSQL, ASP gives you an 'asp recordset' object which is identical no matter how many columns/rows you have.  You could just leave out the trip_id if you don't actually need it.
  9. Using a salt will protect your passwords from being brute forced to some degree.  Be sure to use a seperate (randomly generated) salt for each user.
  10. You are doing many unnecessary DB reads.  I suspect you'd be better off with a join(it should be much faster): SELECT trip_id, trip_name FROM dtd_trip2user INNER JOIN dtd_trips on dtd_trips.trip_id = dtd_trip2user.trip_id
  11. cool, glad I could help.  You could also go one step further and drop all the php outta there: <div align="center"><input type="radio" name="pic" value="./images/instance/pvp.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/alert.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/bc.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/aq20.gif" /> <div align="center"><input type="radio" name="pic" value="./images/instance/aq40.gif" /> etc. I won't ask about the random td's.  >.<
  12. Well, your way would work, I believe.  However, you can't have a '>' char in the middle of an attribute on the img element.  Do you really need the full html of the image?  Just use the source and save that to your DB. $bwl = "./images/instance/bwl.gif" You might also consider writing some javascript to handle this.  Perhaps put a hidden input on your form and then when someone clicks on a radiobutton you can use the onClick event to populate the hidden input.  You would then store the data in a javascript library object rather than in the values of your radiobuttons themselves and only put the indexes in the values of the radiobuttons.  Just a suggestion, this is more for style than correctness. Also, I don't see a </form>, am I just not seeing it?
  13. Update(i'm retarded): function logError($obj) { $myLogger = &Log::singleton("file", $_SERVER["SITE_HTMLROOT"]."/my.log"); $myLogger->log("error: ". $obj->getLastError()->getMessage(). "<BR>",PEAR_LOG_ERR); } $rsa_obj = new Crypt_RSA; $rsa_obj->setErrorHandler(logError); this works, obviously.  I suppose I could have done this inline as well. I hope this thread helps someone else.  >.<
  14. UPDATE: this works: $error_handler = create_function('$obj', 'echo("error: ". $obj->getLastError()->getMessage(). "<BR>");'); this does not: $error_handler = create_function('$obj', '$myLogger->log("error: ". $obj->getLastError()->getMessage(). "<BR>",PEAR_LOG_ERR);'); I get the same error: "Fatal error: Call to a member function log() on a non-object in /home/10213/domains/mrmoviepants.com/html/Admin/test2.php(41) : runtime-created function on line 1" How can I access myLogger from within a class?  help!!
  15. Hi, i'm trying to use the pear logger to simply log some data to a file. When I make a test script it works fine: require_once($_SERVER["SITE_HTMLROOT"].'/Include/MyLogger.php'); $myLogger->log("foo error", PEAR_LOG_ERR);//This works Contents of MyLogger.php: <?php require_once 'Log.php';//the Pear Logger $myLogger = &Log::singleton("file", $_SERVER["SITE_HTMLROOT"]."/my.log"); ?> However, when I try to use $myLogger from within a class member-function I get an error: "Call to a member function log() on a non-object in /home/10213/domains/mrmoviepants.com/html/Include/RSA.php on line 345" As you can see, i'm trying to debug the Pear RSA Library but I don't believe that in particular is relevant.  Any ideas? Thanks in advance! -Clay UPDATE: I wrote another quick test script: <?php require_once("testinclude.php"); echo($testvar); Class testfoo { function test() { //echo($testvar); if(isSet($testvar)) { echo($testvar); } else { echo("cannot find testvar<BR>"); } } } $myFoo = new testfoo(); $myFoo->test(); ?> testinclude.php: <?php $testvar = "this is my testvar<BR>"; ?> output: "this is my testvar cannot find testvar" Is it not possible to access variables outside of a class from inside a member function?  I suppose that does makes sense.  I think I'm going to try giving my class and errorhandler...
  16. Ah, it just occurred to me that you could simply pass the element in the function that calls it: <div onClick="myFunction(this);"></div>
  17. give the Div an id like so: <div id="myDiv1">my div contents</div> Then you can retrieve the element from javascript with the following: elemMyDiv = document.getElementById('myDiv1'); You can then get the innerHTML or outerHTML of the element: szMyContents = elemMyDiv.innerHTML; Search google for 'document object model' if you want to learn more.
  18. Update: I may have figured out the issue, looks like and endianness problem.  The math libraries are possibly spitting out the numbers in the wrong order.  Here's a bunch of p's, The second digit is always odd and the same is true for the moduli: 0bcdd4dce4ecf3fb 9daeb6bec6ced6de a3a8b0b8c0c8d0d8 a9b8c0c8d0d8e0e7 adccd4dce4ecf4fc a5adb6bec6ced6dd 8fa0a8b0b8c0c7cf f9c1cad2d9e2e9f1 c1c5cdd5dee7eff7 a1a1acb4bcc4ccd4 b5cad2dae2eaf2f9 25c9d0d8e0e8f0f8 9bacb5bdc5cdd4dc c5abb3bbc3cbd3db cdc9d2dae2e9f1f9 c5cdd5dde5edf4fc 19b6bdc6ced6dee6 bfc9d1d9e1e9f1f9 25c9d0d8e0e8f0f8 13bfc6ced6dee5ed e9a6afb7bfc7cfdc bfc9d1d9e1e9f1f9 adc3cbd3dbe2eaf2 d5b2bac2cad2dce4 1dc2cad2dae2e9f1 9fb0b8c0c8d0d8e0 bda7afb7bec6ced6 c5c2cad2dae2e9f1 8ba3acb4bcc5cdd5 b9d0d8e0e8f0f7ff c1cdd5dde5edf5fd 49525b636a727ae6 9399a1a9b0b8c0c8 e9b0b8c0c8d0d7df e9c5ced5dde5edf5 adb2bbc3cad2dae2 b3b3bac2cbd3dbe2 d5cbd3dbe3ebf3fa
  19. I believe every element should have an onClick event handler, be sure to test it in a couple of browsers at least tho. <div onClick="myJavascriptFunction()">Click me!!</div>
  20. Try putting all the TDs in one TR. Alternatively, you could use divs instead and give them inline style.(or just use spans but I <3 divs). <div style="display:inline"></div> There are good tutorials on HTML/CSS at www.w3schools.com if you want to look there also.
  21. Hi, I'm trying to implement the RSA library available from Pear(http://pear.php.net/package/Crypt_RSA/).  I'm having trouble getting it working. I'm passing the public key to my client which then encrypt a password with javascript.  I retrieve it from CryptRSA(the php library) with the following code: bin2hex($_SESSION['key_pair']->getPublicKey()->getExponent()) Similarly for the modulus.  However, the javascript library is not functional with the keys that are being generated by CryptRSA  If I pass the public key to the javascript library as well I can't even use it to decrypt on the client(javascript) side. CryptRSA also appears to sometimes generate even numbers for p and q!  Am I misunderstanding something?  do p and q not actually need to be prime? Has anyone else ever gotten CryptRSA working in this way?  Is there perhaps a better way for me to be doing the encryption on the client side?  Does anyone know of another PHP RSA library that I can try? TIA! -Clay
×
×
  • 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.