Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - astor7

Pages: [1]
1
Beginners - Learning PHP /
« on: August 30, 2007, 10:03:43 PM »
Danke :)


Seid bereit immer bereit

2
Beginners - Learning PHP / Change Font Size
« on: August 30, 2007, 09:37:08 PM »
Here is a code being used for verification.. I want to make the font size a little bigger so it's easier to read.  Any help?

PHP Code: [Select]

<?php



require_once("configapply.php");

error_reporting(E_ALL );

function 
Get_Text()

{

global 
$text_length;

	
$letters =  array("a","A","b","B","c","C","d","D","e","E","f","F","g","G",

"h","H","i","I","j","J","k",

"K","l","L","m","M","n","N","o","O","p","P","q","Q","r",

"R","s","S","t","T","u","U","v",

"V","w","W","x","X","y","Y","z","Z","1","2","3","4","5",

"6","7","8","9");

mt_srand((double)microtime()*1000000);

 
$txt "";

 
//$rand_keys = array_rand($letters, $text_length);

 //foreach($rand_keys as $key)

// {

 // $txt .= $letters[$key];

// }

shuffle($letters);

for(
$i=0;$i<$text_length;$i++)

{

  
$key rand(0,count($letters)-1);

  
$txt .= $letters[$key];
	


}

return 
$txt;

}



function 
create_image()

{

    global 
$width,$hight,$text_length,$border;

    
$im imagecreate($width,$hight);

    
$bgc imagecolorallocate($imrand(235,255), rand(235,255),rand(235,255));

    
$tc  imagecolorallocate($im000);

    
imagefill($im,0,0,$tc);

    
imagefilledrectangle($im,$border,$border,$width-$border,$hight-$border,$bgc);

    return 
$im;



}



function 
draw_string($txt,$im)

{

   global 
$hight,$width,$font,$text_length;

   
$space1 $width/($text_length+1);   //space between characters

   
$space2 = ($width $space1)/3  ;   //space between lines

   
$center $hight/2;





   for(
$f=0;$f<3;$f++)

   {

   
	
$y1 =  $center/2;

  
	
$y2 =  1.5*$center;

  
	
$x1 = ($space1/2) + ($f $space2);

  
	
$x2 = ($space1/2) + (($f +1) * $space2);

  
	
// echo "$x1,$x2 + $y1,$y2 <br>";

     
for($k=0;$k<2;$k++)

	
  {

           
$lc =  imagecolorallocate($im,rand(0,200), rand(0,200), rand(0,200));

           
imageline($im,rand($x1,$x2),rand($y1,$y2),rand($x1,$x2),rand($y1,$y2),$lc);

      }

    }



	
for(
$i=0;$i<$text_length;$i++)

	
{

	
 
$txtc =  imagecolorallocate($im,rand(0,160), rand(0,160), rand(0,160));

	
 
$x = ($space1+($i*$space1)); //x  coordinate of each character

	
 

	
 
imagestring($im,$font,$x,rand($center-($center/2),$center),$txt[$i],$txtc);

	
}



}





?>

3
Beginners - Learning PHP /
« on: August 26, 2007, 08:32:43 PM »
So it's just this ?

PHP Code: [Select]

@$Features = ($_POST['Features']);

4
Beginners - Learning PHP / Check Box Arrays
« on: August 26, 2007, 08:57:06 AM »
Okay.. So I'm starting to go crazy because this is the only thing holding me back from launching the final product.

I have a "application" form that I've downloaded, and I got the jist of modifying it really quickly.

here is a scaled down Version of my config.php
Code: [Select]
<?php
@$Features addslashes&#40;$_POST['Features'&#93;&#41;;
require_once&#40;"check&#46;php"&#41;; 

if &#40;! ereg&#40;'[A-Za-z0-9_-&#93;+@[A-Za-z0-9_-&#93;+&#46;[A-Za-z0-9_-&#93;+', $email&#41;&#41;

&#123;

header&#40;"Location&#58; error&#46;html"&#41;;

exit;

&
#125;

$pfw_header "From&#58; $email";
$pfw_subject "Application Has Arrived";
$pfw_email_to "email@domain&#46;com";
$pfw_message "First Name&#58; $NameFirstn"

&#46; "Features&#58; $Featuresn"
&#46; "";
@mail&#40;$pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header &#41; ;
$pfw_header "From&#58; email@domain&#46;com";
$pfw_subject "Confirmation";
$pfw_email_to "$email";
$pfw_message "We have recieved your Application&#46;n"
@mail&#40;$pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header &#41; ;
header&#40;"Location&#58; thank-you&#46;html"&#41;;



?>


Pretty cut and Dry.  So now I'll explain what's going on.

On my index.html of this directory I have

Code: [Select]
<table width="100%" height="165"  border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="100%" valign="top">
  <tr>
      <td><form method="post" action="contact.php">
 
          <table width="540" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td></td>
            </tr>
<tr>
<td>
<font size="2">
Please Check all that apply:
</font>
<p>
<input type="checkbox" value="Dining Room" name="Features[]" >
                            <font face="Verdana" size="1">Dining Room</font>

<input type="checkbox" value="Family Room" name="Features[]" >
                            <font face="Verdana" size="1">Family Room&nbsp;&nbsp;</font>


<input type="checkbox" value="Living Room" name="Features[]" >
                            <font face="Verdana" size="1">Living Room&nbsp;&nbsp;</font>

<input type="checkbox" value="Bonus Room" name="Features[]" >
                            <font face="Verdana" size="1">Bonus Room&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>

<p>
<input type="checkbox" value="Fire Place" name="Features[]" >
                            <font face="Verdana" size="1">Fire Place&nbsp;&nbsp;&nbsp;&nbsp</font>
<input type="checkbox" value="Central Air" name="Features[]" >
                            <font face="Verdana" size="1">Central Air &nbsp;&nbsp;&nbsp;&nbsp;</font>
<input type="checkbox" value="Deck" name="Features[]" >
                            <font face="Verdana" size="1">Deck&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
<input type="checkbox" value="Above Ground Pool" name="Features[]" >
                            <font face="Verdana" size="1">Above Ground Pool</font>


<p>

<input type="checkbox" value="Great Room" name="Features[]" >
                            <font face="Verdana" size="1">Great Room&nbsp;</font>
<input type="checkbox" value="In Ground Pool" name="Features[]" >
                            <font face="Verdana" size="1">In Ground Pool</font>
<input type="checkbox" value="Screened Patio" name="Features[]" >
                            <font face="Verdana" size="1">Screened Patio</font>
<input type="checkbox" value="Screened Pool Enclosure" name="Features[]" >
                            <font face="Verdana" size="1">Screened Pool Enclosure</font>
<p>
<input type="checkbox" value="Fence" name="Features[]" >
                            <font face="Verdana" size="1">Fence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
<input type="checkbox" value="Central Heat" name="Features[]" >
                            <font face="Verdana" size="1">Central Heat</font>


</tr>


Now, when I send any information like a Radio Button, or just a text box

The E-mail Sends the information correctly.  So i added the check boxes in and put them in the same way. I was only getting 1 of the several that I checked to show up..So i used our good friend Google and found out they had to be in an array.  So I added the [] at the end of the name.   When I go to my config .php and have . "Features: $Features[0] $Features[1] $Features[2] $Features[3] $Features[4]n" instead of just $Features It just spells "A r r a y" to me in the e-mail.  I'm going nuts here, and I just can't figure this out.  If anyone can tell me how to make my checkbox array work I would really appreciate it.

Thanks

astor7

Pages: [1]