cwarn23 387 Occupation: Genius Team Colleague Featured Poster

lol, Ordering a gun from the menu in the macdonalds drive through.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I got 2 of 3 the first time because I am used to the scientific color scale. But nice questions with only 5 seconds to answer each one.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I only have one instance of the script at any given time and when I try to sort the 446,600 rows in the table by ascending order, it takes ages to display the last couple of rows with the limit parameter. It never displayed but I exit the display script after about 7 minutes. So is there any way around this like there was for the count(*) function. Because it seems mysql is having trouble handling huge tables (43MB compressed).

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Okaaaaay. That rant made no sense what so ever. Given that - by looking at rather vague computer specs listed in profile - is not that old a system; meaning that so long as your mobo actually supports more than 4GB of RAM, why on earth didn't you go XP Pro x64, which support far more than a mere 8GB RAM??

And what on earth would you want 8GB of RAM for in Ubuntu?? That kind or RAM suggests either HD Gaming on max resolution, or rendering/transcoding of HD video; or of course creating/editing/rendering large or complex 3D models or animations - none of which Ubuntu is any use for!

So the entire basis for you rant was.....??

I don't like the 64-bit windows at all because it is compleately incompatible with nearly every piece of software I have where as at least Ubuntu has it's equivelant software for free + wine and virtualbox emulator. Also why I use so much ram? I'll put it this way, I do a lot of things at once like copying music to the computer while browsing the internet with 20 tabs while waiting for a 3d model to render while using the tv tuner with automated tasks such as email checking 3 accounts every 5-10 minutes. So my computer goes through a lot. In fact, I lost 512MB of my ram because it overloaded.
And also I've found all of the Ubuntu equivelents except for the TV viewer. So truely linux would …

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

How can the number of loops I have be a factor in the speed because I set it so that all loops break after seven rounds. Also I modified the mysql_num_rows to mysql_fetch_assoc with the count(*) and now it completes 8 rows in 7 minutes. However my main problem is that when it inserts the row, it doesn't append at the end of the table. It chooses any spot to insert near the end at random. And this could cause problems. Also as for why I have so many loops, it is because I need that end up with that many digits with every possible combination.

So as for the current problem, speed and making the rows insert at the end of the table. My current script is as follows:

<?php
set_time_limit(90);
$load=file_get_contents('/proc/loadavg');
$load=explode(' ',$load);
echo 'Load='.$load[0];
if ($load[0]<=0.40) {
mysql_connect('localhost','username','password');
mysql_select_db('database');
$char=array('','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0','~','`','!','@','#','$','%','^','&','*','(',')','-','_','+','=','\\','|','{','}','[',']',';',':','"','\'',',','<','.','>','?','/',' ');
$bchar=array(''=>0,'a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5,'f'=>6,'g'=>7,'h'=>8,'i'=>9,'j'=>10,'k'=>11,'l'=>12,'m'=>13,'n'=>14,'o'=>15,'p'=>16,'q'=>17,'r'=>18,'s'=>19,'t'=>20,'u'=>21,'v'=>22,'w'=>23,'x'=>24,'y'=>25,'z'=>26,'A'=>27,'B'=>28,'C'=>29,'D'=>30,'E'=>31,'F'=>32,'G'=>33,'H'=>34,'I'=>35,'J'=>36,'K'=>37,'L'=>38,'M'=>39,'N'=>40,'O'=>41,'P'=>42,'Q'=>43,'R'=>44,'S'=>45,'T'=>46,'U'=>47,'V'=>48,'W'=>49,'X'=>50,'Y'=>51,'Z'=>52,'1'=>53,'2'=>54,'3'=>55,'4'=>56,'5'=>57,'6'=>58,'7'=>59,'8'=>60,'9'=>61,'0'=>62,'~'=>63,'`'=>64,'!'=>65,'@'=>66,'#'=>67,'$'=>68,'%'=>69,'^'=>70,'&'=>71,'*'=>72,'('=>73,')'=>74,'-'=>75,'_'=>76,'+'=>77,'='=>78,'\\'=>79,'|'=>80,'{'=>81,'}'=>82,'['=>83,']'=>84,';'=>85,':'=>86,'"'=>87,'\''=>88,','=>89,'<'=>90,'.'=>91,'>'=>92,'?'=>93,'/'=>94,' '=>95,"\r"=>0);
$r=mysql_query('SELECT count(*) FROM `hash`');
$rrr=mysql_fetch_assoc($r);
if ($rrr['count(*)']>0) {
    $re=mysql_query('SELECT uncompress(`id`) as `id` FROM `hash` LIMIT '.($rrr['count(*)']-1).',1');
    $d=mysql_fetch_assoc($re);
    $d['id']=$d['id'];
    if (strlen($d['id'])<7) {
        while (strlen($d['id'])<7) {
              $d['id']="\r".$d['id'];
              }
        }
    $x=str_split($d['id'],1);
    $j[1]=$bchar[$x[0]];
    $j[2]=$bchar[$x[1]];
    $j[3]=$bchar[$x[2]];
    $j[4]=$bchar[$x[3]];
    $j[5]=$bchar[$x[4]];
    $j[6]=$bchar[$x[5]];
    $j[7]=$bchar[$x[6]];
    $j[7]+=1;
    if ($j[7]>95) {
        $j[6]+=1;
        $j[7]=0;
        }
    } else {
    $j[1]=0;
    $j[2]=0;
    $j[3]=0;
    $j[4]=0;
    $j[5]=0;
    $j[6]=0;
    $j[7]=0;
    }
unset($bchar);
$m=0;
$l=0;
$p=true;
$passgo=0;
$sleeper=0;
for ($i[1]=$j[1];$i[1]<15;$i[1]++) { //16.0655625GB Database
    for ($i[2]=$j[2];isset($char[$i[2]]);$i[2]++) {
        for ($i[3]=$j[3];isset($char[$i[3]]);$i[3]++) {
            for ($i[4]=$j[4];isset($char[$i[4]]);$i[4]++) {
                for ($i[5]=$j[5];isset($char[$i[5]]);$i[5]++) {
                    for ($i[6]=$j[6];isset($char[$i[6]]);$i[6]++) {
                        $m+=$l;
                        $l=0;
                        for ($i[7]=$j[7];isset($char[$i[7]]);$i[7]++) {
                            if ((!empty($i[6]) && empty($i[7])) ||  (!empty($i[5]) && (empty($i[6]) || empty($i[7]))) ||  (!empty($i[4]) && (empty($i[5]) || empty($i[6]) || empty($i[7]))) || …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The thing is that it can spend minutes on possibly just the one mysql query. I have timed this script and took over 8 minutes and counting hogging all of my server recourses. It is almost as if it's in an infinit loop when it's not doing anything during that time. But I don't see any infinit loop in that script and haven't go a clue as to why it would take so long and so many recourses to use that script.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Actually it doesn't add 12 hours in that situation because 12:00pm is midday just like 12:00am is just after midnight. Just how the system of time seems to work.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
$num_rows = CountRecords("SELECT * FROM ".TBL_CREDITS." WHERE user_id = $user_id");
if($num_rows >0){
$result = selectFrom("SELECT * FROM ".TBL_CREDITS." WHERE user_id = $user_id");

Try replacing the above lines of code with something like the following:

$num_rows = CountRecords("SELECT * FROM `credits` WHERE user_id = '".mysql_real_escape_string($user_id)."'");
if($num_rows >0){
$result = selectFrom("SELECT * FROM `credits` WHERE user_id = '".mysql_real_escape_string($user_id)."'");

However replace the tablename credits with the real name of the table.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Also I fixed that bug with the following:

<?
$string="I should go to doctor 12:30.";
//set variable above
//don't change below.
preg_match_all('/^(.*[^0-9]|)(([0-9]+\:[0-9]+|[^0-9:][0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)|'.
'(([0-9]+\:[0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)))$/',$string,$time);
$timeb=$time[3][0];
$var=explode(':',$timeb);
if (!isset($var[1]) || empty($var[1])) {
    $var[1]=0;
    }
if ($time[5][0]=='pm') {
$var[0]+=12;
}
$timestamp=0;
if ($var[0]>=24) {
    $var[0]-=1;
    $timestamp=3600;
    }
//$var[0]-=1;
if (!preg_match_all('/(tomorrow|tomrrow|tomorrw|tomorow|[^0-9]([0-9][0-9]?|)[^0-9]?[^0-9]?[^0-9]?(\bjanuary\b|'.
'\bjan\b|\bfebruary\b|\bfeb\b|\bmarch\b|\bmar\b|\bapril\b|\bapr\b|\bmay\b|\bjune\b|\bjun\b|\bjuly\b|\bjul\b|'.
'\baugust\b|\baug\b|\bseptember\b|\bsep\b|\bsept\b|\boctober\b|\boct\b|\bnovember\b|\bnov\b|\bdecember\b|\bdec\b)'.
'[^0-9]?[^0-9]?[^0-9]?([0-9][0-9]|)[^0-9][^0-9]?[^0-9]?([0-9][0-9][0-9][0-9]|)[^:][^:])/i',$string,$dateresult)) {
    $date=date('j F Y').' '.$var[0].':'.$var[1].':00';
    } else {
    if ($dateresult[1][0]=='tomorrow' || $dateresult[1][0]=='tomrrow' || $dateresult[1][0]=='tomorrw' || $dateresult[1][0]=='tomorow') {
        $date='tomorrow';
        } else {
        $months=array('january'=>'January','jan'=>'January','february'=>'February','feb'=>'February','march'=>'March',
        'mar'=>'March','april'=>'April','apr'=>'April','may'=>'May','june'=>'June','jun'=>'June','july'=>'July',
        'jul'=>'July','august'=>'August','aug'=>'August','september'=>'September','sep'=>'September','sept'=>'September',
        'october'=>'October','oct'=>'October','november'=>'November','nov'=>'November','december'=>'December','dec'=>'December');
        if (!empty($dateresult[4][0])) {
            $date=$dateresult[4][0];
            } else if (!empty($dateresult[2][0])) {
            $date=$dateresult[2][0];
            } else if (substr_count(strtolower(date('F')),strtolower($dateresult[3][0]))>0) {
            $date=date('j');
            } else {
            $date='1';
            }
        if (empty($dateresult[5][0])) {
            $year=date('Y');
            } else {
            $year=$dateresult[5][0];
            }
        $date.=' '.$months[strtolower($dateresult[3][0])].' '.$year.' '.$var[0].':'.$var[1].':00';
        }
    }
echo date('d-m-Y h:ia', ($timestamp+strtotime($date)));
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I managed to implement the date into the script but still the error about 24:xx is still there. I think it is actually a bug with the strtotime function. But while I try and fix it the following will give you something to play around with.

<?
$string="I should go to doctor 23:30.";
//set variable above
//don't change below.
preg_match_all('/^(.*[^0-9]|)(([0-9]+\:[0-9]+|[^0-9:][0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)|'.
'(([0-9]+\:[0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)))$/',$string,$time);
$timeb=$time[3][0];
$var=explode(':',$timeb);
if (!isset($var[1]) || empty($var[1])) {
    $var[1]=0;
    }
if ($time[5][0]=='pm') {
$var[0]+=12;
}
//$var[0]-=1;
if (!preg_match_all('/(tomorrow|tomrrow|tomorrw|tomorow|[^0-9]([0-9][0-9]?|)[^0-9]?[^0-9]?[^0-9]?(\bjanuary\b|\bjan\b|\bfebruary\b|\bfeb\b|\bmarch\b|\bmar\b|\bapril\b|\bapr\b|\bmay\b|\bjune\b|\bjun\b|\bjuly\b|\bjul\b|\baugust\b|\baug\b|\bseptember\b|\bsep\b|\bsept\b|\boctober\b|\boct\b|\bnovember\b|\bnov\b|\bdecember\b|\bdec\b)[^0-9]?[^0-9]?[^0-9]?([0-9][0-9]|)[^0-9][^0-9]?[^0-9]?([0-9][0-9][0-9][0-9]|)[^:][^:])/i',$string,$dateresult)) {
    $date=date('j F Y').' '.$var[0].':'.$var[1].':00';
    } else {
    if ($dateresult[1][0]=='tomorrow' || $dateresult[1][0]=='tomrrow' || $dateresult[1][0]=='tomorrw' || $dateresult[1][0]=='tomorow') {
        $date='tomorrow';
        } else {
        $months=array('january'=>'January','jan'=>'January','february'=>'February','feb'=>'February','march'=>'March','mar'=>'March','april'=>'April','apr'=>'April','may'=>'May','june'=>'June','jun'=>'June','july'=>'July','jul'=>'July','august'=>'August','aug'=>'August','september'=>'September','sep'=>'September','sept'=>'September','october'=>'October','oct'=>'October','november'=>'November','nov'=>'November','december'=>'December','dec'=>'December');
        if (!empty($dateresult[4][0])) {
            $date=$dateresult[4][0];
            } else if (!empty($dateresult[2][0])) {
            $date=$dateresult[2][0];
            } else if (substr_count(strtolower(date('F')),strtolower($dateresult[3][0]))>0) {
            $date=date('j');
            } else {
            $date='1';
            }
        if (empty($dateresult[5][0])) {
            $year=date('Y');
            } else {
            $year=$dateresult[5][0];
            }
        $date.=' '.$months[strtolower($dateresult[3][0])].' '.$year.' '.$var[0].':'.$var[1].':00';
        }
    }
echo date('d-m-Y h:ia', strtotime($date));
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have written a dehasher and the first 446000 rows in the mysql database have turned out ok but now my script isn't placing the entries into the database in order and is taking like a minute per entry to do it. Does anybody know what is wrong with the following script?

<?php
set_time_limit(90);
$load=file_get_contents('/proc/loadavg');
$load=explode(' ',$load);
echo 'Load='.$load[0];
if ($load[0]<=0.25) {
mysql_connect('localhost','user','password');
mysql_select_db('database');
$char=array('','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0','~','`','!','@','#','$','%','^','&','*','(',')','-','_','+','=','\\','|','{','}','[',']',';',':','"','\'',',','<','.','>','?','/',' ');
$bchar=array(''=>0,'a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5,'f'=>6,'g'=>7,'h'=>8,'i'=>9,'j'=>10,'k'=>11,'l'=>12,'m'=>13,'n'=>14,'o'=>15,'p'=>16,'q'=>17,'r'=>18,'s'=>19,'t'=>20,'u'=>21,'v'=>22,'w'=>23,'x'=>24,'y'=>25,'z'=>26,'A'=>27,'B'=>28,'C'=>29,'D'=>30,'E'=>31,'F'=>32,'G'=>33,'H'=>34,'I'=>35,'J'=>36,'K'=>37,'L'=>38,'M'=>39,'N'=>40,'O'=>41,'P'=>42,'Q'=>43,'R'=>44,'S'=>45,'T'=>46,'U'=>47,'V'=>48,'W'=>49,'X'=>50,'Y'=>51,'Z'=>52,'1'=>53,'2'=>54,'3'=>55,'4'=>56,'5'=>57,'6'=>58,'7'=>59,'8'=>60,'9'=>61,'0'=>62,'~'=>63,'`'=>64,'!'=>65,'@'=>66,'#'=>67,'$'=>68,'%'=>69,'^'=>70,'&'=>71,'*'=>72,'('=>73,')'=>74,'-'=>75,'_'=>76,'+'=>77,'='=>78,'\\'=>79,'|'=>80,'{'=>81,'}'=>82,'['=>83,']'=>84,';'=>85,':'=>86,'"'=>87,'\''=>88,','=>89,'<'=>90,'.'=>91,'>'=>92,'?'=>93,'/'=>94,' '=>95,"\r"=>0);
$r=mysql_query('SELECT `id` FROM `hashes`');
$n=mysql_num_rows($r);
if ($n>0) {
    $re=mysql_query('SELECT uncompress(`id`) as `id` FROM `hashes` LIMIT '.($n-1).',1');
    $d=mysql_fetch_assoc($re);
    $d['id']=$d['id'];
    if (strlen($d['id'])<7) {
        while (strlen($d['id'])<7) {
              $d['id']="\r".$d['id'];
              }
        }
    $x=str_split($d['id'],1);
    $j[1]=$bchar[$x[0]];
    $j[2]=$bchar[$x[1]];
    $j[3]=$bchar[$x[2]];
    $j[4]=$bchar[$x[3]];
    $j[5]=$bchar[$x[4]];
    $j[6]=$bchar[$x[5]];
    $j[7]=(($bchar[$x[6]]+1)<95)?$bchar[$x[6]]+1:95;
    } else {
    $j[1]=0;
    $j[2]=0;
    $j[3]=0;
    $j[4]=1;
    $j[5]=1;
    $j[6]=1;
    $j[7]=1;
    }
unset($bchar);
$m=0;
$l=0;
$p=true;
$passgo=0;
$sleeper=0;
for ($i[1]=$j[1];$i[1]<15;$i[1]++) { //16.0655625GB Database
    for ($i[2]=$j[2];isset($char[$i[2]]);$i[2]++) {
        for ($i[3]=$j[3];isset($char[$i[3]]);$i[3]++) {
            for ($i[4]=$j[4];isset($char[$i[4]]);$i[4]++) {
                for ($i[5]=$j[5];isset($char[$i[5]]);$i[5]++) {
                    for ($i[6]=$j[6];isset($char[$i[6]]);$i[6]++) {
                        $m+=$l;
                        $l=0;
                        for ($i[7]=$j[7];isset($char[$i[7]]);$i[7]++) {
                            if ((!empty($i[6]) && empty($i[7])) ||  (!empty($i[5]) && (empty($i[6]) || empty($i[7]))) ||  (!empty($i[4]) && (empty($i[5]) || empty($i[6]) || empty($i[7]))) ||  (!empty($i[3]) && (empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7]))) ||  (!empty($i[2]) && (empty($i[3]) || empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7]))) ||  (!empty($i[1]) && (empty($i[2]) || empty($i[3]) || empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7])))) {
                            } else {
                            $v=$char[$i[1]].$char[$i[2]].$char[$i[3]].$char[$i[4]].$char[$i[5]].$char[$i[6]].$char[$i[7]];
                            $z=hash('sha1',$v);
                            $hash=mysql_real_escape_string(substr($z,0,4).hash('crc32',$z).hash('crc32b',$z));
                            $s=mysql_real_escape_string($v);
                            if (($l+$m)<8) {
                                $r=mysql_query('SELECT `id` FROM `hashes` WHERE `id`=compress("'.$s.'") AND `sha1`=compress("'.$hash.'")');
                                if (mysql_num_rows($r)==0) {
                                    mysql_query('INSERT INTO `hashes` SET `id`=compress("'.$s.'"), `crc32`=compress("'.mysql_real_escape_string(hash('crc32',$v)).'"), `crc32b`=compress("'.mysql_real_escape_string(hash('crc32b',$v)).'"), `sha1`=compress("'.$hash.'")');$l++;
                                    } else {
                                    if (($l+$m)>5) { $exits=true; break; }
                                    }
                                } else {
                                mysql_query('INSERT INTO `hashes` SET `id`=compress("'.$s.'"), `crc32`=compress("'.mysql_real_escape_string(hash('crc32',$v)).'"), `crc32b`=compress("'.mysql_real_escape_string(hash('crc32b',$v)).'"), `sha1`=compress("'.$hash.'")');$l++; …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Perhaps this might be better:

mail($to, $subject, $body,
    "From: Mr. User <user@site.com>\r\n" .
    "MIME-Version: 1.0\r\n" .
    "Content-Type: multipart/alternative;\r\n" .
    "     boundary=" . $mime_boundary_header."\r\n") or die('Mail Error');
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It's true that short tag has less character to type. But there are many well PHP editor out there, which automatically create a proper <?php ?> syntax with a single click or via hotkey.

But then how many people RTFM to find out what those hotkeys are? Probably find rarely are hotkeys used even if they are available. Also I think some people might like how it is possible to make the opening tag look a lot like the closing tag which is clean and simple. That is what would make people use short tags a lot.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

This might be out of your price range, but Rack Space has a really good hosting deal. It is $100/month, but they are very reliable, you can set up billing, hosting limits, register domains, etc. all from their control panel. It is mainly if you make websites for people and you want to manage all of them together.

Another really good thing is their customer service. You give your customers their phone number, and Rack Space answers the phone using your business title, as if they were the tech support for your business.

There is more information here:

http://www.rackspacecloud.com/cloud_hosting_products/sites/faq

I entered in the specs of the plan I'm on with my host and it's over double the price. If there was something like that where you can decide cpu, storage space and bandwidth for a third of the price then I would be very interested in the near future. BTW, the cost that came up for me was $200/month before I add some fancy stuff then it ends up around $325/month. Hope a list of more hosts where I can decide the plan but cheaper can be listed in this topic.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I think the main reason why people prefer short tags is that they are faster to type with 60% less letters/symbols to type. Also they look neater but as previously mentioned, it is best to use <?php for compatibility as I think short tags a depreciated in php6.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

To retrieve the variable param from the url simply use $_GET to get its value.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

There are several solutions to this problem. You could modify your php.ini file to allow php short tags. Or if you don't have access to the core php.ini file you can add the following code to the very top of your document.

<?php ini_set('short_open_tag',1); ?><?
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

$data='<table width="100%">
	<tr>
		<td align="center">
		<b>
			<h1 class="title_list">$$FullName$$</h1>
		</b>
		<br><br>
		</td>
 	</tr>
  	<tr>
   		<td>$$FirstName$$ is a $$Gender$$.</td>
	</tr>
</table>';
$data=str_replace(array('$$FirstName$$','$$Gender$$','$$FullName$$'),array('Bill','Male','Bill Gates'),$data);
echo $data;
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I did a google search and the following link might be of great interest to you. http://www.m6.net/ Enjoy.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

In my script, to echo the title simply use echo $header[1][0]; or to echo the entire header use echo $header[0][0]; Also virtually all webpages have the title tag but not all pages have the meta tags.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

My previous code was from the top of my head but I have tested it and should be as follows:

<?php
        // create curl resource
        $ch = curl_init();

        // set url
        curl_setopt($ch, CURLOPT_URL, "www.realgm.com");

        //return the transfer as a string
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        // $output contains the output string
        $output = curl_exec($ch);
      preg_match_all('#<head>.*<title>(.*)</title>.*</head>#Usi',$output,$header);

      echo '<xmp>';
      print_r($header);
      echo '</xmp>';
      
         // close curl resource to free up system resources
        curl_close($ch);
      ?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I managed to solve it. Turned out to be two problems. First one was the browsers cache needed to be cleared. Second problem was that the following rule needed to be added to my htaccess file because the image paths had a capital "W" where the real paths had a lower "w" in "wiki".

RewriteRule ^Wiki/(.*)$ http[B]:[/B]//www.syntax.cwarn23.info/wiki/$1 [L]

Computers can be annoying at times.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I have just noticed with my media wiki installation that all of my pictures in mediawiki are suddenly broken. The files are there but if I enter the path location in the url bar it takes infinit time to load (never loads - no error). Same for in the cms pages. I have tried deleting all htaccess files and still nothing. Does anybody know what is happening? An example path is as follows:

http[B]:[/B]//www.syntax.cwarn23.info/wiki/skins/common/images/button_bold.png
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try this:

<?
$string="I should go to doctor tomrrow 13:30.";
//set variable above
//don't change below.
 
preg_match_all('/^(.*[^0-9]|)(([0-9]+\:[0-9]+|[^0-9:][0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)|'.
'(([0-9]+\:[0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)))$/',$string,$time);
$timeb=$time[3][0];
$var=explode(':',$timeb);
if (!isset($var[1]) || empty($var[1])) {
    $var[1]=0;
    }
if ($time[5][0]=='pm') {
$var[0]+=12;
}
 
echo date('d-m-Y h:ia', strtotime('tomorrow '.$var[0].':'.$var[1].':00'));
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

As simular as the code may look try the following:

<?
$string="I should go to doctor tomrrow 5:30.";
//set variable above
//don't change below.
 
preg_match_all('/^(.*|)(([0-9]+\:[0-9]+|[^0-9:][0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)|'.
'(([0-9]+\:[0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)))$/',$string,$time);
$timeb=$time[3][0];
$var=explode(':',$timeb);
if (!isset($var[1]) || empty($var[1])) {
    $var[1]=0;
    }
if ($time[5][0]=='pm') {
$var[0]+=12;
}
 
echo date('d-m-Y h:ia', strtotime('tomorrow '.$var[0].':'.$var[1].':00'));
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try using this on this output variable:

preg_match_all('#<head>.*(<title>.*</title>|).*</head>#',$output,$header);
echo '<xmp>';
print_r($header);
echo '</xmp>';
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

From the list I would say Java as it is so easy to use with the Netbeans compiler. But my favourite which isn't on the list is php/php-gtk.

nomemory commented: Netbeans is not a "java compiler". It's an IDE +0
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

MySQL works fine, but when I hit the 'Start' button to start Apache it says "Running" in like 10 secs, and then it stops running again.. And in the short time it is running when I try to hit "Admin" is cannot open the web-browser, and Apache service stops..

I have this problem a lot with XAMPP. The usual procedures is first to press Ctrl+Alt+Delete to go into the task manager. Then end task to the process named apache.exe and httpd. After that try reopening your control panel and single click the apache load button. Then wait for 20 seconds then if not loaded double click on the load apache button instead of single click. Normally that works for me.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I just love making bots. You can view my article at: http://www.syntax.cwarn23.info/PHP_Making_a_search_engine
The script is as follows:

<form method="post">Scan site: <input type="text" name="site" value="http://" style="width:300px">
<input value="Scan" type="submit"></form>
<?
set_time_limit (0);
if (isset($_POST['site']) && !empty($_POST['site'])) {
/* Formats Allowed */
$formats=array('html'=>true,'htm'=>true,'xhtml'=>true,'xml'=>true,'mhtml'=>true,'xht'=>true,
'mht'=>true,'asp'=>true,'aspx'=>true,'adp'=>true,'bml'=>true,'cfm'=>true,'cgi'=>true,
'ihtml'=>true,'jsp'=>true,'las'=>true,'lasso'=>true,'lassoapp'=>true,'pl'=>true,'php'=>true,
'php1'=>true,'php2'=>true,'php3'=>true,'php4'=>true,'php5'=>true,'php6'=>true,'phtml'=>true,
'shtml'=>true,'search'=>true,'query'=>true,'forum'=>true,'blog'=>true,'1'=>true,'2'=>true,
'3'=>true,'4'=>true,'5'=>true,'6'=>true,'7'=>true,'8'=>true,'9'=>true,'10'=>true,'11'=>true,
'12'=>true,'13'=>true,'14'=>true,'15'=>true,'16'=>true,'17'=>true,'18'=>true,'19'=>true,
'20'=>true,'01'=>true,'02'=>true,'03'=>true,'04'=>true,'05'=>true,'06'=>true,'07'=>true,
'08'=>true,'09'=>true,'go'=>true,'page'=>true,'file'=>true);
 
function domain ($ddomain) {
return preg_replace('/^((http(s)?:\/\/)?([^\/]+))(.*)/','$1',$ddomain);
}
 
function url_exists($durl)
		{
		// Version 4.x supported
		$handle   = curl_init($durl);
		if (false === $handle)
			{
			return false;
			}
		curl_setopt($handle, CURLOPT_HEADER, true);
		curl_setopt($handle, CURLOPT_FAILONERROR, true);  // this works
		curl_setopt($handle, CURLOPT_HTTPHEADER, 
Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") );
		curl_setopt($handle, CURLOPT_NOBODY, true);
		curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
		$connectable = curl_exec($handle);
		curl_close($handle);  
        if (stripos(substr_replace($connectable,'',30),'200 OK')) {
            return true;
            } else {
            return false;
            }
		}
 $fdata='';
//below function will only get links within own domain and not links outside the site.
function getlinks($generateurlf) {
    global $formats;
    global $f_data;
    $f_data=file_get_contents($generateurlf);
    $datac=$f_data;
    preg_match_all('/(href|src)\=(\"|\')([^\"\'\>]+)/i',$datac,$media);
    unset($datac);
    $datac=$media[3];
    unset($media);
    $datab=array();
    $str_start=array('http'=>true,'www.'=>true);
    foreach($datac AS $dfile) {
        $generateurle=$generateurlf;
		$format=strtolower(preg_replace('/(.*)[.]([^.\?]+)(\?(.*))?/','$2',basename($generateurle.$dfile)));
        if (!isset($str_start[substr_replace($dfile,'',4)])) {
            if (substr_replace($generateurle,'',0, -1)!=='/') {
                $generateurle=preg_replace('/(.*)\/[^\/]+/is', "$1", $generateurle);
                } else {
                $generateurle=substr_replace($generateurle,'',-1);
                }
 
            if (substr_replace($dfile,'',1)=='/') {
                if (domain($generateurle)==domain($generateurle.$dfile)) {
                    if (isset($formats[$format]) 
                        || substr($generateurle.$dfile,-1)=='/' || substr_count(basename($generateurle.$dfile),'.')==0) {
                        $datab[]=$generateurle.$dfile;
                        }
                    }
                } else if (substr($dfile,0,2)=='./') {
                $dfile=substr($dfile,2);
                if (isset($formats[$format])) {$datab[]=$generateurle.'/'.$dfile;}
                } else if (substr_replace($dfile,'',1)=='.') {
                while (preg_match('/\.\.\/(.*)/i', $dfile)) {
                $dfile=substr_replace($dfile,'',0,3);
                $generateurle=preg_replace('/(.*)\/[^\/]+/i', "$1", $generateurle);
                }
                if (domain($generateurle)==domain($generateurle.'/'.$dfile)) {
                    if (isset($formats[$format]) || substr($generateurle.'/'.$dfile,-1)=='/' 
                        || substr_count(basename($generateurle.'/'.$dfile),'.')==0) {
                        $datab[]=$generateurle.'/'.$dfile;
                        }
                    }
                } else {
                if (domain($generateurle)==domain($generateurle.'/'.$dfile)) {
                    if (isset($formats[$format]) || substr($generateurle.'/'.$dfile,-1)=='/' 
                        || substr_count(basename($generateurle.'/'.$dfile),'.')==0) {
                        $datab[]=$generateurle.'/'.$dfile;
                        }
                    }
                }
            } else {
            if (domain($generateurle)==domain($dfile)) { …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Sorry about the late reply but I have been really busy. Your code should look something like the following:

<?
$string="I should go to doctor tomrrow 5 am.";
//set variable above
//don't change below.
 
preg_match_all('/^(.*|)(([0-9]+\:[0-9]+|[^0-9:][0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z])([^a-zA-Z].*|)|'.
'(([0-9]+\:[0-9]+)([^a-zA-Z]+|)([a-zA-Z][a-zA-Z]|)([^a-zA-Z].*|)))$/',$string,$time);
$timeb=$time[3][0];
$var=explode(':',$timeb);
if (!isset($var[1]) || empty($var[1])) {
    $var[1]=0;
    }
if ($time[5][0]=='pm') {
$var[0]+=12;
}
 
echo date('d-m-Y h:ia', strtotime('tomorrow '.$var[0].':'.$var[1].':00'));
?>

Hope that helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I managed to make a work around for mediawiki which allows both custom directories and for the path of the mediawiki title to be at the root url. My solved htaccess file is as follows:

Options[B] +[/B]FollowSymlinks
RewriteEngine On

RewriteRule ^-(.*)$ http://syntax.cwarn23.info/$1 [L,R=301]
RewriteRule ^$ /wiki/index.php [L]
RewriteRule ^Botindex-Topics_-_(.+)$ /wiki/index.php?title=Botindex-Topics_-_$1 [L,QSA]
RewriteRule ^BotTopics/([^/]*)/([0-9a-zA-Z]+)$ /wiki/extensions/danibot/indexarticle.php?forum=$1&id=$2 [L,QSA]

RewriteRule ^Language=([^/-]*)$ /wiki/index.php?title=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^LB-][^oa][^tn].*)$ /wiki/index.php?title=$1 [L,QSA]

Hope that is useful for anyone reading this in the future.
*Solved*

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

After 12 hours non stop of working at this problem I have solved it for the time being but does anybody know how to remove the annoying dash in the following .htaccess file:

Options +FollowSymlinks
RewriteEngine On

RewriteRule ^$ /wiki/index.php [L]
RewriteRule ^Botindex-Topics_-_(.+)$ /wiki/index.php?title=Botindex-Topics_-_$1 [L,QSA]
RewriteRule ^BotTopics/([^/]*)/([0-9a-zA-Z]+)$ /wiki/extensions/blah/indexarticle.php?forum=$1&id=$2 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
[B]RewriteRule ^-(.*)$ /wiki/index.php?title=$1 [L,QSA][/B]
RewriteRule ^Language=([^/-]*)$ /wiki/index.php?title=$1 [L,QSA]

The part in bold and red needs to somehow be changed so it doesn't have a dash at the beginning but still allow the other htaccess rules to work. Thanks.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I managed to fix the url although I'm not 100% happy with the solution. But now I have a really weird problem that I have never seen in my life. I have a url variable named $_GET['id'] which equals the string value of 202693 . I then run the following script.

$r=mysql_query('SELECT * FROM `faq_data` WHERE `id`="'.$_GET['id'].'" AND `forum`="'.mysql_real_escape_string($_GET['forum']).'"',$con1) or die(mysql_error());
    $data=mysql_fetch_assoc($r);
    if ($_GET['id']=='202693') {
        $content.='<script>alert("\'SELECT * FROM `faq_data` WHERE `id`=\"'.$_GET['id'].'\" AND `forum`=\"'.mysql_real_escape_string($_GET['forum']).'\"\'");</script>';
        }
    print_r($data);

Now with the above script, it displays the message with the query but it won't print the array $data. However the id 202693 does exist in the database. Does anybodyh know what's happening?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I just discovered \B will match multiple characters and that's why \B worked. But still I can't get my code to match. Does anybody know the problem. I have even tried the following without any success:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^$ /wiki/index.php [L,QSA]
RewriteCond %{REQUEST_URI} !^/Botindex/(.+)$ [NC]
RewriteRule ^([^/]+)$ /wiki/index.php?title=$1 [L,QSA]

Anybody please?

I just discover that using RewriteCond %{REQUEST_URI} !^\/?\B.*$ [NC] will work but adding the rest of the string after the \B will make it stop working. Any reason?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I just discover that using RewriteCond %{REQUEST_URI} !^\/?\B.*$ [NC] will work but adding the rest of the string after the \B will make it stop working. Any reason?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi, I'm trying to add a condition to my htaccess file but it seems to only match if I use %{REQUEST_URI} !^/?.+$ . If however I add %{REQUEST_URI} !^/?B.+$ it will never match. Also the full code showing what I am trying to achieve is as follows:

[B]RewriteEngine On[/B]
[B]RewriteRule[/B] ^$ /wiki/index.php [L,QSA]
[B]rewriteCond[/B] %{REQUEST_URI} !^/?Botindex/[^/]+/.+$ [NC]
[B]RewriteRule[/B] ^([^/]+)$ /wiki/index.php?title=$1 [L]

Does anybody know why the rewrite condition just won't match on some of the simplest syntaxes. This is really bugging me. Thanks.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have just solved this and anybody who wants the use the above code are free to do so. Turns out the problem was that the hash for "a " or "a<space>" (without the quotes) had not been generated. This has been fixed and would like to see your comments on the effeciency of this code compared to what you have seen in the past.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have a problem in my script and if this problem can be solved my script should be complete. What my script does is it records every possible combination string into a database however some strings ending with a space are not being recorded. My full code is as follows:

<?php
set_time_limit(90);
$load=file_get_contents('/proc/loadavg');
$load=explode(' ',$load);
echo 'Load='.$load[0];
if ($load[0]<=0.60) {
mysql_connect('localhost','user','password');
mysql_select_db('database');
$char=array('','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',
'U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0','~','`','!','@','#','$','%','^','&',
'*','(',')','-','_','+','=','\\','|','{','}','[',']',';',':','"','\'',',','<','.','>','?','/',' ');
$bchar=array(''=>0,'a'=>2,'b'=>3,'c'=>4,'d'=>5,'e'=>6,'f'=>7,'g'=>8,'h'=>9,'i'=>10,'j'=>11,
'k'=>12,'l'=>13,'m'=>14,'n'=>15,'o'=>16,'p'=>17,'q'=>18,'r'=>19,'s'=>20,'t'=>21,'u'=>22,
'v'=>23,'w'=>24,'x'=>25,'y'=>26,'z'=>27,'A'=>28,'B'=>29,'C'=>30,'D'=>31,'E'=>32,'F'=>33,
'G'=>34,'H'=>35,'I'=>36,'J'=>37,'K'=>38,'L'=>39,'M'=>40,'N'=>41,'O'=>42,'P'=>43,'Q'=>44,
'R'=>45,'S'=>46,'T'=>47,'U'=>48,'V'=>49,'W'=>50,'X'=>51,'Y'=>52,'Z'=>53,'1'=>54,'2'=>55,
'3'=>56,'4'=>57,'5'=>58,'6'=>59,'7'=>60,'8'=>61,'9'=>62,'0'=>63,'~'=>64,'`'=>65,'!'=>66,
'@'=>67,'#'=>68,'$'=>69,'%'=>70,'^'=>71,'&'=>72,'*'=>73,'('=>74,')'=>75,'-'=>76,'_'=>77,
'+'=>78,'='=>79,'\\'=>80,'|'=>81,'{'=>82,'}'=>83,'['=>84,']'=>85,';'=>86,
':'=>87,'"'=>88, '\''=>89,','=>90,'<'=>91,'.'=>92,'>'=>93,'?'=>94,'/'=>95,' '=>95,"\r"=>0);
$r=mysql_query('SELECT `id` FROM `hash`');
$n=mysql_num_rows($r);
if ($n>0) {
    $re=mysql_query('SELECT uncompress(`id`) as `id` FROM `hash` LIMIT '.($n-1).',1');
    $d=mysql_fetch_assoc($re);
    $d['id']=$d['id'];
    if (strlen($d['id'])<7) {
        while (strlen($d['id'])<=6) {
              $d['id']="\r".$d['id'];
              }
        }
    $x=str_split($d['id'],1);
    $j[1]=$bchar[$x[0]];
    $j[2]=$bchar[$x[1]];
    $j[3]=$bchar[$x[2]];
    $j[4]=$bchar[$x[3]];
    $j[5]=$bchar[$x[4]];
    $j[6]=$bchar[$x[5]];
    $j[7]=$bchar[$x[6]];
    } else {
    $j[1]=0;
    $j[2]=0;
    $j[3]=0;
    $j[4]=0;
    $j[5]=0;
    $j[6]=0;
    $j[7]=0;
    }
unset($bchar);
$m=0;
$l=0;
$p=true;
$passgo=0;
$sleeper=0;
for ($i[1]=$j[1];$i[1]<15;$i[1]++) { //16.0655625GB Database
    for ($i[2]=$j[2];isset($char[$i[2]]);$i[2]++) {
        for ($i[3]=$j[3];isset($char[$i[3]]);$i[3]++) {
            for ($i[4]=$j[4];isset($char[$i[4]]);$i[4]++) {
                for ($i[5]=$j[5];isset($char[$i[5]]);$i[5]++) {
                    for ($i[6]=$j[6];isset($char[$i[6]]);$i[6]++) {
                        $m+=$l;
                        $l=0;
                        for ($i[7]=$j[7];isset($char[$i[7]]);$i[7]++) {
                            if ((!empty($i[6]) && empty($i[7])) ||  (!empty($i[5]) && (empty($i[6]) || empty($i[7]))) ||  (!empty($i[4]) && (empty($i[5]) || empty($i[6]) || empty($i[7]))) ||  (!empty($i[3]) && (empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7]))) ||  (!empty($i[2]) && (empty($i[3]) || empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7]))) ||  (!empty($i[1]) && (empty($i[2]) || empty($i[3]) || empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7])))) {
                            echo $char[$i[1]].$char[$i[2]].$char[$i[3]].$char[$i[4]].$char[$i[5]].$char[$i[6]].$char[$i[7]].'<br>';
                            } else {
                            $v=$char[$i[1]].$char[$i[2]].$char[$i[3]].$char[$i[4]].$char[$i[5]].$char[$i[6]].$char[$i[7]];
                            $z=hash('sha1',$v);
                            $hash=mysql_real_escape_string(substr($z,0,4).hash('crc32',$z).hash('crc32b',$z));
                            $s=mysql_real_escape_string($v);
                            $r=mysql_query('SELECT `id` FROM `hash` WHERE `id`=compress("'.$s.'") AND `sha1`=compress("'.$hash.'")');
                            if (mysql_num_rows($r)==0 || $i[7]==' ') {
                                mysql_query('INSERT INTO `hash` SET `id`=compress("'.$s.'"), `crc32`=compress("'.mysql_real_escape_string(hash('crc32',$v)).'"), `crc32b`=compress("'.mysql_real_escape_string(hash('crc32b',$v)).'"), `sha1`=compress("'.$hash.'")');$l++;
                                }
                            $l++; if ($l==45){sleep(6);}
                            }
                            if(($l+$m)>140) {
                                $exits=true;
                                break; …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I just tested my code and turns out (I think) the mysql cache is calculated into the server load. So problem solved. Helps if you google these things for over an hour first. Now my server won't crash from server overload.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Ok, I found that the server load percentage is stored in /proc/loadavg but still need to find mysql's cache percentage. Also I'm not sure how often the /proc/loadavg file updates.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I'm not sure if this is possible but I'm kinda stuck in the middle. For my script I need to calculate the server load and the mysql cache usage both in percentage. Does anybody know of any scripts I can use for this. There are probably open source things that I'm not finding.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It works!
Even though it requires twice as much space on the mysql cache it works perfectly. Thanks for that very usefull code that I could not find anywhere else.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

SELECT uncompress(test) as test FROM `table` WHERE `compressed` = compress('test')

Wow, if that works that will be brillient. I will try it out.

And the confusion you may have had before about the bz library also known as bzip2 or bz2 depend on what version (I found out the hard way) that was another option I was exploring untill I found out it couldn't compress crc32 hashes. So as I said, if that above code works, that will be the solution to all my endless reverse hashing storage problems.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I just tried varbinary like before and again varbinary didn't work however I tried blob which I have never heard of before and it worked! Also the bz library works but won't decompress. So using the method you have described how can I decompress the result?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I think I may have found something with the bzip2/bz2 library because the gz library didn't compress very well. I will try storing the bzcompress() result in a binary column. Well let you know how my result goes.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have tried running the following mysql queries through the phpmyadmin command console (mysql_query() code) but I seem to be unable to retrieve the value. Here is my code.

INSERT INTO `table` SET `column`=COMPRESS("abcd")
SELECT * FROM `table` WHERE UNCOMPRESS(`column`)="abcd"

Also tried

INSERT INTO `table` SET `column`=COMPRESS("abcd")
SELECT * FROM `table` WHERE `column`=COMPRESS("abcd")

Please advice on how I should use the select query.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I am looking for a compression mechonism that can compress text (just letters and numbers) into binary or all weird symbols. Does anybody know of any good php/mysql codes as I can't get any to work.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

CSCGAL is daniweb - if she says okay, mods say okay.

I didn't realise that Cscgal was the one in charge of daniweb. Thanks for that information and the green light it is.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try this:

<?
$string="I should go to doctor tomrrow 5:42 pm.";
//set variable above
//don't change below.

preg_match_all('/^(.*|)([0-9]+\:[0-9]+([^a-zA-Z]+|)[a-zA-Z][a-zA-Z])([^a-zA-Z].*|)$/',$string,$time);
$time=str_replace($time[3][0],'',$time[2][0]);
$time=strtolower($time);
$var=explode(':',$time);
if (substr_count($var[1],'pm')) {
$var[1]=str_replace(array('pm','am'),'',$var[1]);
$var[0]+=12;
} else {
$var[1]=str_replace(array('pm','am'),'',$var[1]);
}


echo date('d-m-Y h:ia', strtotime('tomorrow '.$var[0].':'.$var[1].':00') ) ;
?>

Also as for how the array works, basically the first number in the array for preg_match_all displays what number bracket starting from the beginning it should display (starting from 1). Also then second number which I kept zero is what number match to display. Hope that helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Any answer mods?