|
Authenticate This!
Date: 11/23/05
(PHP Community) Keywords: no keywords
Okay... here's the problem.
I have a script that works fine unless I put in some password authentication. What's happening is that one of my functions is becoming "undefined" once I throw it into an if statement. In the cut below, you'll see where the authentication ends and the script begins. I have a feeling it has something to do with globals, but I'm not entirely sure. Anyone have any ideas?
include("../config.php"); include("../lib/template_class.php");
//Starting the session and using the information. session_start(); $session=session_id(); $username=$_SESSION['username']; $password=$_SESSION['password'];
//Calling the database for login/password information. $result = mysql_query("select * from users where username='$username' AND password='$password' limit 1"); $get_userinfo = @mysql_fetch_array($result);
//Applying DB results to variables. $username=$get_userinfo[username]; $password=$get_userinfo[password]; $uid = $get_userinfo[id];
//login null checks if($username=="" AND $password=="" OR $password==""){ $page = new Page('../template/login.php'); $page->replace_tags(array( 'scriptName' => "$scriptName", 'msg' => "Invalid login or password. Please try again.", 'footer' => '$footer')); $page->output();
session_destroy(); }else{
############################################################################## # # # This is the end of the authorizing checks. # # # # The user is logged in properly and will now access the page's content. # # # ##############################################################################
ini_set("memory_limit", "25M"); $IMG_ORG_HEIGHT="400"; $IMG_ORG_WIDTH="400"; $IMG_HEIGHT="100"; $IMG_WIDTH="100"; $IMG_ROOT="./images"; $use_imagecreatetruecolor=true; $use_imagecopyresampled=true; $JPG_QUALITY=50;
if( ! $HTTP_POST_FILES ["image"]["tmp_name"] || $HTTP_POST_FILES ["image"]["tmp_name"] =="none")die("Error Uploading Image");
if($dontResizeMyImage == "1"){
if( ! $f_org = noresizer_main("image","",$IMG_ORG_WIDTH,$IMG_ORG_HEIGHT))die(" No Image Received! "); if( ! $f_res = resizer_main("image","res_",$IMG_WIDTH,$IMG_HEIGHT))die(" Could Not Resize! ");
$sz_org=getimagesize( "$IMG_ROOT/$f_org" ); $sz_res=getimagesize( "$IMG_ROOT/$f_res" ); $fs_org=filesize( "$IMG_ROOT/$f_org" ); $fs_res=filesize( "$IMG_ROOT/$f_res" );
}else{
if( ! $f_org = resizer_main("image","",$IMG_ORG_WIDTH,$IMG_ORG_HEIGHT))die(" No Image Received! "); if( ! $f_res = resizer_main("image","res_",$IMG_WIDTH,$IMG_HEIGHT))die(" Could Not Resize! ");
$sz_org=getimagesize( "$IMG_ROOT/$f_org" ); $sz_res=getimagesize( "$IMG_ROOT/$f_res" ); $fs_org=filesize( "$IMG_ROOT/$f_org" ); $fs_res=filesize( "$IMG_ROOT/$f_res" );
}
echo "
";
//include('../footer.php');
$dateadded = time(); $user_id = $myclass->member['id']; include ("../config.php"); mysql_query("INSERT INTO images (id, thumbnail_url, album_id, user_id, dateadded, fullsize_url) VALUES (NULL, '$f_res', '$aid', '$uid', '$dateadded', '$f_org')");
echo " |