Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. So are you using $_SESSION['confirmed_order'] or $_SESSION['openorders'] ? from your code it would seam your using, $_SESSION['openorders'] but the confirmed_Order uses $_SESSION['confirmed_order'] using the same code as a previously posted (but using confirmed_order instead and with some example data) <?php //Example session session_start(); $_SESSION['confirmed_order']['quantity'] = Array(1,1,1,1,1); $_SESSION['confirmed_order']['name'] = Array(' Ribs Large pack 20 pieces','25 Piece Bag','Sirloin Steak','50 piece bag of Scalops','Sirloin Steak '); $_SESSION['confirmed_order']['prodid'] = Array(17,28,27,25,27); //update foreach ( $_SESSION['confirmed_order']['name'] as $index=>$name) { //Add $quantity = $_SESSION['confirmed_order']['quantity'][$index]; $name= $_SESSION['confirmed_order']['name'][$index]; $prodid= $_SESSION['confirmed_order']['prodid'][$index]; echo "name: $name\n"; echo "quantity: $quantity\n"; echo "prodid: $prodid\n"; echo "\n"; } May I suggest changing the array build, try this instead confirmed_Order(); //Blar Blar Blar Blar Blar Blar foreach ($_SESSION['confirmed_order'] as $order) { echo "name: " . $order['name'] . "\n"; echo "quantity: " . $order['quantity'] . "\n"; echo "prodid: " . $order['prodid'] . "\n"; echo "\n"; } function confirmed_Order() { if(empty($_POST['name'])) return false; $_SESSION['confirmed_order'] = array(); //clear existing foreach(array_keys($_POST['name']) as $index){ $_SESSION['confirmed_order'][] = array( 'name' => $_POST['name'][$index], 'quantity' => $_POST['quantity'][$index], 'prodid' => $_POST['prodid'][$index] ); } }
  2. My P90 Gun Disagrees with that statement In any case, you can detect what the browser says its name is, but that's not 100% proof, but would be okay for a basic validation. What are you trying to achieve ?
  3. It would be better to fix the construction of the array.. if not then <?php //update foreach ( $_SESSION['openorders']['name'] as $index=>$name) { //Add $quantity = $_SESSION['openorders']['quantity'][$index]; $name= $_SESSION['openorders']['name'][$index]; $prodid= $_SESSION['openorders']['prodid'][$index]; ?> //then update below <tr align="center"> <td width="30"><?php $data=array('name' =>'quantity[]','value'=>$value['quantity']); echo form_input($data); ?></td> <td><?php echo $prodid; ?></td> <td><?php echo $value['name'];?></td> <td><?php echo $value['ordervalue']; ?></td> <td><?php echo $value['pricelb']; ?></td> <td align="right"><?php echo form_checkbox('delete','delete',FALSE); echo form_hidden('prodid[]', $prodid); echo form_hidden('name[]', $name); echo form_hidden('orderid', $value['orderid']); $totalordervalue += $value['ordervalue']; } ?> Hope that help's
  4. Okay first off the array_search will find the key but it will ONLY return the first one found, Try this function fes($string) { $fes['Test 1'] = '104'; $fes['Test 2'] = '104'; $return = array(); foreach($fes as $key => $f){ if($f==$string) $return[] = $key; } return (!empty($return))?$return:'N'; } echo implode(",",fes('104'));
  5. No worries, also can you please use the Topic Solved button (bottom left) ( i have one it for you on this one)
  6. Nice job Only problem is it can't tell you what the differents are! but if thats all you need then cool Congrates
  7. So let me check, Your on a page with a download link, you click the link and another page opens (maybe only flash's open), and the page (with the download link on) hangs! Can you post the code that handles the download page, as i believe you may have some data above it that's outputting thus stopping the content type header and as such filling up the browsers page buffer!
  8. _new only opens 1 windows where as _blank always opens a new window example From main.html if you click both the links (below) your get 2 new windows <a href="123.html" target="_blank">123</a> <a href="456.html" target="_blank">456</a> where as if From main.html if you click both the links (below) your get 1 new windows (first 123 then thats replaced with 456) <a href="123.html" target="_new">123</a> <a href="456.html" target="_new">456/a> Hope that clears that up also can you please click 'Topic Solved' (button at bottom left)
  9. please use PHP/CODE tags as its a pain to read that post, without reading the whole thing (it hurts my eyes) i would suggest the following <?php $WHERE = "State='".$_GET['state']."' "; if (isset($_GET['lease'])) { $WHERE .= "AND lease='".$_GET['lease']."' "; } if (isset($_GET['well_no'])) { $WHERE .= "AND well_no='".$_GET['well_no']."' "; } //etc $SQL = "SELECT * FROM table WHERE $WHERE"; of course that's just the outline to give you the idea
  10. the link that opens that page, make sure the target is target="_blank" also you could do this header("Content-Disposition: attachment; filename=" . $name); header("Content-Type: application/force-download"); //no point having multiple contents types header("Content-Description: File Transfer"); header("Content-Length: " . filesize($adress)); readfile($adress); //or //include $adress; exit();
  11. I don't see anything, is their a function that deals with HTML or JS injection ? Maybe see what happens with single quotes change $txt = str_replace($match[0], sprintf('%s<a href="%s">%s</a>%s',$match[1],$url,$url,$match[4]), $txt); to $txt = str_replace($match[0], sprintf('%s<a href='%s'>%s</a>%s',$match[1],$url,$url,$match[4]), $txt); to
  12. LOL, I hoped you forgot that line or i was totally lost! however I would assume that the $txt has something done to it after my little process!
  13. Think of it this way! BOM is a hidden text file header.. Now ignore that as i use UTF-8 without BOM Now just say 65 = A in ASCII and 0065 = A in UNICODE (UTF- So if i view A in UNICODE (its raw data is 0065) And if i view A in ASCII (its raw data is 65) BUT if I view 0065 in ASCII it would show [nul]A (00 being nul) How about other characters for example ß in UNICODE is basically ß ASCII (but looks better in UNICODE) this is because ASCII only has 255 characters, so displays the bytes as 2 character instead of 1. for more details see here or google in any case, PHP files are text but they can be encoded many different ways, the encoding is used to store and display the text, for example should it display 2 bytes as ß or ß I hope that clears thing up
  14. I have to agree, we have a "Login as" option in the "User Manager" Section (only available to root admins) of one of my system, the only down side is you need to logout and back in to get root access, I should add a restore to own account option really
  15. We loop through Server1, BUT Server2 MAY have more entries, for example Server 1. 1. One 2. Two 3. Three Server 2 1. One 2. Two 3. Three 4. Four Now Server2 has the same as Server1 BUT Server1 doesn't have the same as Server2, as for the unsetting, that's just a quick way for checking for example after 3 we have no entries left in Server1 but 1 in Server2, but which one.. well the ones that are currently set also remember i wrote this free hand in the early hour of the morning..
  16. I just checked the file you uploaded and it was encoded as ASCII, this means the data is stored in a ASCII format, and your outputting as a UTF-8 format.. ASCII: http://madtechiesupport.com/phpfreaks/UTF8/test_special_chars_DW_encoding_setting.php UTF-8: http://madtechiesupport.com/phpfreaks/UTF8/test_special_chars_DW_encoding_setting_v2.php *UTF-8 without BOM: http://madtechiesupport.com/phpfreaks/UTF8/test_special_chars_DW_encoding_setting_v2.php *Recommended Note that I took off the header v2, as the BOM would mess it up, but in V3 its fine, Download the V3 and open it in DM and replace its contents with your contents and it should be fine, 17483_.php 17484_.php
  17. I'm going to need the code you have so far and some sample text, as nothing in the code i have written will create the \" 's Also you do have the line $url = sprintf('http://%syoutube.com/watch?v=%s',$match[2],$match[3]); above it, right ?
  18. No its not! OLD: $txt = str_replace($match[0], sprintf('%s<a href="$s">%s</a>%s',$match[1],$url,$url,$match[4]), $txt); NEW: $txt = str_replace($match[0], sprintf('%s<a href="%s">%s</a>%s',$match[1],$url,$url,$match[4]), $txt);
  19. Doh! My bad $txt = str_replace($match[0], sprintf('%s<a href="$s">%s</a>%s',$match[1],$url,$url,$match[4]), $txt); should be $txt = str_replace($match[0], sprintf('%s<a href="%s">%s</a>%s',$match[1],$url,$url,$match[4]), $txt); but it was 3:45am when i wrote it !!
  20. You say you get the ? when using Western, may i ask why your using Western instead of UTF-8 or are you getting the same for both ? Can you upload a file that doesn't work, (just a sample) posting the code won't help as much as this site will convert them.
  21. The logic is like so, (writing free hand so subject to errors/typos) <?php $Server1 = Array(); $Server2 = Array(); //IN SERVER 1 SQL Loop add $Server1[$row['COLUMN_NAME']] = $row; //IN SERVER 2 SQL Loop add $Server2[$row['COLUMN_NAME']] = $row; //Compare foreach ($Server1 as $key => $fields) { foreach ($fields as $field => $value) { if (isset($Server2[$key][$field])) { if ($Server2[$key][$field] != $value) { echo "Field '$field' values miss-match ($value / {$Server2[$key][$field]})<br />\n"; } else { //Matched } } else { echo "Field '$field' missing<br />\n"; } unset($Server2[$key][$field]); } if(!empty($Server2[$key])){ echo "Server 2 has extra fields"; foreach($Server2[$key] as $K=>$V){ echo "$K=$V<br />\n"; } } unset($Server2[$key]); } if(!empty($Server2)){ echo "Server 2 has extra columns<br />\n"; foreach($Server2 as $K=>$V){ echo "$K=$V<br />\n"; } } That should push you in the right direction.. but its time for me to sleep as its almost 5am!
  22. Ahh yes it will only handle [ quote ] not [ quote=hfdhsdkfk ] etc update the RegEx to $RegEx = '%(\[quote(?:=[^\]]*)\].*?)?\[youtube\]http\://(.*?)youtube\.com/watch\?v\=(.*?)\[/youtube\](.*?\[/quote\])?%ie'; and it should keep them as they were. it does show "LINK" but you could update $txt = str_replace($match[0], sprintf('%s<a href="http://%syoutube.com/watch?v=%s">LINK</a>%s',$match[1],$match[2],$match[3],$match[4]), $txt); to $url = sprintf('http://%syoutube.com/watch?v=%s',$match[2],$match[3]); $txt = str_replace($match[0], sprintf('%s<a href="$s">%s</a>%s',$match[1],$url,$url,$match[4]), $txt); to display the link with the hyper-link
  23. If you prefer to use SQL then why not do it all in SQL ? as all it will take is a few joins !
  24. Move the echo'<form action="grade_post.php" method="post">'; out of the loop and also close the form echo'<form action="grade_post.php" method="post">'; while($row = mysql_fetch_row($re6)){ echo'Recipient<span class="small">(Username)</span><input type="text" value="'.$row['username'].'" readonly="readonly" id="recip" name="recip[' . $n . ']" />'; echo'Subject<input type="text" value="'.htmlentities($otitle, ENT_QUOTES, 'UTF-8').'" id="title" name="title[' . $n . ']" />'; echo'<input type="hidden" value="FOURTH" id="year" name="year[' . $n . ']" />'; echo'<input type="hidden" value="FIRST" id="sem" name="sem[' . $n . ']" />'; echo'Grade<input type="text" id="message" name="message[' . $n . ']" ><br />'; ++$n; } echo'</form>'; Oh and i haven't but you should also apply the array to the ID's as well as the name ie echo'Grade<input type="text" id="message[' . $n . ']" name="message[' . $n . ']" ><br />'; once thats done your get an array So this to echo the message foreach($_POST['message'] as $msg){ echo "$msg<br />\n"; } I'm off night all!
  25. You could create an array from both loops and then use array_diff
×
×
  • 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.