Augury Posted February 22, 2014 Share Posted February 22, 2014 Are there any good call tracking functions provide in the php package? I saw the tick counter which was cool. I'm looking for more of a line item as it is executed sort of a tracer. Not that I suck, I just feel as though I've lost touch with coding. Quote Link to comment Share on other sites More sharing options...
.josh Posted February 22, 2014 Share Posted February 22, 2014 based on your posts i feel as though you've lost touch with a lot more than coding.. i feel like i'm watching a coked up ferret with adhd. Do you mean like debug_backtrace? Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 Its the precession I wanted but the events immediately prior to syntax confusion would help as well. ATM debug_backtrace just moves the error around in place a little. Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 (edited) OK if I have bracket enclosures like {{{}}{}}{{{}{}{{}}{{}} whats the game theory on finding the offending bracket? Is it possible? ...working under the assumption that that open lines will soon be closed. Unisex enclosures could be evading my text editors. Edited February 23, 2014 by Augury Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 Are there line length as by carriage return restrictions? Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 (edited) there is the error Parse error: syntax error, unexpected '$noob' (T_VARIABLE), expecting function (T_FUNCTION) in /var/www/CampKojak.com/ck/NoobMember1.php on line 279 this is the $noob who did not fulfill expectations. }///////CLASS END $noob = new NoobMember; $noob->PostData(); ?> Edited February 23, 2014 by Augury Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 with out the $noob stuff there Parse error: syntax error, unexpected '?>', expecting function (T_FUNCTION) in /var/www/CampKojak.com/ck/NoobMember1.php on line 283 I've got gedit and emacs. They do a good job of highlighting, I think emacs will even jump the page up briefly. Not seeing anything. Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 I hadn't edited anything at the bottom of the file, so, is there someway I could throw an exception when it trys to leave the class? bumping into ?> seems like it was elsewhere though. Quote Link to comment Share on other sites More sharing options...
.josh Posted February 23, 2014 Share Posted February 23, 2014 That error is a result trying to execute code within a class definition that's outside of a method. IOW you are basically doing this: class NoobMember { function __construct($data) { } function PostData() { echo "something"; } $noob = new NoobMember; // bad $noob->PostData(); // bad } IOW basically you have lost track of your opening/closing brackets and have put that code inside your class definition where it doesn't belong. Quote Link to comment Share on other sites More sharing options...
.josh Posted February 23, 2014 Share Posted February 23, 2014 with out the $noob stuff there Parse error: syntax error, unexpected '?>', expecting function (T_FUNCTION) in /var/www/CampKojak.com/ck/NoobMember1.php on line 283 I've got gedit and emacs. They do a good job of highlighting, I think emacs will even jump the page up briefly. Not seeing anything. And this further affirms that you've lost track of your opening/closing brackets. More specifically, you're missing a closing bracket somewhere Quote Link to comment Share on other sites More sharing options...
.josh Posted February 23, 2014 Share Posted February 23, 2014 There are plenty of IDEs and code editors out there that highlight opening/closing bracket pairs, as well as "fixes" or "beautifies" code (indenting properly) which makes it a lot easier to visually find out which one you are missing. Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 Where? <html> <body> <?php //html pages may need to reset 'submit' indexes! $email = $username = $password = $firstname = $lastname = $homephone = $address = $address2 = $city = $state = $zip = $cellphone = $submit = $Routed = ""; session_start(); class Member { public function __construct() { $member = array('id'=>'', 'usertype'=>'', 'username'=>'', 'email'=>'', 'pass'=>'', 'firstname'=>'', 'lastname'=>'', 'validation_code'=>'', 'address'=>'', 'city'=>'', 'state'=>'', 'zipcode'=>'', 'flag'=>''); //public $member = array_fill_keys($mymember, '') $member[2] = 'entryErr'; $member['username'][4] = $member['email'][4] = $member['firstname'][4] = $member['lastname'][4] = 'required'; } } class NoobMember extends Member { private $hasErr = NULL; private $postmember = NULL; private $member = NULL; private $logmein = NULL; function PostData() { $postmember = $_POST; $some = array(); $member = self::MemberDataCheck($postmember, $hasErr); $_SESSION['field'] = $member; $_SESSION['hasErr'] = $hasErr; var_dump($hasErr); var_dump($member); session_write_close(); echo '<br><br> heres session'; var_dump($_SESSION); if (empty($hasErr)) { self::MemberRouter($member['submit']); } else { self::MemberRouter("routeback"); } } function MemberDataCheck (&$member, &$hasErr) { echo 'member data check'; try { $atributestable = new PDO('snip'); } catch (Exception $e) { echo "Unable to connect: " . $e->getMessage() ."<p>"; } $sth = $atributestable->prepare("SELECT member_keys, required FROM AtributesT;"); $sth->execute(); $sth->bindColumn('member_keys', $memkey); $sth->bindColumn('required', $reqval); $req = array(); while ($row = $sth->fetch(PDO::FETCH_BOUND)) { $required[$memkey] = $reqval; } $sth = $atributestable->prepare("SELECT member_keys, errmessage FROM AtributesT;"); $sth->execute(); $sth->bindColumn('member_keys', $memkey); $sth->bindColumn('errmessage', $errval); $req = array(); while ($row = $sth->fetch(PDO::FETCH_BOUND)) { $errmessage[$memkey] = $errval; } $sth = $atributestable->prepare("SELECT member_keys, regxfilter FROM AtributesT;"); $sth->execute(); $sth->bindColumn('member_keys', $memkey); $sth->bindColumn('regxfilter', $regxval); $req = array(); while ($row = $sth->fetch(PDO::FETCH_BOUND)) { $regxfilter[$memkey] = $regxval; } $sth = $atributestable->prepare("SELECT member_keys, formsubmit FROM AtributesT;"); $sth->execute(); $sth->bindColumn('member_keys', $memkey); $sth->bindColumn('formsubmit', $fsv); $formsubmit = array(); while ($row = $sth->fetch(PDO::FETCH_BOUND)) { $formsubit[$memkey] = $fsv; } $some = array(); $hasError = self::BiancaData($member, $some); $member_keys = array_keys($member); foreach ($member_keys as $k) { if (empty($_POST[$k])) { if (!empty($required[$k])) { if ($required[$k] <> 'false' || $required[$k] == "not required" || $required[$k] == NULL) { $hasErr[$k] = "REQUIRED FEILD"; }} else { $hasErr[$k] = ""; $member[$k][0] ="";} } else { switch($k) { case $k === ('username' || 'firstname' || 'lastname'): if (!preg_match("/^[a-zA-Z \-]*$/",$_POST[$k])) { $hasErr[$k] = "may only contain letters, numbers, spaces and hyphen"; $_POST[$k] = ""; $member[$k] = ""; } else { $member[$k][0] = $_POST[$k];} break; case $k === 'email': if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$_POST[$k])) { $hasErr[$k] = "not a vaild e-mail address"; $_POST[$k] = ""; $member[$k] = ""; } else { $member[$k][0] = $_POST[$k];} break; default: if (!preg_match("/^[a-zA-Z 0-9\-]*$/",$_POST[$k])) { $hasErr[$k] = "may only contain letters, numbers, spaces and hyphen"; $_POST[$k] = ""; $member[$k] = ""; } else { $member[$k][0] = $_POST[$k];} break; } if (!empty($regxfilter[$k])) { if (!preg_match($regxfilter[$k],$_POST[$k])) { var_dump ($regxfilter[$k]); $hasErr[$k] = "may only contain letters, numbers, spaces and hyphen"; $_POST[$k] = ""; $member[$k] = ""; } else { $member[$k][0] = $_POST[$k];} } } } return $member; } function MemberRegister () { $Registernoob = ""; try { $MembersTable = new PDO('snip'); } catch (Exception $e) { echo "Unable to connect: " . $e->getMessage() ."<p>"; } $sth = $MembersTable->prepare("SELECT username, email FROM MemberT;"); $sth->execute(); $sth->bindColumn('username', $users); $sth->bindColumn('email', $em); $sth->bindColumn('password', $pass); while ($row = $sth->fetch(PDO::FETCH_BOUND)) { $username[$users] = $password; $email[$em] = $password; if ($_SESSION['field']['username']) { $registerme = FALSE; $_SESSION['hasErr']['username'] = 'SORRY, USER NAME IS TAKEN'; } else { $registerme = TRUE; } if ($_SESSION['field']['email']) { $registerme = FALSE; $_SESSION['hasErr']['email'] = 'SORRY, THIS EMAIL IS ALREADY REGISTERED -- get your password!'; } } return $Registernoob; } function MemberLogin () { $Logmein = ""; try { $MembersTable = new PDO('snip'); } catch (Exception $e) { echo "Unable to connect: " . $e->getMessage() ."<p>"; } $sth = $MembersTable->prepare("SELECT username, email FROM MemberT;"); $sth->execute(); $sth->bindColumn('username', $users); $sth->bindColumn('email', $em); $sth->bindColumn('password', $pass); while ($row = $sth->fetch(PDO::FETCH_BOUND)) { $username[$users] = $password; $email[$em] = $password; if (!empty($_SESSION['field']['username'])) { $Logmein = password_verify($_POST['password'], $username[$_SESSION[$username]]); } if (!empty($_SESSION['field']['email'])) { $Logmein = password_verify($_POST['password'], $username[$_SESSION[$username]]); } } //password nullify //disconnect db /* $noob = new NoobMember; if ($noob->MemberEntry($giveMember)) { MemberRoute($outAction); } else { MemberRoute('login', $Routed); if ($noob->MemberVerify()) { $noob->MemberLogin(); } else { echo 'denied service!!!'; } } */ return $Logmein; } function MemberRouter ($routeme, $hailPostData) { $Routed = ""; switch ($routeme) { case "routeback": $Routed = '$_SERVER["PHP_SELF"]'; break; case "login": if (($halePostData === 1) || (self::PostData())) { if (self::MemberLogin ()) { $_SESSION['AMember'] = array('loggedin' => 'true', RID => '', Username => $_SESSION['field']['username'], ipaddress => '', time => ''); //need site/server prob. self::MemberRouter('loggedin'); break; } else { self::MemberRouter("routeback"); $Routed = "loginFAILED -- possible miss 1 lo"; } } break; case "loggedin": if ($_SESSION['AMember']["loggedin"] == 'true') { if (!empty($hailPostData) && $hailPostData !== 1) { $Routed = $hailPostData; break; } else { $Routed = "CKmembers.php"; break; } } else { } break; case "register": if ($halePostData == 1 || self::PostData()) { self::MemberRegister (); $Routed = "login.php"; break; } return $Routed; $_SESSION['Routed'] = $Routed; } function MemberFormType ($FormTYPE, $giveMember, $outAction, &$whoMember) { switch ($FormTYPE) { //case login: //break; case register: $noob = new NoobMember; if ($noob->PostData()) { self::MemberRegister ($giveMember); echo "FUCK"; } else { echo "CONGRADULATIONS"; } break; } } function BiancaData ($mymember, $yourmember) { $themember = NULL; $mymember_keys = array_keys($mymember); $yourmember_values = array_values($yourmember); foreach ($mymember_keys as $i) { $themember = array ('$i' => '$yourmember_values[$i]'); } return $themember; } function BiancaDataDefault ($mymember, $yourmember) { $themember = NULL; $mymember_keys = array_keys($mymember); $yourmember_values = array_values($yourmember); for ($i = 0; $i <= count($mymember) - 1; $i++) { $themember[$mymember_keys[$i]] = $yourmember_values[$mymember_keys[$i]]; if (!$themember[$mymember_keys[$i]]) {$themember[$mymember_keys[$i]] = $mymember[$mymember_keys[$i]]; } return $themember; } } function MemberHTMLone () { $FLine[0] = array('Your e-mail Address', 'text', 'email'); $FLine[1] = array('Choose Your Login Name', 'text', 'login'); $FLine[2] = array('Your Site Password', 'text', 'password'); echo ' <table>'; echo ' <p><span class="error">* required field.</span></p>'; for ($m = 0; $m <= count($FLine) - 1; $m++) { echo '<tr><th>' , $FLine[$m][0] , '</th><th><input type="' , $FLine[$m][1] , '" name="' , $FLine[$m][2] , '" value="' , $member[$FLine[$m][2]] , '"></th><th><span class="error">' , $hasError[$FLine[$m][2]] , '</span><br></th></tr>'; } } }///////CLASS END $noob = new NoobMember; $noob->PostData(); ?> Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 As far as bringing my own text editor goes emacs doesn't do as much for this language. Disappointing. Quote Link to comment Share on other sites More sharing options...
.josh Posted February 23, 2014 Share Posted February 23, 2014 go through your code and properly indent it manually then. You'll find the missing bracket soon enough. Sorry, I'm not going to do that for you. That's one of the points of getting into the good habit of indenting your code! Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 I spelled "break" "brake" near half a dozen times. The highlighting thing was just pissing me off for ten minutes. Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 (edited) all indentation was lost in the rich text pasty. this is the last time i see an indentation damn it Edited February 23, 2014 by Augury Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 you'd have thought I was coding in wingdings Quote Link to comment Share on other sites More sharing options...
.josh Posted February 23, 2014 Share Posted February 23, 2014 well i'm willing to believe some of the indention might have been lost in posting, but I can tell from your code that you aren't properly indenting anyways. copy/paste issues wouldn't put several closing brackets and lines of code on one line while leaving the same type on others like that. I'll give you a hint: Looks like the issue is missing closing brackets in function MemberRouter Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 Forgot to remove the password again and I could even take down the post thanks to some js kike. Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 (edited) well i'm willing to believe some of the indention might have been lost in posting, but I can tell from your code that you aren't properly indenting anyways. copy/paste issues wouldn't put several closing brackets and lines of code on one line while leaving the same type on others like that. I'll give you a hint: Looks like the issue is missing closing brackets in function MemberRouter oooo thats sound like it could where it is! I don't like to line break but my tabs have been well kept. loose convention Edited February 23, 2014 by Augury Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 Thats just what it was -- yahoo! Quote Link to comment Share on other sites More sharing options...
Augury Posted February 23, 2014 Author Share Posted February 23, 2014 (edited) Say, in the if () conditional, will it stop at the first TRUE in an *or ||* clause. ie line one, its not going to go for that PostData() return will it? if (($halePostData === 1) || (self::PostData())) { if (self::MemberLogin ()) { $_SESSION['AMember'] = array('loggedin' => 'true', RID => '', Username => $_SESSION['field']['username'], ipaddress => '', time => ''); self::MemberRouter("loggedin"); Edited February 23, 2014 by Augury Quote Link to comment Share on other sites More sharing options...
.josh Posted February 23, 2014 Share Posted February 23, 2014 if (($halePostData === 1) || (self::PostData())) {if the first part: ($halePostData === 1) is true, it will not evaluate the rest of the condition, since only 1 of them have to be met. This is called short circuiting. logical operators Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.