-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Your better bet is to do this $_GET['p'] = 3; $WPdir = dirname(__FILE__)."/content"; chdir($WPdir); include($WPdir."/index.php"); that way your using the absolute path EDIT: minor typo in code
-
MalwareBytes isn't an antivirus, its malware scanner, AVG is okay as its free.. I'm not a great fan, IMHO Norton sucks, Half the time your need to be fully infected before it does anything and then doesn't remove it completely, and it is a resource hog, Avast, is good I like the scan on boot that's a cool feature but every now and again I have to remove and reinstall it, it seam the logs stay in memory or get bloated, and slows the system down, Kaspersky I find works quite well, However one package never seams to cover all, but running 2 in real time causes hell, so IMHO, find a good one for real time scanning and another one for full scans,
-
Yes, here the longer version if(strpos($maze[$x],"N")) echo (file_exists($x."_north.jpg"))?"<img src=\"".$x."_north.jpg\">":"<img src=\"north.jpg\">"; // is the same as if(strpos($maze[$x],"N"))//if N is found { //check to see if the file "X_north.jpg" exists (X being the position) if(file_exists($x."_north.jpg")) { //display image echo "<img src=\"".$x."_north.jpg\">"; }else{ //display image echo "<img src=\"north.jpg\">"; } } PS their a bug in the previous version file_exists("$x_north.jpg") should be file_exists($x."_north.jpg")
-
You could shorten it to $x = $_SESSION['pos']; //users position if(strpos($maze[$x],"N")) echo "<img src=\"north.jpg\">"; if(strpos($maze[$x],"S")) echo "<img src=\"south.jpg\">"; if(strpos($maze[$x],"E")) echo "<img src=\"east.jpg\">"; if(strpos($maze[$x],"W")) echo "<img src=\"west.jpg\">"; EDIT: of course this would mean all the doors look the same.. to add some flavour you could add a check to see if the door is unique ie $x = $_SESSION['pos']; //users position if(strpos($maze[$x],"N")) echo (file_exists("$x_north.jpg"))?"<img src=\"".$x."_north.jpg\">":"<img src=\"north.jpg\">"; //same as above for South East West so for room 22 north door your create a file called 22_north.jpg
-
More complete example $maze = array( [0]=> "S", [1]=> "EX", [2]=> "EW", [3]=> "EW", [4]=> "SW", [5]=> "NE", [6]=> "EW", [7]=> "SW", [8]=> "SE", [9]=> "NW", [10]=> "SE", [11]=> "SW", [12]=> "NS", [13]=> "NSE", [14]=> "SW", [15]=> "NS", [16]=> "N", [17]=> "NS", [18]=> "N", [19]=> "NS", [20]=> "NE", [21]=> "EW", [22]=> "NEW", [23]=> "EW", [24]=> "NW"); [attachment deleted by admin]
-
Not really, (depends what you class as a lot), the reason for the HTML files is just for graphic design, if you think of a 5x5 maze that's 25 rooms, 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Now just say you that's an array $pos = 0; //in room 0 $maze = array("SE","EW","SEW","W", "S", "N","S","X"); //Rooms 0 to 7 (because I'm lazy) I start in room 0 and need to get to 7 using the logic above i include X.html to show the user some pretty stuff, but the choices can be PHP driven, infact you could cheat and have rooms with X doors and just show that. heres the basic logic i used I can go [0 ] South or East, now I'm in room 0.html I go East [1] East or West now I'm in room 1.html I go East [2] South or East or West now I'm in room 2.html I go East [3] West now I'm in room 3.html I go West [2] South or East or West now I'm in room 2.html I go West [1] East or West now I'm in room 1.html I go West [0 ] South or East, now I'm in room 0.html I go South [5] North now I'm in room 5.html I go North [0 ] South or East, now I'm in room 0.html I go East [1] East or West now I'm in room 1.html I go East [2] South or East or West now I'm in room 2.html I go South [7] Exit Done Just store their position in the database linked to their account
-
Its possible, as I wrote a basic one some years back, The problem I had was I wanted to start at a random pace and get to a random place, I also wanted the maze to be different each time and I wanted a map. Mine had only 4 doors, North, South, East and West, it was integrated into another system but I could possible find the maze generator (which I modified from one I found one the web, can't remember where) Knowing where the use is positioned was done via sessions, if they logged out and in, they had to re-enter a new maze, If your Maze is going to be the same routes each time then you could just create and array with possible directions and a html file name to load
-
[SOLVED] Countdown from Current date to Recordset Date
MadTechie replied to yandoo's topic in PHP Coding Help
Simple solution would be write it manually instead of using dreamweaver, <?php $conn = mysql_connect("localhost", "mysql_user", "mysql_password"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("mydbname")) { echo "Unable to select mydbname: " . mysql_error(); exit; } //May want to add a WHERE here $sql = "SELECT DATEDIFF (CURDATE(), SowDate) AS intval FROM `vegeschedule` "; $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; exit; } while ($row = mysql_fetch_assoc($result)) { echo $row["intval"]."<br />\n"; } mysql_free_result($result); ?> -
[SOLVED] Countdown from Current date to Recordset Date
MadTechie replied to yandoo's topic in PHP Coding Help
You totally lost me, you have a MySQL query that works but you want to do it in PHP then pass it to MySQL without having the target date! what exactly are you trying to get ? -
A simple solution would be to create a gmail email account, and use PHPMailer
-
By "Displaying the results" do you mean the decrypted code ? or the results from the code ? as for using the uploaded file directly try this <form method="post" action="decoder.php" enctype="multipart/form-data"> <input type="file" name="data" value="Upload" /> <input type="submit" value="data" /> <br /> <?php define("_ENCRYPTOR_KEY_", "cfcd208495d565ef66e7dff9f98764da"); define("_DECODER_PATH_", "decoder.php"); //You can change this path to point to the decoder file in another location. if(file_exists(_DECODER_PATH_)){include_once(_DECODER_PATH_);} else{echo"Decoder file does not exist";} // Relative or absolute path to the decoder file if (isset($_FILES['data'])) { $file = file_get_contents($_FILES['data']['tmp_name']); define("_ENCRYPTED_CODE_", $file); function decrypt( $key, $data ) { return $this->endecrypt( $key, base64_decode( $data ), "decrypt" ); } function encrypt( $key, $data ) { return base64_encode( $this->endecrypt( $key, $data, "encrypt" ) ); } if ( defined( "_ENCRYPTOR_KEY_" ) && defined( "_ENCRYPTED_CODE_" ) ) { if ( strlen( _ENCRYPTOR_KEY_ ) == "32" ) { $rc4 = new rc4crypt( ); $code = $rc4->decrypt( _ENCRYPTOR_KEY_ .strrev( _ENCRYPTOR_KEY_ ), _ENCRYPTED_CODE_ ); //as the _ENCRYPTED_CODE_ is invalid code i fixed it with the following code, this should be really br removed $code = substr( $rc4->decrypt( _ENCRYPTOR_KEY_ .strrev( _ENCRYPTOR_KEY_ ), _ENCRYPTED_CODE_ ),0,-7).'";'; eval( $code ); echo $souvik; } else { echo "Invalid key entered!"; } }else{ echo "Decoding error!"; } } class rc4crypt { function decrypt( $key, $data ) { return $this->endecrypt( $key, base64_decode( $data ), "decrypt" ); } function encrypt( $key, $data ) { return base64_encode( $this->endecrypt( $key, $data, "encrypt" ) ); } function endecrypt ($pwd, $data, $case) { if ($case == 'decrypt') { $data = urldecode($data); } $key[] = ""; $box[] = ""; $temp_swap = ""; $pwd_length = 0; $pwd_length = strlen($pwd); for ($i = 0; $i <= 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length), 1)); $box[$i] = $i; } $x = 0; for ($i = 0; $i <= 255; $i++) { $x = ($x + $box[$i] + $key[$i]) % 256; $temp_swap = $box[$i]; $box[$i] = $box[$x]; $box[$x] = $temp_swap; } $temp = ""; $k = ""; $cipherby = ""; $cipher = ""; $a = 0; $j = 0; for ($i = 0; $i < strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $box[$a]) % 256; $temp = $box[$a]; $box[$a] = $box[$j]; $box[$j] = $temp; $k = $box[(($box[$a] + $box[$j]) % 256)]; $cipherby = ord(substr($data, $i, 1)) ^ $k; $cipher .= chr($cipherby); } if ($case == 'decrypt') { $cipher = urldecode(urlencode($cipher)); } else { $cipher = urlencode($cipher); } return $cipher; } } ?>
-
Your welcome, we need a buy a drink button on this site lol
-
the file your trying to decrypt isn't a valid encrypted PHP file, to view the file change eval( $code ); to echo htmlspecialchars( $code ); also remove echo $souvik; its not needed and your need the PHP isn't valid
-
Ahh so the problem is the following includes, changing the working directory may fix that <?php $_GET['p'] = 3; chdir('content'); //added include(dirname(__FILE__)."/content/index.php"); ?>
-
Looking back I am still not sure why my first suggestion didn't work.. I have tweaked it a little, and it should work, assuming its in the folder that contains the folder "content" that as WP inside. <?php $_GET['p'] = 3; include(dirname(__FILE__)."/content/index.php"); ?>
-
Try connecting to the site via FTP, download and edit then upload the file..
-
Okay the _ENCRYPTED_CODE_ is invalid, it has 2 quotes at the end, so I added a little hack (line 43), this should be removed, also _ENCRYPTED_CODE_ should be the contents of the file, i'll leave that to you <form method="post" action="decoder.php" enctype="multipart/form-data"> <input type="file" name="data" value="Upload" /> <input type="submit" value="data" /> <br /> <?php define("_ENCRYPTED_CODE_", "eG1mJUIwJUYyJTkyTC5nel8lM0MlMkElMDYlRjglOUYlMDklQjYlM0IlRDcwJUNEJTNEWiVCNyVGNCVBOSU1RCVCNSVBMkslMjclRDglM0ElREFjJUFFJTI2JUQz"); define("_ENCRYPTOR_KEY_", "cfcd208495d565ef66e7dff9f98764da"); define("_DECODER_PATH_", "decoder.php"); //You can change this path to point to the decoder file in another location. if(file_exists(_DECODER_PATH_)){include_once(_DECODER_PATH_);} else{echo"Decoder file does not exist";} // Relative or absolute path to the decoder file if (isset($_FILES['data'])) { $file = file_get_contents($_FILES['data']['tmp_name']); /* $file should really be _ENCRYPTED_CODE_ but as thats defined above, i used that, but the above code is wrong! */ function decrypt( $key, $data ) { return $this->endecrypt( $key, base64_decode( $data ), "decrypt" ); } function encrypt( $key, $data ) { return base64_encode( $this->endecrypt( $key, $data, "encrypt" ) ); } if ( defined( "_ENCRYPTOR_KEY_" ) && defined( "_ENCRYPTED_CODE_" ) ) { if ( strlen( _ENCRYPTOR_KEY_ ) == "32" ) { $rc4 = new rc4crypt( ); $code = $rc4->decrypt( _ENCRYPTOR_KEY_ .strrev( _ENCRYPTOR_KEY_ ), _ENCRYPTED_CODE_ ); //as the _ENCRYPTED_CODE_ is invalid code i fixed it with the following code, this should be really br removed $code = substr( $rc4->decrypt( _ENCRYPTOR_KEY_ .strrev( _ENCRYPTOR_KEY_ ), _ENCRYPTED_CODE_ ),0,-7).'";'; eval( $code ); echo $souvik; } else { echo "Invalid key entered!"; } }else{ echo "Decoding error!"; } } class rc4crypt { function decrypt( $key, $data ) { return $this->endecrypt( $key, base64_decode( $data ), "decrypt" ); } function encrypt( $key, $data ) { return base64_encode( $this->endecrypt( $key, $data, "encrypt" ) ); } function endecrypt ($pwd, $data, $case) { if ($case == 'decrypt') { $data = urldecode($data); } $key[] = ""; $box[] = ""; $temp_swap = ""; $pwd_length = 0; $pwd_length = strlen($pwd); for ($i = 0; $i <= 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length), 1)); $box[$i] = $i; } $x = 0; for ($i = 0; $i <= 255; $i++) { $x = ($x + $box[$i] + $key[$i]) % 256; $temp_swap = $box[$i]; $box[$i] = $box[$x]; $box[$x] = $temp_swap; } $temp = ""; $k = ""; $cipherby = ""; $cipher = ""; $a = 0; $j = 0; for ($i = 0; $i < strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $box[$a]) % 256; $temp = $box[$a]; $box[$a] = $box[$j]; $box[$j] = $temp; $k = $box[(($box[$a] + $box[$j]) % 256)]; $cipherby = ord(substr($data, $i, 1)) ^ $k; $cipher .= chr($cipherby); } if ($case == 'decrypt') { $cipher = urldecode(urlencode($cipher)); } else { $cipher = urlencode($cipher); } return $cipher; } } ?>
-
allow_url_fopen = on is the main one, so changing that and restarting apache should get you up and running, as I personally don't use GoDaddy for hosting, I decided to look at what options they have Now if you have Hosting Configuration 2.0 your in luck you could create/edit that root php.ini file and that should be all..
-
okay you missed the last ' so the values were like this VALUES ('123', 'abc','blar) note the missing ' also ORDER is a reserved word, so you can't use it, unless you tell MySQL its a field by enclosing it in backticks
-
Okay the reason its not working is simple, remote file access is turn off, So you can't pull in data from remote files, the way your have designed the system to work is to pull in data from word press post parse, this requires you to pull in the remote file.. the fact that go daddy has blocked this is the cause of the problem, Theirs a few solutions (I can think of), #1, create your own CMS (okay that's going to be a pain) #2, create a hack to fit your solution into WP, #3, create an adapter, basically your own class that connects to WP and display the correct info via sessions (whatever) #4, read directly from the WP database
-
try this mysql_query("INSERT INTO UserCP(name, link_name, content, `order`) VALUES('".$_POST['name']."','".$_POST['lname']."','".$_POST['content']."','".($order[0] -1)."')") or array_push($error_array, "ERROR08 - ".mysql_error()); Added last ' and used back ticks on order field
-
I said its a sign of a bad design, the fact it works doesn't change that. the fact you need to pass a get value to an included file shows the bad design, if the file is on the same server (which I assume it is) then you should at least use sessions in the file (your including) a simple work around should be <?php readfile("http://www.toyrecruiter.com/content/?p=3"); ?> but without a greater understanding of what you have done and want your trying to achieve it very hard to say. EDIT: please don't take offence, I am just trying save you time when expand your current solution, as these things make life harder later on, fixing them sooner saves major headaches later!
-
Erm.. you shouldn't include things like that! (sign of a bad design) I guess you could do this <?php $_GET['p'] = 3; include("content/index.php"); ?> that doesn't fix the bad design problem!
-
My favourite dog was a Doberman/German Shepard cross, however Fluffy will beat any other [attachment deleted by admin]