[PHP] problem with imagecreate on new webserver

2006-12-16 Thread macha
i am moving my webserver from a windows box to a linux box with php ver
5.2.0 and noticed i am having a problem with a php file(code below). i
thought it was a module i was missing but looking at the php config
file all the same modules are loaded. allow_url_fopen is enabled. what
would i be missing in the php install that would make this code not
work correctly from one machine to the other.

when loading on the new box all i get is a image with
'http://localhost/imgfile.php'

?
session_start();
define( 'SITE' , 'http://localhost' );

//define 7char code
$md5 = md5(microtime() * mktime());
$string = substr($md5,0,7);

//create image
header(Content-type: image/png);
$img= imagecreatefrompng(SITE. '/images/img.png');
$white = imagecolorallocate($img, 233, 239, 239);
$line = imagecolorallocate($img,233,239,239);

for ($i = 1; $i = 5; $i++) {
$x1 = rand(1,149);
$x2 = rand(1,149);
$y1 = rand(1,49);
$y2 = rand(1,49);

imageline($img, $x1, $y1, $x2, $y2, $line);
}

//put code in image
imagestring($img, 5, 35, 25, $string, $white);

//save key to session
$_SESSION['key'] = md5($string);
imagepng($img);
?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] learning classes not sure how to do this correctly

2006-12-14 Thread macha
just starting to get used to classes, trying to figure out what i am
doing wrong, i know its going to be something stupid on my part,
probably really shouldn't be using a if statement or something heh

just doing a basic email verification to make sure its looks like email
addy

so i take the post to a var

PHP Code:
$email_address = $_POST['email_address'];


run it through this function in my class

PHP Code:
function check_email($address){
if (ereg('[EMAIL PROTECTED]',
$address))
return true;
else
return false;
}


and then if true i want it to continue on with the script or error out
and quit back to the other page and display the error. so i have tried
something like this and stuff similar but get a error
Fatal error: Call to a member function on a non-object in

PHP Code:
if (!$keclass-check_email($email_address)) {
$keclass-seterr(555);
include('test.php');
exit();
}

$keclass-seterr(000);
include('test.php');
exit();


the seterr is just a simple thing that takes the number and puts in a
session var for latter display...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] learning classes not sure how to do this correctly

2006-12-14 Thread Macha
I'm not sure if it matters or not, but this is happening on the page 
that you are sent to from hitting the submit button from the other 
page...test.php is a form that sends you to test2.php after hitting the 
submit button and its test2.php page that is having this issue with the 
$keclass.


with that on test2.php if i use var_dump($keclass) i get *'Notice*: 
Undefined variable: keclass' and *'Fatal error*: Call to a member 
function on a non-object' on any $keclass - function call witch makes 
since, but if i try to declare the class in test2.php with 
var_dump($keclass) i get object(keclass)(0) but i get *Fatal error*: 
Cannot redeclare class keclass. so i guess that information changes the 
question down to why is it saying that i am redeclaring $keclass when it 
hasnt been declared in that page before? is it something do to with 
test.php when u hit submit and being redirected to test2.php?


If this dosnt really make any sense let me know..i have been told 
serveal times in the past i dont really explain my self well hehe


Richard Lynch wrote:

var_dump($keclass);

It's not an object...


On Thu, December 14, 2006 9:16 am, [EMAIL PROTECTED] wrote:
  

just starting to get used to classes, trying to figure out what i am
doing wrong, i know its going to be something stupid on my part,
probably really shouldn't be using a if statement or something heh

just doing a basic email verification to make sure its looks like
email
addy

so i take the post to a var

PHP Code:
$email_address = $_POST['email_address'];


run it through this function in my class

PHP Code:
function check_email($address){
if
(ereg('[EMAIL PROTECTED]',
$address))
return true;
else
return false;
}


and then if true i want it to continue on with the script or error out
and quit back to the other page and display the error. so i have tried
something like this and stuff similar but get a error
Fatal error: Call to a member function on a non-object in

PHP Code:
if (!$keclass-check_email($email_address)) {
$keclass-seterr(555);
include('test.php');
exit();
}

$keclass-seterr(000);
include('test.php');
exit();


the seterr is just a simple thing that takes the number and puts in a
session var for latter display...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php