homepage Welcome to WebmasterWorld Guest from 54.196.63.93
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Error message from thisWipit
Scotty13



 
Msg#: 4445624 posted 9:21 pm on Apr 25, 2012 (gmt 0)

Trying to edit my profile image and I get this error message from thisWipit...

Notice: Undefined index: thisWipit in /home/*******/public_html/edit_res.php on line 76 (marked below) (I did the indent code - how it shows better)
Your session expired from inactivity. Please click here to refresh it..

<?php
// Start_session, check if user is logged in or not, and connect to the database all in one included file
include_once("scripts/checkuserlog.php");
?>
<?php
//////////////////////////////////////////////// Member log in double check ///////////////////////////////////////////////////
if (!isset($_SESSION['idx'])) {

$msgToUser = '<br /><br /><font color="#FF0000">Only ticked members can do that. Please click link below.</font><p><a href="makeareservation.php">Join here by Making A Reservation</a></p>';

include_once 'msgToUser.php';
exit();
} else if ($ckinOptions_id != $_SESSION['id']) {
$msgToUser = '<br /><br /><font color="#FF0000">Only ticked members can do that. Please click link below.</font><p><a href="makeareservation.php">Join here by Making A Reservation</a></p>';

include_once 'msgToUser.php';
exit();
}
//////////////////////////////////////////////// End Member log in double check ///////////////////////////////////////
$id = $ckinOptions_id; // Set the profile owner ID
// Now let's initialize vars to be printed to page in the HTML section so our script does not return errors
// they must be initialized in some server environments, not shown in video
$error_msg = "";
$errorMsg = "";
$success_msg = "";
$username = "";
$firstname = "";
$lastname = "";
$city = "";
$state_province = "";
$country = "";
$currentairline = "";
$previousairline = "";
$myfirstairline = "";
$bio_body = "";
$bio_body = "";
$workstatus = "";
$website = "";
$youtube = "";
$user_pic = "";
$private = "";
$cacheBuster = rand(9999999,99999999999); // Put appended to the image URL will help always show new when changed
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ------- IF WE ARE PARSING ANY DATA ------------------------------------------------------------------------------------------------------------
if (!isset($_POST['parse_var']))
{
$_POST['parse_var'] = "undefined";
}
if($_POST['parse_var'] == "undefined")
{
//Code to handle undefined exception
}

if ($_POST['parse_var'] == "pic"){
// If a file is posted with the form
if ( isset($_FILES['fileField']) && ! empty($_FILES['fileField']['tmp_name']) ) {
$maxfilesize = 2097152; // equal to 2 mb
if($_FILES['fileField']['size'] > $maxfilesize ) {

$error_msg = '<font color="#FF0000">ERROR: Your image was too large, please try again.</font>';
unlink($_FILES['fileField']['tmp_name']);

} else if (!preg_match("/\.(gif|jpg|png)$/i", $_FILES['fileField']['name'] ) ) {

$error_msg = '<font color="#FF0000">ERROR: Your image was not one of the accepted formats, please try again.</font>';
unlink($_FILES['fileField']['tmp_name']);

} else {
$newname = "image01.jpg";
$place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "tktedmembers/$id/".$newname);
}
}
}

//// W.I.P.I.T ///
LINE 76: $thisWipit = $_POST['thisWipit'];
$sessWipit = base64_decode($_SESSION['wipit']);
//
if (!isset($_SESSION['wipit']) || !isset($_SESSION['idx'])) {
echo 'Error: Your session expired from inactivity. Please <a href="index.php">click here to refresh it.</a>.';
exit();
}
//
if ($sessWipit != $thisWipit) {
echo 'Your session expired from inactivity. Please <a href="index.php">click here to refresh it.</a>.';
exit();
}
//
if ($thisWipit == "") {
echo 'Error: Missing Data... click back in your browser please.';
exit();
}


// ------- PARSING PICTURE UPLOAD ---------
if ($_POST['parse_var'] == "pic"){

// If a file is posted with the form
if ($_FILES['fileField']['tmp_name'] != "") {
$maxfilesize = 51200; // 51200 bytes equals 50kb
if($_FILES['fileField']['size'] > $maxfilesize ) {

$error_msg = '<font color="#FF0000">ERROR: Your image was too large, please try

again.</font>';
unlink($_FILES['fileField']['tmp_name']);

} else if (!preg_match("/\.(gif|jpg|png)$/i", $_FILES['fileField']['name'] ) ) {

$error_msg = '<font color="#FF0000">ERROR: Your image was not one of the accepted formats,

please try again.</font>';
unlink($_FILES['fileField']['tmp_name']);

} else {
$newname = "image01.jpg";
$place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "tktedmembers/$id/".$newname);
}
}
}
// ------- END PARSING PICTURE UPLOAD ---------

 

cffrost2

5+ Year Member



 
Msg#: 4445624 posted 2:46 pm on Apr 26, 2012 (gmt 0)

Hi. Usually this is caused by an undefined variable. In this case, seems the $thisWipit var is not being passed. Have you double checked and made sure the var value is available to be passed from it's source? I.E. is it residing in a hidden input and it's value is actually not empty before you post?
Also, may wanna change it to check for the existence of the var before trying to use it.

LINE 76: if(isset($_POST['thisWipit'] ? $_POST['thisWipit'] : '')
{
$thisWipit = $_POST['thisWipit'];
}
else
{
echo 'ERROR: thisWipit not set!';
}

Hope this helps

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved