cereal 1,524 Nearly a Senior Poster Featured Poster

Default case in switch() can't be blank, so or you remove it or you assign an action.

cereal 1,524 Nearly a Senior Poster Featured Poster

Check inside IE/front-page.php or post that code. The error is there.

cereal 1,524 Nearly a Senior Poster Featured Poster

You can use get_browser(): http://php.net/manual/en/function.get-browser.php
But the client can spoof the user agent, so don't trust what you get and always sanitize the data, because an XSS attack can be performed.

cereal 1,524 Nearly a Senior Poster Featured Poster

Fine, mark the thread as solved, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

is this correct. My image is not loading on right. A red cross(X) sign is coming.

$imagepath = "shirt7.jpg"; # check this!

Then check the path. Is your image in the same directory of your script file?


oops! Hi Ardav ;D

cereal 1,524 Nearly a Senior Poster Featured Poster

Basically you can add style="float:right;" to img tag. This thread is related more to CSS forum than PHP, I suggest you to move it, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

It seems you need to change the setting for maxRequestLength attribute which is found both in Machine.config and Web.config, this last file should be site specific, anyway check these links:

- http://masstechnical.com/Blog/tabid/100/EntryId/7/IIS-7-5-Setting-for-File-Upload-Size.aspx
- http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits
- http://support.microsoft.com/default.aspx?scid=kb;EN-US;295626

or just search on google for "IIS 7.5 upload file size limits", I can't help more than this, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

How much large are these files? IIS limits uploads to 30MB by default and maximum upload should be around 2GB.

cereal 1,524 Nearly a Senior Poster Featured Poster

If you are referring to the e-commerce platform then look at system requirements:

- http://www.magentocommerce.com/system-requirements

it works only on linux. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

From: http://php.net/manual/en/function.create-function.php

Usually these parameters will be passed as single quote delimited strings. The reason for using single quoted strings, is to protect the variable names from parsing, otherwise, if you use double quotes there will be a need to escape the variable names, e.g. \$avar.

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Just an update on function start() this will speed up the execution and use less memory:

public function start($arrayA,$arrayB)
    {
        global $a;
        global $b;
        global $c;
        
        $replace = array(',',' ','','-');
        $a = str_split(str_replace($replace,'',$arrayA));
        
        if(empty($arrayB))
        {
            $bArr = false;
            $b = array();
        } else {
            $bArr = true;
            $b = str_split(str_replace($replace,'',$arrayB));
        }
        
        $c = ($bArr == false) ? $a : array_merge($a,$b);
        
        if(count($c) > 5)
        {
            return 'too long';
        }
        elseif(count($c) <= 1)
        {
            return 'too short';
        }
        else
        {
            $size = count($c)-1;
            $perm = range(0, $size);
            $j = 0;

            do
            {
                foreach ($perm as $i) { $perms[$j][] = $c[$i]; }
            }
            while($perm = $this->p($perm, $size) and ++$j);
            
            $list = array_map('join',$perms);
            $list = array_unique($list);
            $list = array_merge(array(),$list);
            $list = array_unique($this->ps($list));
            $result = array_merge(array(),$list);
            
            return $result;
        }
    }

The permutation function p() creates a lot of duplicates, so using $list = array_unique($list); helps to reduce data sent to function ps(). Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

So if you set rde you want to get only:

Array
(
    [0] => red
    [1] => dre
    [2] => de
    [4] => re
    [9] => ed
    [12] => der
    [21] => er
)

Am I right? If yes maybe we got it, now there is a function at the end, that will check only for words containing set letters:

<?php
Class Perm
{
    
    public function start($arrayA,$arrayB)
    {
        global $a;
        global $b;
        global $c;
        
        $replace = array(',',' ','','-');
        $a = str_split(str_replace($replace,'',$arrayA));
        
        if(empty($arrayB))
        {
            $bArr = false;
            $b = array();
        } else {
            $bArr = true;
            $b = str_split(str_replace($replace,'',$arrayB));
        }
        
        $c = ($bArr == false) ? $a : array_merge($a,$b);
        
        if(count($c) > 5)
        {
            return 'too long';
        }
        elseif(count($c) <= 1)
        {
            return 'too short';
        }
        else
        {
            $size = count($c)-1;
            $perm = range(0, $size);
            $j = 0;

            do {
                 foreach ($perm as $i) { $perms[$j][] = $c[$i]; }
            } while ($perm = $this->p($perm, $size) and ++$j);

            $list = array();
            foreach ($perms as $p) {
                $list[] = join('', $p);
            }
            
            return array_unique($this->ps($list));
        }
    }
    
    # generate permutations
    private function p($p, $size) {
        for ($i = $size-1; @$p[$i] >= $p[$i+1]; --$i) { }
        if ($i == -1) { return false; }
        for ($j = $size; $p[$j] <= $p[$i]; --$j) { }

        $tmp = $p[$i];
        $p[$i] = $p[$j];
        $p[$j] = $tmp;

        for (++$i, $j = $size; $i < $j; ++$i, --$j) {
             $tmp = $p[$i];
             $p[$i] = $p[$j];
             $p[$j] = $tmp;
        }

        return $p;
    }

    # count and compare values between array a and …
cereal 1,524 Nearly a Senior Poster Featured Poster

Update class function ps() with this:

private function ps($list)
    {
        global $a;
        global $b;
        $n = count($list);
        $pspell_config = pspell_config_create("en");
        
        # Available flags:
        #
        # PSPELL_FAST
        # PSPELL_NORMAL
        # PSPELL_BAD_SPELLERS # this will slow down the script
        #
        pspell_config_mode($pspell_config, PSPELL_BAD_SPELLERS);
        $pspell_link = pspell_new_config($pspell_config);
        $z = array();
        for($i = 0; $i < $n; $i++)
        {
            $suggestions = pspell_suggest($pspell_link, $list[$i]);
            foreach ($suggestions as $suggestion)
            {
                if(strlen($suggestion) > 1)
                {
                    $s = strtolower($suggestion);
                    $this->d($s,$a);
                    $this->e($s,$b);
                      
                    if($this->c($s,$a) == true && ctype_alpha($s))
                    {
                        $z[] = $s;
                    }
                }
                    
            }        
        }
        return $z;
    }

You can increase results by setting flags in pspell config as explained here: http://www.php.net/manual/en/function.pspell-config-mode.php
If it still doesn't match, please provide an example. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Wait, one problem at a time.
An update on the class:

<?php
Class Perm
{

    public function start($arrayA,$arrayB)
    {
        global $a;
        global $b;
        
        $replace = array(',',' ','','-');
        $a = str_split(str_replace($replace,'',$arrayA));
        
        if(empty($arrayB))
        {
            $bArr = false;
            $b = array();
        } else {
            $bArr = true;
            $b = str_split(str_replace($replace,'',$arrayB));
        }
        
        $c = ($bArr == false) ? $a : array_merge($a,$b);
        
        if(count($c) > 5)
        {
            return 'too long';
        }
        else
        {
            $size = count($c)-1;
            $perm = range(0, $size);
            $j = 0;

            do {
                 foreach ($perm as $i) { $perms[$j][] = $c[$i]; }
            } while ($perm = $this->p($perm, $size) and ++$j);

            $list = array();
            foreach ($perms as $p) {
                $list[] = join('', $p);
            }
            
            return array_unique($this->ps($list));
        }
    }
    
    # generate permutations
    private function p($p, $size) {
        for ($i = $size-1; @$p[$i] >= $p[$i+1]; --$i) { }
        if ($i == -1) { return false; }
        for ($j = $size; $p[$j] <= $p[$i]; --$j) { }

        $tmp = $p[$i];
        $p[$i] = $p[$j];
        $p[$j] = $tmp;

        for (++$i, $j = $size; $i < $j; ++$i, --$j) {
             $tmp = $p[$i];
             $p[$i] = $p[$j];
             $p[$j] = $tmp;
        }

        return $p;
    }

    # count and compare values between array a and word 
    private function d($word, $array)
    {
	    global $d;
	    $u = array_unique($array);
	    $w = str_split($word);
     
	    $u2 = array_intersect($u,$w);
	    $a1 = array_count_values($array);
	    $w1 = array_count_values($w);
	    $a = array();
	    foreach($u2 as $k => $v)
	    {
        	$a[] = ($a1[$v] >= $w1[$v]) ? true:false;
	    }
     
	    $d = in_array(false,$a) ? false:true;
	    return $d;
    }
     
    # check array b
    private function e($word,$barray)
    {    
	    global $e; …
cereal 1,524 Nearly a Senior Poster Featured Poster

Just an add, on line 178 of the class you can change the conditional statement to:

if($this->c($s,$a) == true && ctype_alpha($s))

this will remove results like root's, odor's and the others.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, I changed permutation function, it's taken always from that article: http://docstore.mik.ua/orelly/webprog/pcook/ch04_26.htm
Previously it was hard to return the output from the function, now I created a class:

<?php
# filename perm.class.php
Class Perm
{

    public function start($arrayA,$arrayB)
    {
        $c = array_merge($arrayA,$arrayB);
    
        if(count($c) > 5)
        {
            return 'too long';
        }
        else
        {
            $size = count($c)-1;
            $perm = range(0, $size);
            $j = 0;

            do {
                 foreach ($perm as $i) { $perms[$j][] = $c[$i]; }
            } while ($perm = $this->p($perm, $size) and ++$j);

            $list = array();
            foreach ($perms as $p) {
                $list[] = join('', $p);
            }
            
            return array_unique($this->ps($list));
        }
    }
    
    # generate permutations
    private function p($p, $size) {
        for ($i = $size-1; @$p[$i] >= $p[$i+1]; --$i) { }
        if ($i == -1) { return false; }
        for ($j = $size; $p[$j] <= $p[$i]; --$j) { }

        $tmp = $p[$i];
        $p[$i] = $p[$j];
        $p[$j] = $tmp;

        for (++$i, $j = $size; $i < $j; ++$i, --$j) {
             $tmp = $p[$i];
             $p[$i] = $p[$j];
             $p[$j] = $tmp;
        }

        return $p;
    }

    # count and compare values between array a and word 
    private function d($word, $array)
    {
	    global $d;
	    $u = array_unique($array);
	    $w = str_split($word);
     
	    $u2 = array_intersect($u,$w);
	    $a1 = array_count_values($array);
	    $w1 = array_count_values($w);
	    $a = array();
	    foreach($u2 as $k => $v)
	    {
        	$a[] = ($a1[$v] >= $w1[$v]) ? true:false;
	    }
     
	    $d = in_array(false,$a) ? false:true;
	    return $d;
    }
     
    # check array b
    private function e($word,$barray)
    {    
	    global $e;
	    $r = array();
	    $n = str_split($word);
	    $bn = 0;
	    if(count($barray) != 0 && …
cereal 1,524 Nearly a Senior Poster Featured Poster

This works without errors, unless input is too long and the execution time goes over 30 seconds, at that point PHP will stop the script and return part of the output and an error. For this reason I added a length check at the end of the script, otherwise you have to increase max_execution_time.

<?php

if(empty($_POST['yl']))
{
    echo "<form action='index.php' method='POST'>
    Your Letters: <input type='text' name='yl' value='oor'>
    Board Letters: <input type='text' name='bl' value='dt'>
    <input type='submit'></form>";
}
else
{
    $replace = array(',',' ','','-');
    $a = str_split(str_replace($replace,'',$_POST['yl']));
    $b = str_split(str_replace($replace,'',$_POST['bl']));

    # removable
    echo '<h5>input</h5><pre>';
    print_r($a);
    print_r($b);
    echo '</pre>';

    function pc_permute($items, $perms = array( )) {

        global $a;
        global $b;
        global $d;
        global $e;
        
        if (empty($items)) {
            $w = join('', $perms);
	        $pspell_link = pspell_new("en"); # set language

	        $suggestions = pspell_suggest($pspell_link, $w);
	        $z = array();
                foreach ($suggestions as $suggestion)
                {
                    $s = strtolower($suggestion);
                    d($s,$a);
                    e($s,$b);
                    
                    if(c($s,$a) == "true")
                    {
                        $z[] = $s;
                    }
                    
                }
                $z2 = array_unique($z);
                foreach($z2 as $wrd)
                {
                    echo $wrd . "<br />";
                }
                echo '<hr />';
     
        }  else {
            for ($i = count($items) - 1; $i >= 0; --$i) {
	         usleep(2000); # slow down for CPU
                 $newitems = $items;
                 $newperms = $perms;
                 list($foo) = array_splice($newitems, $i, 1);
                 array_unshift($newperms, $foo);
                 pc_permute($newitems, $newperms); # recursive loop
             }
        }

    }

    # count and compare values between array a and word 
    function d($word, $array)
    {
	    global $d;
	    $u = array_unique($array);
	    $w = str_split($word);
     
	    $u2 = array_intersect($u,$w);
	    $a1 = array_count_values($array);
	    $w1 = array_count_values($w);
	    $a = array();
	    foreach($u2 as $k => $v)
	    {
        	$a[] = ($a1[$v] …
cereal 1,524 Nearly a Senior Poster Featured Poster

Try it and let me know, I've tried to match your examples..

<?php

# count and compare values between array a and word 
function d($word, $array)
{
	global $d;
	$u = array_unique($array);
	$w = str_split($word);
	
	$u2 = array_intersect($u,$w);
	$a1 = array_count_values($array);
	$w1 = array_count_values($w);
	$a = array();
	foreach($u2 as $k => $v)
	{
    	$a[] = ($a1[$v] >= $w1[$v]) ? true:false;
	}

	$d = in_array(false,$a) ? false:true;
	return $d;
}

# check array b
function e($word,$barray)
{    
	global $e;
	$r = array();
	$n = str_split($word);
	$bn = 0;
	if(count($barray) != 0 && is_array($barray))
	{
		for($i = 0; $i < count($n); $i++)
		{
			if(in_array($n[$i],$barray))
			{
				if($bn == 0)
				{
					$bn++;
					$r[] = 1;
				}
				else
				{
					$bn++;
					$r[] = 2;
				}
			}
			else
			{
				$r[] = 3;
			}
		}
	}
	elseif(count($barray) == 0 && is_array($barray))
	{
	    $r[] = 1;
	}
	else
	{
	    $r[] = 0;
	}
	
	# codes:
	# 0 no array
	# 1 array yes, letter matched or empty array
	# 2 array yes, more than one letter matched
	# 3 array yes, no letter
	
	$e = (in_array(1,$r) == true && in_array(2,$r) == false) ? true:false;
	return $e;
}

# check array a
function c($word,$array)
{
	global $d;
	global $e;
	$n = str_split($word);
	$r = array();
	for($i = 0; $i < count($n); $i++)
	{
		if(in_array($n[$i],$array))
		{
			$r[] = true;
		}
		elseif($e == true)
		{
		    $r[] = true;
		}
		else
		{
			$r[] = false;
		}		
	}
	
	$res = array();
	$res[] = $d;
	$res[] = $e;
	$res[] = in_array(false,$r) ? false:true;
	return in_array(false,$res) …
cereal 1,524 Nearly a Senior Poster Featured Poster

You're welcome, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

I'm sorry, now it should work like you want:

<?php
$a = array('e','x','t','d','a');
$b = array('r','g','n');
$word = 'extra'; # try "gextra" for example, because of g and r it will give false

function c($word,$array,$barray)
{
	$n = strlen($word);
	$r = array();
	$bn = 0;
	for($i = 0; $i < $n; $i++)
	{
		if(in_array($word[$i],$array))
		{
			$r[$i] = true;
		}
		else
		{
			$r[$i] = false;
		}

		if(in_array($word[$i],$barray))
		{
			if($bn == 0)
			{
				$bn = 1;
				$r[$i] = true;
			}
			else
			{
				$r[$i] = false;
			}
		}
	}

	return (in_array(null,$r)) ? false:true;
}

echo $word .': '. c($word,$a,$b) . "\n";
echo "\n";
?>

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

No problem:

<?php
if(isset($_POST['email'])) {
     

    $email_to = "talent@itarep.com";     
     
    function died($error) {
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }

	  if ($_FILES["picture"]["error"] > 0)
	    {
	    //echo "Return Code: " . $_FILES["picture"]["error"] . "<br />";
	    }
	    else
	      {
	      move_uploaded_file($_FILES["picture"]["tmp_name"],
	      "pictures/" . $_FILES["picture"]["name"]);
	      $picture_url = "http://www.itarep.com/" . "pictures/" . urlencode($_FILES["picture"]["name"]);
	      }
	}
	else
	  {
	  //echo "Invalid file";
	  }

	
	 if ($_FILES["attachment"]["error"] > 0)
	    {
	    //echo "Return Code: " . $_FILES["picture"]["error"] . "<br />";
	    }
	   else
	      {
	      move_uploaded_file($_FILES["attachment"]["tmp_name"],
	      "attachments/" . $_FILES["attachment"]["name"]);
	      $attachment_url = "http://www.itarep.com/" . "attachments/" . urlencode($_FILES["attachment"]["name"]);
	      }

    $name = $_POST['name'];
    $email = $_POST['email'];
    $gender = $_POST['gender'];
    $dobM = $_POST['dobM']; 
    $dobD = $_POST['dobD']; 
    $dobY = $_POST['dobY']; 
    $dobM = $_POST['dobM']; 
    $phone = $_POST['phone']; 
    $location = $_POST['location']; 
    $school = $_POST['school']; 
    $facebook = $_POST['facebook']; 
    $twitter = $_POST['twitter']; 
    $talent = $_POST['talent']; 
    $past = $_POST['past']; 
     
    $email_subject = $name . " - " . $gender . " - " . $dobY . " - " . $talent;
    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }

    $email_message .= "Name: ".clean_string($name)."\n";
    $email_message .= "Email: ".clean_string($email)."\n";
    $email_message .= "Gender: ".clean_string($gender)."\n";
    $email_message .= "Date of Birth: ".clean_string($dobM)."/".clean_string($dobD)."/".clean_string($dobY)."\n";
    $email_message .= "Phone: ".clean_string($phone)."\n";
    $email_message .= "Location: ".clean_string($location)."\n";
    $email_message .= "University/High School: ".clean_string($school)."\n";
    $email_message .= "Facebook: ".clean_string($facebook)."\n";
    $email_message .= "Twitter: ".clean_string($twitter)."\n";
    $email_message .= "Talent: ".clean_string($talent)."\n";
    $email_message .= "Past work, Experiences, Expectations: ".clean_string($past)."\n";   
	$email_message .= "Picture: ".clean_string($picture_url)."\n"; …
cereal 1,524 Nearly a Senior Poster Featured Poster

With urlencode:

$attachment_url = "http://www.itarep.com/" . "attachments/" . urlencode($_FILES["attachment"]["name"]);
#output http://www.itarep.com/attachments/name%20file.pdf

With str_replace:

$attachment_url = "http://www.itarep.com/" . "attachments/" . str_replace(' ','_'$_FILES["attachment"]["name"]);
#output http://www.itarep.com/attachments/name_file.pdf

do the same for the images. If you replace spaces with underscore, remember also to rename the uploaded files. you can use mv() function. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

That's normal, use http://php.net/manual/en/function.urlencode.php
Or replace the spaces with an underscore, you can use str_replace(), bye

cereal 1,524 Nearly a Senior Poster Featured Poster

Set global both sides:

function a()
{
        global $b;
        echo $b;
}

function c()
{
        global $b;
        $b = 'hello world';
        return $b;
}

c();
echo a();
cereal 1,524 Nearly a Senior Poster Featured Poster

Try this:

<?php

$a = array('test','text','ext','tex','deer'); # words to filter
$b = array('e','s','t','d','r'); # letters to check

function c($letter,$array)
{
        $n = strlen($letter);
        $r = array();
        for($i = 0; $i < $n; $i++)
        {
                if(in_array($letter[$i],$array))
                {
                        $r[] = true;
                }
                else
                {
                        $r[] = false;
                }
        }
        return (in_array(null,$r)) ? false:true;
}

foreach($a as $word)
{
        echo $word .': '. c($word,$b) . "\n";
}
?>

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Don't worry Ardav, you're not alone, I understood the same of you.. ;p

cereal 1,524 Nearly a Senior Poster Featured Poster

define $total outside the loop: $total = ''; bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

In addition search for "MySQL hardening" to enhance MySQL config and try RatProxy to test your application: http://code.google.com/p/ratproxy/

cereal 1,524 Nearly a Senior Poster Featured Poster

put $AE++ inside the loop.

cereal 1,524 Nearly a Senior Poster Featured Poster

The table name is "database"? check if your query is right. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

As Pritaeas suggested here is an example code for MySQL shell:

mysql> select password('test');
+-------------------------------------------+
| password('test')                          |
+-------------------------------------------+
| *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> create user 'dreamsin'@'localhost' identified by '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';

mysql> grant select, insert, update, delete, create, create view, drop, alter on db_name.* to dreamsin@localhost;

here you setup a single user for reading, inserting, creating tables inside a database, but if you can, create separated users: readonly (only select), application (select, insert, update, delete) and administration (previous privileges plus create, create view, drop and alter) it will be better.

+ http://dev.mysql.com/doc/refman/5.5/en/grant.html
+ http://dev.mysql.com/doc/refman/5.5/en/create-user.html

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

Remove the $ sign at lines 95 and 96:

$title = $row["searchtype"];
$price = $row["price"];

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

hehe :)
you're welcome, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

This article is a good start: http://devzone.zend.com/1254/getting-started-with-openid-and-php/

I did it once, for a project in which I adopted Janrain solution (most because I could not use the PEAR package): http://www.janrain.com/
This plugin remembers the user (even after logout) and when he comes back gives a suggestion.

In that project, users had the ability to create a standard account or to log with an available OpenID (Flickr, Twitter, Yahoo, Google, Windows Live and MySpace).

If that was first login from openID and there was no match with a standard accounts, then it was created a new account. Otherwise, the user was suggested to merge it with the matched account. Anyway, if the user had also a standard account he had the ability to merge the account.

A (requested) nightmare :S

Virtually, in that project, a user can login with many OpenIDs and link always to the same standard account.

To fully enable an account created with an OpenID, it was requested to complete the login inserting an email, usually from the OpenId service you get enough data but sometimes, as with Twitter, you don't get any email address. So, for this reason, it was requested.

Once you have an email and the user choose to login with Facebook and Twitter and Google and whatever else, when he completes with the same email you can merge the accounts..

I repeat: a requested nightmare :'(

Anyway, if you want …

diafol commented: great reply, as usual :) +14
cereal 1,524 Nearly a Senior Poster Featured Poster
<?php
$brush_price = 5;
$quantity = 10;
$total = $brush_price * $quantity;
echo "<table border=\"1\" align=\"center\">
<tr><td>Quantity</td><td>Price</td></tr>
<tr><td>$quantity</td><td>$total</td></tr>";
?>

Bye.

Farhad.idrees commented: 1 +3
cereal 1,524 Nearly a Senior Poster Featured Poster

Add a loop:

$Families = array ( "Farhad" =>array("Ali","Haider","Kashan"), "Sufyan" => array("Shahbaz","Ali2","Azaan"));
 
foreach($Families as $key2=>$values3)
{
        foreach($values3 as $v)
        {
            echo "$key2 $v";
        {
}

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

I think you need to use imagesavealpha(): http://php.net/manual/en/function.imagesavealpha.php
Place it just before imagepng(). Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Maybe I did not understand your question, can you paste the code?

cereal 1,524 Nearly a Senior Poster Featured Poster

You have to use switch() inside your index.php, an example:

<?php
$action = $_GET['action'];
switch($action) {
    case 'login':
    # code for login page
    break;
    case 'index':
    default:
    # code for home page
}
?>

http://php.net/manual/en/control-structures.switch.php

cereal 1,524 Nearly a Senior Poster Featured Poster

Why all those quotes? Rewrite your statements:

if($_POST['type_id'] == FALSE && $_POST['location_id'] > 0 && $_POST['bedroom_id'] > 0 && $_POST['price_id'] > 0)
manc1976 commented: Thanks for showing me a better way to write this code +1
cereal 1,524 Nearly a Senior Poster Featured Poster

Yes:

<input type="radio" name="button1" value="On" onClick="submit();" <?php echo ($_POST['button1'] == 'On') ? 'checked="checked"' : ''; ?> /> On
	<input type="radio" name="button1" value="Off" onClick="submit();" <?php echo ($_POST['button1'] == 'Off') ? 'checked="checked"' : ''; ?> /> Off

bye!

Xufyan commented: thanku xufyan +3
cereal 1,524 Nearly a Senior Poster Featured Poster

Set the same name attribute to both input:

<input type="radio" name="button1" value="on" /> on
<input type="radio" name="button1" value="off" /> off

And in PHP side check for $_POST value, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

So it seems, I've tried this and hello is not printed:

<?php
echo <<<HTML
test 1
<?php echo 'hello'; ?>
test 2
HTML;
?>
cereal 1,524 Nearly a Senior Poster Featured Poster

On last file try to move session_start(); at very top of the file. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

It seems ok but I don't see the form, so check if there is something different between field names and $_POST vars. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

profpic is the image name or the image itself? What kind of column is profpic: blob or varchar?

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Check these links: http://phpxmlrpc.sourceforge.net/doc-1.1/ch05s02.html & http://phpxmlrpc.sourceforge.net/doc-2/ch07s02.html (updated version)

The constructor takes the following form:

$msg=new xmlrpcmsg( $methodName,
$parameterArray);
$methodName;
$parameterArray;
Where methodName is a string indicating the name of the method you wish to invoke, and parameterArray is a simple Array of xmlrpcval objects.

where $methodName is 'execute' in your example. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

From substr() manual:

string substr ( string $string , int $start [, int $length ] )
If length is given and is 0, FALSE or NULL an empty string will be returned.

The problem is related to substr() on line 6, because strrpos() returns FALSE when there are no spaces:

$string = substr($string, 0, strrpos($string, ' '));

therefore you have substr('nospacestring',0,false) In order to solve change that line with this, which makes use of ctype_space():

if(ctype_space($string))
{
   $string = substr($string, 0, strrpos($string, ' '));
}

bye :)

dean8710 commented: tq dude +2
cereal 1,524 Nearly a Senior Poster Featured Poster

I made few tests. The first one is faster than the second, but still eats a lot of memory (~170MB in ~14 seconds):

<?php
$file = '20111212realtime_gen.csv';

$f = fopen($file, "r");
$ln= 0;

$nyc = array();
$millwood = array();
$hudvl = array();
$dunwood = array();


$arr = array('nyc' => array(23512,23513,23515,23516,23517,23518,23519,23520,23523,23524,23533,23534,23535,23538,23540,23541,23657,23660,23729,23770,23786,23810, 23816,23817,23820,24077,24078,24079,24080,24084,24094,24095,24096,24097,24098,24099,24100,24101,24102,24103,24104,24105,24106,24107, 24108,24110,24111,24112,24113,24114,24115,24116,24117,24118,24119,24120,24121,24122,24123,24124,24125,24126,24127,24128,24129,24130, 24131,24132,24133,24134,24135,24136,24137,24138,24149,24152,24155,24156,24157,24158,24159,24160,24161,24162,24163,24168,24195,24196, 24202,24225,24226,24227,24228,24229,24230,24231,24232,24233,24234,24235,24236,24237,24238,24239,24240,24241,24242,24243,24244,24245, 24246,24247,24248,24249,24250,24251,24252,24253,24254,24255,24256,24257,24258,24259,24260,24261,323558,323559,323566,323567,323568,323569,323581,323582,323595,323610,323651,323677,323678,923512,923533,923568,924077,924094,924106,924149,924156,924157,924158,924160,924162,924228),
'millwood' => array(23530,23531,23653,23659,23776,24019,24139,24193,24198,323649),
'hudv1' => array(23526,23586,23587,23588,23589,23590,23591,23592,23593,23595,23607,23608,23609,23610,23611,23612,23632,23639,23640,23641,23642,23654,23754,23765,23769,24000,24148,24192,323565,323602,323613,323627,323648,923586,923587),
'dunwood' => array(23655,24194,323650));

#while($line = fgets($f)) { # both give same results and similar performance
while($line = stream_get_line($f,10000,"\n")) {
    $ln++;
    $b = explode(',',$line);
    
    if(in_array($b[2],$arr['millwood']))
    {
        $millwood[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
    }
    
    elseif(in_array($b[2],$arr['hudv1']))
    {
        $hudv1[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
    }
    
    elseif(in_array($b[2],$arr['dunwood']))
    {
        $dunwood[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
    }
    
    else
    {
        $nyc[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
    }
    
    if($ln == 7500)
    {
        $ln = 0;
        usleep(500000);
    }
}
fclose($f);
echo "done\n";
echo memory_get_peak_usage(); # you can remove this
?>

Here I "split" the parsing sequence so the script can run using less memory, ~60MB in ~48seconds:

<?php
ini_set('memory_limit', '64M'); # you can remove this

function my_parser($f,$codes,$var)
{
    $array = array();
    $ln = 0;
    while($line = stream_get_line($f,10000,"\n")) {
        $ln++;
        $b = explode(',',$line);
        
        if(in_array($b[2],$codes[$var]))
        {
            $array[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
            #$array[$b[0]][$b[1]][$b[2]] = array($b[3],$b[4],$b[5]); # ~50MB instead of 70MB
        }
        
        if($ln == 7500)
        {
            $ln = 0;
            usleep(500000); # half second break each 7500 lines, be kind with CPU
        }
    }
    
    return $array;
}

$file = '20111212realtime_gen.csv';
$arr = array('nyc' => array(23512,23513,23515,23516,23517,23518,23519,23520,23523,23524,23533,23534,23535,23538,23540,23541,23657,23660,23729,23770,23786,23810, 23816,23817,23820,24077,24078,24079,24080,24084,24094,24095,24096,24097,24098,24099,24100,24101,24102,24103,24104,24105,24106,24107, 24108,24110,24111,24112,24113,24114,24115,24116,24117,24118,24119,24120,24121,24122,24123,24124,24125,24126,24127,24128,24129,24130, 24131,24132,24133,24134,24135,24136,24137,24138,24149,24152,24155,24156,24157,24158,24159,24160,24161,24162,24163,24168,24195,24196, 24202,24225,24226,24227,24228,24229,24230,24231,24232,24233,24234,24235,24236,24237,24238,24239,24240,24241,24242,24243,24244,24245, 24246,24247,24248,24249,24250,24251,24252,24253,24254,24255,24256,24257,24258,24259,24260,24261,323558,323559,323566,323567,323568,323569,323581,323582,323595,323610,323651,323677,323678,923512,923533,923568,924077,924094,924106,924149,924156,924157,924158,924160,924162,924228),
'millwood' => array(23530,23531,23653,23659,23776,24019,24139,24193,24198,323649),
'hudv1' => array(23526,23586,23587,23588,23589,23590,23591,23592,23593,23595,23607,23608,23609,23610,23611,23612,23632,23639,23640,23641,23642,23654,23754,23765,23769,24000,24148,24192,323565,323602,323613,323627,323648,923586,923587),
'dunwood' => array(23655,24194,323650)
);

$a = array('nyc','millwood','hudv1','dunwood');
foreach($a as $row)
{
    $f = fopen($file, "r");
    $varname = $row;
    $res = my_parser($f,$arr,${$varname} = …