Jump to content

Mute

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Mute's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've had a Google and come up short so was hoping someone here might have what I'm looking for. Right now we are using vBulletin as both our forum and also as our login/register/user management. We're thinking of dropping vB just because our forum isn't used enough to warrant it. Thus, we would need a new login script etc. Rather than re-inventing the wheel and writing my own, I was hoping there was a generic script out there that people might be using that simplifies the whole process. So basically it's would have a sample registration and login forms and a simple include file to carry user session info across multiple pages. Perhaps with periodic updates to stay on top of the latest security updates etc. Built in Facebook Connect and other social network stuff would be another great asset. Anyone come across anything like this?
  2. I have a very similar problem where sessions are set perfectly in all cases except on the Mac platform. Does anyone have any ideas?
  3. Hi, Can someone tell me how to mimic the following using array_push? $replacements = array( "test" => array("!*EMAIL*!" => "email@email.com"), "dummy" => array("!*EMAIL*!" => "dude@dude.com"), "qwerty" => array("!*EMAIL*!" => "test@test.com") ); Cheers!
  4. Hi, I'm parsing some XML and then spitting it out on the screen. What I'd like to be able to do is reverse the array that SimpleXML creates but for the life of me, I can't do it. Here's some sample XML. <league> <country>England</country> <name>Premier League</name> <all_matches> <item> <round>1</round> <date>19 Aug 06</date> <result>1 - 1</result> <team1>Sheffield Utd.</team1> <team2>Liverpool</team2> </item> <item> <round>1</round> <date>19 Aug 06</date> <result>3 - 1</result> <team1>West Ham United</team1> <team2>Charlton</team2> </item> <item> <round>1</round> <date>19 Aug 06</date> <result>1 - 1</result> <team1>Arsenal</team1> <team2>Aston Villa</team2> </item> </allmatches> </league> I'd like to be able to show the <item> tags in reverse.
  5. Mute

    rename()

    //create temp file $tmp = time().".xml"; $handle = fopen($tmp, "w"); fwrite($handle, "data goes here"); fclose($handle); //rename temp file rename($tmp, "data.xml");
  6. Mute

    rename()

    Hi, I'm trying to rename a temporary file I've created but it doesn't work. Says the file doesn't exist. When I do a file_exists() on the file, it also says it doesn't exist. Yet I can see the file on the server.... Any ideas?
  7. OK, here's some phpinfo from the old server which works and the new server which doesn't. Old Server (works) [url=http://83.245.15.145/~check/test.php]http://83.245.15.145/~check/test.php[/url] New Server (doesn't work) [url=http://87.117.198.116/~chav0ly/test.php]http://87.117.198.116/~chav0ly/test.php[/url] Are there any blatant differences in variables or some such that could be causing this problem?
  8. It actually might be the part of code that is passing to the function above.
  9. As far as I can tell, everything works fine till this part of the code.... [code] function shiftRightOne( $n ) { $s = $n & 0x80000000; $n &= 0x7fffffff; $n >>= 1; if( $s ) $n |= 0x40000000; return $n; } [/code] And after that is where the two environments start having differences.
  10. [quote author=wildteen88 link=topic=99672.msg393000#msg393000 date=1152264208] Could you give an explanation to "[i]doesn't work anymore....[/i]"[/quote] Sorry, that was pretty undescriptive. The code processes fine and I get no errors. It just doesn't encrypt the word (a username on the site) properly anymore and then can't decrypt the word then. [quote author=wildteen88 link=topic=99672.msg393000#msg393000 date=1152264208] The below is what I used to run your function: [code]echo tea_encrypt('helloworld', 'a0b1c2'); echo '<br>'; echo tea_decrypt('7bacf8ad8397ed1b43b0f0a73eb42a63', 'a0b1c2');[/code] And I got the following: [code]7bacf8ad8397ed1b43b0f0a73eb42a63 helloworld[/code] Which to me appears to be working. I cannot see why this is not wokring on your new server as it doesnt appear to be using any functions that require extensions. [/quote] That's exactly what I'm stumped about, just seems like simple PHP code that should work anywhere. I ran the same as you above on my local machine and got the same results. When on the server though I get this as the encrypted string.... 86bb954593b1edad43b0f0a73eb42a63 By the way, I didn't write this code, it was part of the site when I took over.
  11. Bugger, so no one has a clue about this?
  12. OK, a problem with our server migration. Our TEA encryption doesn't work anymore.... Works fine on my local computer with PHP 4.3.10 and on the old server with 4.4.2 but not on the new server with 4.4.2.... Any ideas on this one? Code is below. [CODE]<?php //--------------------------------------------------------- // TEA Encryption Functions // Encryption and decryption of text // Using the Tiny Encryption Algorithm function DecToHex( $x ) { $r = dechex( $x ); while( strlen( $r ) < 8 ) $r = '0'.$r; return $r; } function shiftRightOne( $n ) { $s = $n & 0x80000000; $n &= 0x7fffffff; $n >>= 1; if( $s ) $n |= 0x40000000; return $n; } function shiftRight( $n, $t ) { for( $i = 0; $i < $t; ++$i ) { $n = shiftRightOne( $n ); } return $n; } function tea_encipher($p1, $p2, $k) { $temp = array( $p1, $p2 ); $n = 32; $sum = 0; while ($n-- > 0) { $temp[0] += (($temp[1] << 4 ^ shiftRight( $temp[1], 5 )) + $temp[1] ^ $sum + $k[($sum & 3)]); $sum = $sum + 0x9E3779B9; $temp[1] += (($temp[0] << 4 ^ shiftRight( $temp[0], 5 )) + $temp[0] ^ $sum + $k[( shiftRight( $sum, 11 ) & 3)]); } return $temp; } function tea_decipher($p1, $p2, $k) { $temp = array( $p1, $p2 ); $n = 32; $sum = 0x9E3779B9 * $n; while ($n-- > 0) { $temp[1] -= (($temp[0] << 4 ^ shiftRight( $temp[0], 5 )) + $temp[0] ^ $sum + $k[(shiftRight( $sum, 11 ) & 3)]); $sum = $sum - 0x9E3779B9; $temp[0] -= (($temp[1] << 4 ^ shiftRight( $temp[1], 5 )) + $temp[1] ^ $sum + $k[($sum & 3)]); } return $temp; } function tea_encrypt($inString, $key) { $outString = ""; // pad the input so that it's a multiple of 8 while ( strlen($inString) & 7 ) { $inString .= ' '; } $i = 0; while($i < strlen($inString) ) { // slam 4 bytes into a dword $p1 = ord( substr( $inString, $i++, 1 ) ); $p1 |= ord( substr( $inString, $i++, 1 ) ) << 8; $p1 |= ord( substr( $inString, $i++, 1 ) ) << 16; $p1 |= ord( substr( $inString, $i++, 1 ) ) << 24; // mask off 32 bits to be safe $p1 = $p1 & 0xFFFFFFFF; // slam 4 bytes into a dword $p2 = ord( substr( $inString, $i++, 1 ) ); $p2 |= ord( substr( $inString, $i++, 1 ) ) << 8; $p2 |= ord( substr( $inString, $i++, 1 ) ) << 16; $p2 |= ord( substr( $inString, $i++, 1 ) ) << 24; // mask off 32 bits to be safe $p2 = $p2 & 0xFFFFFFFF; // send dwords to be enciphered $res = tea_encipher($p1, $p2, $key); $outString .= DecToHex($res[0]).DecToHex($res[1]); } // return encrypted string return $outString; } function tea_decrypt( $inString, $key) { $outString = ''; // loop through input string $i = 0; while ( $i < strlen($inString) ) { // 8 hex chars make a dword $p3 = intval( substr( $inString, $i, 4 ), 16 ); // read high 16 bit word $p3 <<= 16; // shift hi word correct position $i += 4; $p3 |= intval(substr( $inString, $i, 4 ), 16 ); // read low 16 bit word $i += 4; $p4 = intval( substr( $inString, $i, 4 ), 16 ); // read high 16 bit word $p4 <<= 16; // shift hi word correct position $i += 4; $p4 |= intval(substr( $inString, $i, 4 ), 16 ); // read low 16 bit word $i += 4; // pass dwords to decipher routine $res = tea_decipher($p3, $p4, $key); // transform results back into alphanumic characters // unpack first dword $outString .= chr( ( $res[0] & 0x000000FF ) ); $outString .= chr( ( $res[0] & 0x0000FF00 ) >> 8 ); $outString .= chr( ( $res[0] & 0x00FF0000 ) >> 16 ); $outString .= chr( shiftRight( ( $res[0] & 0xFF000000 ), 24 ) ); // unpack second dword $outString .= chr( ( $res[1] & 0x000000FF ) ); $outString .= chr( ( $res[1] & 0x0000FF00 ) >> 8 ); $outString .= chr( ( $res[1] & 0x00FF0000 ) >> 16 ); $outString .= chr( shiftRight( ( $res[1] & 0xFF000000 ), 24 ) ); } return trim($outString); } function tea_isValid( $plain, $crypt, $keys ) { return ( tea_encrypt( $plain, $keys ) == $crypt ); } ?>[/CODE]
×
×
  • 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.