-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] php upgrade renders my old page translator oddly
MadTechie replied to jsciarrino's topic in PHP Coding Help
read up on Register Globals which have been disabled in PHP5 and removed in PHP6 your Need to update your code ($lan to $_GET['lan']) <? if ($_GET['lan']=="spanish") { ?> <p class="translate"><a href="page.php">english</a></p> <p>hola</p> <? } else { ?> <p class="translate"><a href="page.php?lan=spanish">english</a></p> <p>hello</p> <? } ?> you could do $lan = $_GET['lan']; at the start of the page or extract($_GET) but i highly recommend you update your code correctly extracting user-input is a very bad move -
okay update this line $query="INSERT INTO TEST1_contacts VALUES('$first','$last','$cell','$email')"; to $query="INSERT INTO TEST1_contacts (`First_Name`, `Last_Name`, `Phone_Number`, `Email`)VALUES('$first','$last','$cell','$email')";
-
try this <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Populate Database </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <BODY> <H1>Add Contact</H1> <FORM METHOD="GET" action="post.php"> <P>First Name</P><input type="text" name="first" size=20 maxlength=50> <P>Last Name</P><input type="text" name="last" size=20 maxlength=50> <P>Cell Phone</P><input type="text" name="cell" size=20 maxlength=50> <P>Email</P><input type="text" name="email" size=20 maxlength=50> <INPUT type="hidden" <P></P><INPUT type="submit" value="ADD CONTACT"> </FORM> </BODY> </HTML> <? //Connect to database// $username="mekam2_kai"; $password="753159"; $database="mekam2_kai1"; mysql_connect(localhost,$username,$password)or die("I couldnt connect, sir. By the way, am I being paid for acting like a personal butler?"); mysql_select_db($database)or die("The database you are trying to access is currently unavailable. Curious..."); //Retrieve Variables// $first=trim(mysql_real_escape_string($_GET['first'])); $last=trim(mysql_real_escape_string($_GET['last'])); $cell=trim(mysql_real_escape_string($_GET['cell'])); $email=trim(mysql_real_escape_string($_GET['email'])); //Make sure all variables submitted// if($first == "") { die("Enter First Name... please?"); } else if($last == "") { die("Enter Last Name... please?"); } else if($cell == "") { die("Enter Cell Phone... please?"); } else if($email == "") { die("Enter Email... please?"); }else{ //Query statement// $query="INSERT INTO TEST1_contacts VALUES('$first','$last','$cell','$email')"; mysql_query($query); $query="SELECT * FROM TEST1_contacts WHERE First_Name = '$first'"; $result=mysql_query($query); $num=mysql_num_rows($result) OR die(mysql_error()); if($num==0) { die("Could not insert data"); } else if($num>1) { $query="SELECT * FROM TEST1_contacts WHERE Last_Name = '$last'"; $result=mysql_query($query); $num=mysql_num_rows($result) OR die(mysql_error()); if($num==0) { die("Could not insert data"); } else if($num>1) { $query="SELECT * FROM TEST1_contacts WHERE Phone_Number = '$cell'"; $result=mysql_query($query); $num=mysql_num_rows($result) OR die(mysql_error()); if($num==0) { die("Could not insert data"); } else if($num>1) { $query="SELECT * FROM TEST1_contacts WHERE Email = '$email'"; $result=mysql_query($query); $num=mysql_num_rows($result) OR die(mysql_error()); if($num==0) { die("Could not insert data"); } } } } } $i=0; while($i<$num){ $firstname=mysql_result($result,$i,"First_Name"); $lastname=mysql_result($result,$i,"Last_Name"); $cellphone=mysql_result($result,$i,"Phone_Number"); $emailaddress=mysql_result($result,$i,"Email"); echo "Inserted $firstname $lastname Cell: $cellphone Email: $emailaddress"; ++$i; } ?>
-
I may be on the wrong track here but wouldn't this be easier ? <?php foreach($_POST as $P) { if(!empty($P['NAME'])) { mysql_query ("insert into players (`GameID`, `name`, `sex`, `score`) values ('$GameID', '{$P['player']}', '{$P['sex']}', '0')"); } } ?>
-
I hvae used BAT2EXEC does that make me a hacker...... oh please say yes!!!
-
[SOLVED] do/while versus while loop confusion...
MadTechie replied to Dan06's topic in PHP Coding Help
if i am reading your code correctly you should only be missing the first record!! try the code below and read the comments (i have commented out 1 line) <html> <head> <?php include("objects.php"); $dropmenu = new dropmenuDisplay(); $format = new stringFormat(); $dbconn = new dbConnection(); session_start(); $messagesQuery = sprintf("SELECT msgSender, message_content.msgId, msgDate, msgContent FROM utility.message_inbox, utility.message_content WHERE msgRecipient = %s AND message_inbox.msgId = message_content.msgId", $format->formatValue($_SESSION["userId"])); $msgQueryResult = mysql_query($messagesQuery, $dbconn->conn()) or die("Inbox Message Query Error: " . $messagesQuery . " " . mysql_error()); #$msgInfo = mysql_fetch_assoc($msgQueryResult); //This Get the first record $membershipIdQuery = sprintf("SELECT membershipId FROM utility.user_information WHERE userId = %s", $format->formatValue($msgInfo["msgSender"])); $memIdQueryResult = mysql_query($membershipIdQuery, $dbconn->conn()) or die("Membership Id Query Error: " . $membershipIdQuery . " " . mysql_error()); $membershipIdValue = mysql_fetch_assoc($memIdQueryResult); $profileImgQuery = sprintf("SELECT profileImage FROM utility.profile WHERE membershipId = %s", $format->formatValue($membershipIdValue["membershipId"])); $profileImgResult = mysql_query($profileImgQuery, $dbconn->conn()) or die("Profile Image Query Error: " . $profileImgQuery . " " . mysql_error()); $profileImgLoc = mysql_fetch_assoc($profileImgResult); ?> </head> <body> <?php /* Now gets the second, third, fouth etc, with a DO the first record would be echo'ed then it would continue as normal! But by removing the line above (see #) the line below will get the first record */ while ($msgInfo = mysql_fetch_assoc($msgQueryResult)) { echo '<div class="displayMsg">' . '<img src="' . $profileImgLoc["profileImage"] . '" width="100px" height="100px" />' . ' ' . $msgInfo["msgDate"] . ' ' . $msgInfo["msgContent"] . '</div>'; } ?> </body> </html> -
First off hack or cracking is not illegal.. but check the licence agreement (breaking that is illegal) and most state you are NOT allowed hack/crack it.. ZEND Encoded/Encrypted files can be decrypted, thay have had a weakness for a long time (atleast 2 years) the old hack was inface a hacked PHP+Apache on linux, the basic idea is that Zend basically converted into a byte code this made it smaller, quicker, but also impossible to read by people.. a few tweaks ie and an optional obfuscator and you have a zend encoded file.. the problem is the whole file get decoded in memory infact its very close to the interpreted code you started with.. thus not that hard to "decrypt", this is becase of the way php is designed its designed to be an interpreted language and not a complied one.. and yes i can "decrypt" files i have since 2007.. So it stands to reason that i am very NOT impressed! and you my kiddie scripter friend have not written a hack for anything! And just as a just a quick note about MD5... as far as i am aware the quickest way to pair a HASH with a plain text format is to use a PS3 (yes a playstation) reason.. well the PS was designed to do simple calulations very quickly and MD5 is a simple calc. google "ps3 crackstation" or something
-
Welcome, Can you click Topic Solved
-
Yeah i know, but all results were 1 to 1.1, but on each test preg was slightly faster
-
it makes sense if this is what you wanted <a href="index.php?ID=1">ID = 1</a> <?php echo "ID=".$_GET['ID']; ?>
-
Kinda weird, mine is the other way around
-
Parse error: syntax error, unexpected T_STRING
MadTechie replied to cwelch's topic in PHP Coding Help
$TEXT_MAIN = 'The LoveBazaar is a place for Couples to explore and enjoy their sexuality. We will ALWAYS respect your privacy, and it is our goal that you are 100% satisfied, both with us and within yourself. <b>Any products that you want but do not see can be requested by emailing us at requests@thelovebazaar.net</b>.<br><br><table border="0" width="100%" cellspacing="5" cellpadding="2"><tr><td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/1.gif') . '</td><td class="main" valign="top"><b>Shipping</b><br><br>Most of our products ship within 24 hours provided that you get your order to us before 1PM EST. Orders placed after 1PM EST will be included in the following day\'s shipments.<br><br></td></tr> <td class="main" valign="top">' . tep_image(DIR_WS_IMAGES . 'default/2.gif') . '</td><td class="main" valign="top"><b>Paying for Your Order</b><br><br>We accept MasterCard, VISA, American Express, Discover, PayPal, checks and money orders. Your order will be processed for shipment as soon as your payment clears. As soon as that occurs, we will contact you by email to let you know when you should expect your shipment.<br><br>br><br><tr><td class="main" valign="top">'; you also needed to escape the single quote and i assume tep_image is a function ! -
Opps Count require a group try this $rowsPerPage = 6; $pageNum = 1; if(isset($_GET['page'])) { $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $self = $_SERVER['PHP_SELF']; $catalogue_query = "Product_ID, Genus, Division FROM products"; if (isset($_GET['Genus'])) { $catalogue_query .=" WHERE Genus = '" .mysql_real_escape_string($_GET['Genus']). "'"; } if (isset($_GET['Division'])) { $catalogue_query .=" AND Division = '" .mysql_real_escape_string($_GET['Division']). "'"; } $result = mysql_query("SELECT COUNT(Product_ID) AS numrows, $catalogue_query GROUP BY Product_ID") or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; $maxPage = ceil($numrows/$rowsPerPage); $catalogue_query .= " ORDER BY Product_ID DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query("SELECT ".$catalogue_query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); echo " Showing page $pageNum of $maxPage pages "; {
-
Your very welcome, Topic Solved then
-
Okay.... function hex2bin($h) { if (!is_string($h)) return null; $r=''; for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); } return $r; } their is now EDIT: infact as were only doing one hex at a time you could use hexdec() by itself any chance of letting on to what your changing ?
-
[SOLVED] File extension not shown on downloads
MadTechie replied to Mutley's topic in PHP Coding Help
Add the quotes to the file time, may of worked but by telling the browser the Content-Type should work -
can you post the fully revised code please
-
try this what mod's you making ? as their probably a better way <?php $location = 'file.csh'; $file_open = fopen($location, "rb"); $file_content = fread($file_open, filesize($location)); fclose($file_open); $info_array = array(); $L = strlen($file_content); for($i = 0; $i < $L; $i++) { $info_array[] = substr(bin2hex($contents{$i}),-2).'|'; } //Do mod's //whatever... //rebuild $bin_array = array(); foreach($info_array as $Hex) { $bin_array[] = hex2bin($Hex); } file_put_contents("newfile.csh",implode("",$bin_array)); ?>
-
[SOLVED] File extension not shown on downloads
MadTechie replied to Mutley's topic in PHP Coding Help
Try this, if it fails then you could uncomment the 2 commented lines ini_set('zlib.output_compression','Off'); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); #header('Content-Type: application/vnd.ms-excel;'); #header("Content-Type: application/x-msexcel"); ob_clean(); flush(); readfile($file); exit; -
Your welcome.. Can you please click the solved button, bottom left (i think)
-
I assume this data is a MySQL Database.. if so it would be helpful to see some sample data and the structure
-
See attached [attachment deleted by admin]
-
try this you must have the Content-type set to UTF-8 See Next post this site is messing it up EDIT: okay take out the & this site seam to add them!!
-
try this if (preg_match('/^\d{1,3}$/', $cadence)) { //yay it matches } else { $_SESSION['error_count']++; $_SESSION['cadence_err'] = 'Error: Cadence must be a numeral.'; } EDIT: oh for EREG it would be if (ereg('^[[:digit:]]{1,3}$', $cadence)) {
-
Its because of the LIMIT Change $catalogue_query .= " ORDER BY Product_ID DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query($catalogue_query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; $maxPage = ceil($numrows/$rowsPerPage); to $result = mysql_query($catalogue_query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; $maxPage = ceil($numrows/$rowsPerPage); //Count before setting the limit, // then add the limit and search again $catalogue_query .= " ORDER BY Product_ID DESC LIMIT $offset, $rowsPerPage"; $result = mysql_query($catalogue_query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC);