Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Yep.. lots of ways the easy option is Option #1 $_SESSION['name']['leftleg'] = $Row['leftleg']; $_SESSION['name']['rightleg'] = $Row['rightleg']; Option #1 (yes this is still option 1) $_SESSION['name'] = array('leftleg' => $Row['leftleg'], 'rightleg' => $Row['rightleg']); to get the data echo $_SESSION['name']['leftleg']; echo $_SESSION['name']['rightleg'];
  2. Read this the problem with the code below is the white space at the start.. either that or your including it from another file that has output! // <---- remove this white space ---> <?php session_start(); $username = $_POST['myusername'];
  3. if your echo'ing it out directly after you could use readfile('version.txt') or even include('version.txt');
  4. Really need to see how its being called but as a gues try <?php if(!isset($_POST['cus_name'])) exit(); //....reset of your code
  5. cURL should do the trick.. <?php <?php $string = "some random text http://tinyurl.com/9uxdwc some http://google.com random text http://tinyurl.com/787988"; $regex = '$\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]$i'; preg_match_all($regex, $string, $result, PREG_PATTERN_ORDER); $A = $result[0]; foreach($A as $B) { $URL = GetRealURL($B); echo "$URL<BR>"; } function GetRealURL( $url ) { $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_USERAGENT => "spider", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); return $header['url']; } ?> Please note that the returned URL could also be a redirected site.. so you could create a recursive function but it depends on how far you want to go! Also my results are as follows: from: http://tinyurl.com/9uxdwc http://google.com http://tinyurl.com/787988 to: http://wikileaks.org/wiki/Denmark:_3863_sites_on_censorship_list%2C_Feb_2008 => correct http://www.google.co.uk/ => yet i'm in the UK http://tinyurl.com/787988 => is error page but still a valid URL! EDIT: reposted due to some bad parse
  6. With a post like that all i can say is nicely done nrg_alpha, and with that i'll jump on your bandwagon while shouting "Regex forever!"
  7. LOL... okay try this.. (read comments) <?php $string = "some random text http://tinyurl.com/123123 some random text http://tinyurl.com/787988"; function do_reg($text, $regex) { preg_match_all($regex, $text, $result, PREG_PATTERN_ORDER); return $result[0]; } $regex = '\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]'; //Your RegEx is missing some parts //Start and End character //aslo your RegEx is case-sensitive add the i ro make it insensitive $regex = '$'.$regex.'$i'; $A =do_reg($string, $regex); foreach($A as $B) { echo "$B<BR>"; } ?>
  8. Its an Int!! $imageid = $_GET['imageid']; if ($_GET['imageid'] == "") { $imageid = 1; } $sql_products = "SELECT * FROM product WHERE productid = '$imageid'"; to $imageid = (int)(!empty($_GET['imageid']))?$_GET['imageid']:1; //default to 1 and forces to int $sql_products = sprintf("SELECT * FROM product WHERE productid = %d ",$imageid);
  9. Ermm.. thats weird you must be using some javascript! can you post your script type date to see the current date use the command "date" from the terminal IE Then, to change it, type this: date --set='Thu Feb 16 08:33:56 PST 2009'
  10. found it sendRequest('fetch.php?topic='+el.options[selected].value); should be sendRequest('fetch.php?state='+el.options[selected].value);
  11. Humm doesn't work for me http://cheezyfries.net/going/fetch.php?topic=5 returns nothing! However i also noticed that function onReadystate() { // var ready=req.readystate; should be function onReadystate() { // var ready=req.readyState; note the capital S "readyState"
  12. did you put the alert in the place i said as your post has the alert in a different place! if(selected!= 0) { //if they choose something other than the first select-->"Select topic first" alert('I GOT HERE1');//<--------------HERE if(ready==4){ //check ready state alert('I GOT HERE');//<--------------HERE
  13. May need the whole thing.. Okay let me see if i have thing right.. you click to edit and change the text in the textbox, click out of the text box and the box goes blank !
  14. try adding before the mail() $body = mb_convert_encoding($body, "ISO-2022-JP","AUTO");
  15. Would need to see more code.. but as a guess i would say your running the update statement after a query to get the page data!
  16. The logic looks okay.. (I know it seams like i'm passing the buck but it seams like a JS problem) try opening fetch.php via the browser with the state and check the output.. fetch.php?state=1 fetch.php?state=2 fetch.php?state=3 assuming thats okay it would be a JS problem try adding an alert (see below) function onReadystate() { // var ready=req.readystate; var data=null; if(ready==4){ //check ready state alert('I GOT HERE');//<--------------HERE data=req.responseText; //read response data var items = data.split(','); var length = items.length; for(var i = 0; i < length; i++) { var childEl = document.createElement('option'); //create option var El = document.getElementById(second); El.appendChild(childEl); //then append it to the second dropdown list childEl.value = items[i]; childEl.innerHTML = items[i]; } } } If after selecting a option from the first box you get the alert then the problem would be the JS directly below it (i assume its in that part) Also try it on another Browser Hope that helps
  17. The to: is in the header.. infact you could remove everything except the header if you construct it well..
  18. Your header is messed up! it should be something like this $boundary = uniqid(time()); $headers = "MIME-Version: 1.0\r\n"; $headers .= "From: Foo <foo@bar.com>\r\n"; $headers .= "Subject: Test mail\r\n"; $headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n"; $message = "This is a MIME encoded message."; $message .= "\r\n\r\n--" . $boundary . "\r\n"; $message .= "Content-type: text/plain;charset=utf-8\r\n\r\n"; $message .= "This is the text/plain version."; $message .= "\r\n\r\n--" . $boundary . "\r\n"; $message .= "Content-type: text/html;charset=utf-8\r\n\r\n"; $message .= "This is the <b>text/html</b> version."; $message .= "\r\n\r\n--" . $boundary . "--"; //mail('bar@foo.com', 'Test mail', $message, $headers); Also Note that using the above you can probably get away with this //mail('', 'Test mail', $message, $headers); as the header is complete
  19. Why ? and whos we? theirs not point redefine all the variables! this should work $sql="INSERT INTO Phone (PhoneType, Number, CustomerID) VALUES ('{$_POST['phonetype']}','{$_POST['phonenumb']}','$lastID')"; But this is safer! $sql=sprintf("INSERT INTO Phone (PhoneType, Number, CustomerID) VALUES ('%s','%s',%d)", mysql_real_escape_string($_POST['phonetype']), mysql_real_escape_string($_POST['phonenumb']), $lastID);
  20. Have you tried echo ? it works well for me Can you post some code Part about fetching and echoing it
  21. wouldn't it be easier to do the count via MySQL ? i assume grouping wouldn't be a problem! <?php $res = 0; foreach ($contents as $id=>$qty) { $sql = "SELECT * , count(`postid`) as Counter FROM `products` WHERE code = '$id' GROUP BY `postid`"; $result = $db->query($sql); $row = $result->fetch(); extract($row); if($postid == 1) { $res += ($Counter*$qty); //Total Number of all items echo $Counter; } $total += $price * $qty; ///..........................SNIP............. } //end of loop echo "TOTAL: $res"; ?>
  22. If items with a plus are the same as ones without a plud then can't you jusr remove it ? $subcats = str_replace("+","",explode($config['csv']['categories_subcat_delimiter'], $c));
  23. I guess you could replace the key but MD5ing with a plus would be different from one without the plus! IE 'Processors|AMD|AM2' Key would be '45d5f03ba9a7bcce8adbb8048ff1bb06' 'Processors|AMD|AM2+' Key would be '225f8e1ddbd44df7fc0b5fa8aaacac76'
  24. Okay i don't understand why you have a limit on your $hour2 query (read comment) <?php $hour1 = " SELECT sum( dur ) as H FROM pirep WHERE login = '$gl' "; $hour1r = mysql_query($hour1); $hour1d = mysql_fetch_assoc($hour1r); //No idea Why your limiting to 30 here but i'll assume theirs more than one! $hour2 = " SELECT thours FROM pilots WHERE login = '$gl' LIMIT 0 , 30 "; $hour2r = mysql_query($hour2); $fhour = $hour1d['H']; while($hour2d = mysql_fetch_assoc($hour2r)) { $fhour += $hour2d['thours']; } echo "~$fhour~"; ?>
  25. thats correct.. as for locking it to only selected file, you could do this <?php $allow = array("myfile.doc", "anotherfile.pdf", "youget.the", "idea.pdf"); $filename = $_GET['file']; if(!in_array($filename,$allow)) //or an SQL query! { die("Invalid FILE"); } ?>
×
×
  • 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.