Jump to content

Greywacke

Members
  • Content Count

    510
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Greywacke

  • Rank
    Invested Member
  • Birthday 11/08/1982

Previous Fields

  • Languages
    PHP, Javascript, DHTML, SQL, MySQL, AJAX

Contact Methods

  • MSN
    greywacke35@gmail.com
  • Website URL
    http://holdings.greywacke.inc/
  • ICQ
    37864218
  • Skype
    greywacke_2k7

Profile Information

  • Gender
    Male
  • Location
    662 Van Der Stell Street, Daspoort, Pretoria, 0019, South Africa
  • Interests
    Lepidoptery, Ornithology, Aviculture, Web Development & Graphic Design. Dancing too, over weekends if I get a chance. :P
  1. Hi, I am having a very hard time debugging & running the following query from a cell on php or pma. $sql = "UPDATE crypto SET crypto_openssl_recommendation = 1 WHERE (\"%ECB%\" OR \"%RC2%\" OR \"%RC4%\" OR \"%DES%\" OR \"%3DES%\" OR \"%MD5%\") LIKE UPPER(crypto_descr);"; The table is meant to keep track of OpenSSL encryption methods, and their availability and recommendation over CryptoJS wether used in Javascript, or JScript. This query is meant to update the recommendation, but the quality of my MySQL querying has wilted a bit in the past four years.
  2. beginning to think I reversed the escaping brackets (imean slashes *facepalms* lol overtirednes DOES tend to lead to stupid mistakes lol XD
  3. Hi, the error log says that the executing document has an unexpected quotation mark in line 32, however - the lines following the http 500 error from the php error_log - come from crypto_methods.php and are printed below... (all sensitive information has been replaced with *****) [05-Feb-2019 19:20:58 UTC] PHP Parse error: syntax error, unexpected '"' in /home/*****/public_html/crypto_methods.php on line 32 31. foreach ($ciphers as $key => $value) { 32. $sql = "INSERT INTO crypto (crypto_no, crypto_descr) VALUES (" . $key . ", /"" . $value . "/");"; 33. $result = $conn->query($sql); 34. }
  4. Yes sorry this post is so late but i realised that a day after posting. This isue has been resolved, thouh - thanks nonetheless for clearing it up here, though!
  5. Ah yeah, *facepalms* lol Still though, [31-Jan-2019 13:40:55 UTC] PHP Fatal error: Call to a member function format() on boolean in /home/dwtnfwfv/public_html/default.php on lince 91 Which has to do with the following portion of code, the winning answer at expertsexchange: $monthNum = $row["month"]; $dateObj = DateTime::createFromFormat('!m', $monthNum); $monthName = $dateObj->format('F'); // eg. January - December print "Month: " . $monthName . "<br />\r\n";
  6. Ah yeah, *facepalms* lol Still though, [31-Jan-2019 13:40:55 UTC] PHP Fatal error: Call to a member function format() on boolean in /home/dwtnfwfv/public_html/default.php on line 91 Which has to do with the following portion of code, the winning answer at expertsexchange: placeholder
  7. Hi again, moved the topic to a new one because it no longer uses PCRE. I have the physical problem of having lost my dev pc and 24" screens, now having to make do with android on a 3.5" touchscreen. So the issue i have encountered is again a likeness of this time a bit more physically - "not being able to see the forest for the trees", as my viewing area has been greatly diminished. The code is below, with the php error_log thereafter. <?php $t = intval($_GET["t"]); switch ($t) { case 1: header('Content-Type: Text/XML'); break; case 2: header('Content-Type: Text/JavaScript'); break; case else: header('Content-Type: Text/HTML5'); ?><!DOCTYPE html> <html lang="en-za"> <head> <meta charset="UTF-8"> <title>*** Test Page</title> </head> <body> <p><a href="http://***.com/default.php?t=0&u=Sof00207&f=c&r=45">*** Test Page</a></p><br /> <p> <pre><? /* Initiate Variables for URL: http://***.com/default.php?t=0&u=Sof00207&f=c&r=45 1. Key Field: C 2. Key Row: 45 3. Account Number: Sof00207 4. Month: G 5. Number Of Licenses: 5 6. Active: Y/N: J 7. Licences Used: 3 8. Year: J 9. Module 1: A 10. Module 2: 1 11. Module 3: B 12. Module 4: 0 */ $f = strtoupper($_GET["f"]); $r = intval($_GET["r"]); $f = dirname(__FILE__) . "/RegUploads/" . $_GET["u"] . "#" . $f . $r . ".xml"; print $f . "\r\n\r\n"; if (file_exists($f)) { $ret = file_get_contents($f); print htmlentities($ret); } $servername = "localhost"; $username = "***"; $password = "***"; $dbname = "***"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // echo "Connected successfully"; $q = intval($_GET["q"]); switch ($q) { case 0: // Return Encryption Key by Field A/B/C/D & Row ID // Define SQL String $sql = "SELECT * FROM `Sleutels` WHERE `ID` = " . $r . ";"; $result = $conn->query($sql); if ($result->num_rows > 0) { print "\"" . $sql . "\"<br />\r\n"; // output data of each row while($row = $result->fetch_assoc()) { print "Key: " . htmlencode($row[$f]). "<br />\r\n"; }; } else { print "\"" . $sql . "\"<br />\r\n"; print "0 results<br />\r\n"; }; break; case 1: echo "q equals 1"; break; case 2: echo "q equals 2"; break; }; ?></pre> </p> </body> </html><? }; $conn->close(); ?> [30-Jan-2019 19:42:33 UTC] PHP Parse error: syntax error, unexpected 'else' (T_ELSE) in /home/dwtnfwfv/public_html/default.php on line 11
  8. Greywacke

    pcre query

    Will check the error log then... in the meanwhile, we've decided rather not to use regex but php string functions and a standards recommended querystring style. http://verifyreg.com/default.php?u=Sof00207&f=c&r=45 Have sofar been struggling once again with errors, using the w3c validation service to view the client source - but thanks for reminding 'bout the error log! XD
  9. Greywacke

    pcre query

    hmmm still struggling... $p = '/^([A-D|a-d|1-4]{1,1})0*(100|[1-9][0-9]?)\#([^\#*])\#([^\@])\@([.*])$/is'; bloody HTTP 500....
  10. Greywacke

    pcre query

    ok i tried testing the regex on https://www.regextester.com/ and they say: ERROR: Invalid target or quantifier. over the red and bold portion of the regex string in line 19 of the code(how the heck do i fix it??? that portion is intended to select the number after the preceding 0's. $p = '^([A-D]|[a-d]|[1-4])0*({1,100})\#([^\#*])\#([^\@])\@([.*])$';
  11. Greywacke

    pcre query

    ok i have now attempted to do this by urlencoding that whole string and making it http://verifyreg.com/default.php?q=e0078%23Sof00207%23G5J3!J%40A1B0 still however, i am getting the seemingly irrational HTTP 500 error... i have even tried with or without the urldecode() function around the $_GET["q"] but to now avail... anybody - who can see this forest for the trees, please help!!! <?php /* Initiate Variables for URL: http://verifyreg.com/default.php?q=e0078%23Sof00207%23G5J3!J%40A1B0 1. Key Field: E 2. Key Row: 78 3. Account Number: Sof00207 4. Month: G 5. Number Of Licenses: 5 6. Active: Y/N: J 7. Licences Used: 3 8. Year: J 9. Module 1: A 10.Module 2: 1 11.Module 3: B 12.Module 4: 0 */ var $ret, $p, $q, $m; $p = '^([A-D]|[a-d]|[1-4])0*({1,100})\#([^\#*])\#([^\@])\@([.*])$'; $q = $_GET["q"]; $m = new Array(); var_dump($p."\rn"); var_dump($q."\rn"); var_dump($m."\rn"); /* $ret = preg_match($p,$q,$m); var_dump($m."\rn"); var_dump($ret."\rn"); $k = new Array(2); $k[0] = $m[0][0]; if (is_numeric($k[0])) { $k[0] = ($k[0]<1)?1:($k[0]>4)?4:4; switch ($k[0]) { case 1: // Convert to A $k[0] = "A"; break; case 2: // Convert to B $k[0] = "B"; break; case 3: // Convert to C $k[0] = "C"; break; case 4: // Convert to D $k[0] = "D"; break; case else: $k[0] = ucase($k[0]); } } $k[1] = $m[0][1]; $servername = "localhost"; $username = "dwtnfwfv"; $password = "ECp2yc20p7"; $dbname = "dwtnfwfv_SoftoitRegs"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("<!-- Connection failed: ".$conn->connect_error." -->"); } echo "<!-- Connected successfully -->"; // Define SQL String $sql = "SELECT `".$k[0]."` FROM `Sleutels` WHERE `ID` = `".$k[1]."`;"; $result = $conn->query($sql); switch ($m) { case 0: // Return Key by $k <Field A-D & Row ID if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>"; } } else { echo "0 results"; } break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; } If ($m == `0`) Then Response.MimeType = `Text/HTML5`; Else If (Request.QueryString(`m`) == `1`) Then Response.MimeType = `WebGL/SVG`); Else If (Request.QueryString(`m`) == `2`) Then Response.MimeType = `Text/JavaScript`); End If $conn->close(); */ ?>
  12. Greywacke

    pcre query

    Have decided to go with preg_match instead of preg_match_all but i still get the same HTTP 500 error... what's up with that??? The top pcre code has changed as follows: <?php /* Initiate Variables 1. Key Field 2. Key Row */ $p = '/(A-Da-d1-4)0*(1-100)\#(^\#)\#(^\@)\@(*)/'; $q = $_SERVER["QUERY_STRING"]; $m = new Array(); $ret = preg_match($p,$q,$m); if ($ret !== false && $ret > 0) { print_r($m.$ret); } ... Will test and see if escaping them helps.
  13. Greywacke

    pcre query

    Thanks justsomeguy; will take that under advisory... (please note however, that the key I mention has nothing to do with a traditional key/value pair but is rather a reference as to where the chosen encryption key is located in the database.) However i still receive the HTTP 500 error - any idea why? Here's the code: <?php /* Initiate Variables 1. Key Field 2. Key Row */ $p = "|(A-Da-d1-4)0*(1-100)#(^#)#(^@)@(*)|U"; $q = $_SERVER["QUERY_STRING"]; $m = new Array(); $ret = preg_match_all($p,$q,$m); if ($ret !== false && $ret > 0) { print_r($m.$ret); } /* $k = new Array(2); $k[0] = $m[0][0]; if (is_numeric($k[0])) { $k[0] = ($k[0]<1)?1:($k[0]>4)?4:4; switch ($k[0]) { case 1: // Convert to A $k[0] = "A"; break; case 2: // Convert to B $k[0] = "B"; break; case 3: // Convert to C $k[0] = "C"; break; case 4: // Convert to D $k[0] = "D"; break; case else: $k[0] = ucase($k[0]); } } $k[1] = $m[0][1]; $servername = "localhost"; $username = "dwtnfwfv"; $password = "ECp2yc20p7"; $dbname = "dwtnfwfv_SoftoitRegs"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // echo "Connected successfully"; // Define SQL String $sql = "SELECT `$k[0]` FROM `Sleutels` WHERE `ID` = `$k[1]`"; $result = $conn->query($sql); switch ($m) { case 0: // Return Key by $k <Field A-D & Row ID if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>"; } } else { echo "0 results"; } break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; } If ($m == `0`) Then Response.MimeType = `Text/HTML5`; Else If (Request.QueryString(`m`) == `1`) Then Response.MimeType = `WebGL/SVG`); Else If (Request.QueryString(`m`) == `2`) Then Response.MimeType = `Text/JavaScript`); End If $conn->close(); */ ?> Will include .htaccess conntents too if that may bring some clarity? RewriteEngine on # php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php56” package as the default “PHP” programming language. <IfModule mime_module> AddType application/x-httpd-ea-php56 .php .php5 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit
  14. Greywacke

    pcre query

    hi all, long time no see... i have a php document which needs to test the entire querystring such as follows: http://verifyreg.com/?c0078#Sof00207#G5J3!J@A1B0 now to process this querystring without variables... i have the following code: // Initiate Variables 1. Key Field 2. Key Row $p = `|(A-Da-d1-4)0*(1-100)#(^#)#(^@)@(*)|U`; $q = $_GET; $m = new Array(); $ret = preg_match_all($p,$q,$m); if ($ret !== false && $ret > 0) { print_r($m.$ret); } however the part after the first # will all be encoded eventually... the first part is to define the field to select the key from, the second part is the row, for the current session. the key will be used on the serverside to encrypt the rest of the querystring after the first #.
  15. it would actually be quite awesome if w3schools were to add a WebGL 2.0 reference! i personally intend to disguise a 128-bit key as a rotating 3d image using webgl 2.0... the reason for this is so that the javascript/ajax may decrypt the encrypted information received from serverside php from mysql... anyone considering this?
×
×
  • Create New...