Jump to content

sbsads

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by sbsads

  1. You should echo the $_SERVER['HTTP_REFERER'] variable to see the exact content of the string, but after you process your form, your VERY FIRST HTTP output should come from code like the following: header ('location:http://www.yoursite.com/'.$_SERVER['HTTP_REFERER']); Depending on your site structure, this may work as well: header ('location:your_folder/'.$_SERVER['HTTP_REFERER']); NOTE: $_SERVER['HTTP_REFERER'] will not likely pass variables such as $_GET values, so you may need to manually build a code referral method and use that for the login. here is what I used recently on a site: // sets referral page for login if ($_GET['action'] != 'login') { unset($_SESSION['refer']); foreach ($_GET as $field=>$value) { $bld_refer .= '&'.$field.'='.strip_tags($value); } $_SESSION['refer'] = '?'.ltrim($bld_refer,'&'); } //processes login switch ($get['task']) { case 'logout': $refer = $_SESSION['refer']; $new_user->logout_user(); header('Location:'.$refer); break; case 'login': $vars = new variables($db); $req = $vars->req_fields(); $entries = $new_user->usrLogin($_POST,$req['login']); if (isset($entries['error'])) { $this_form->login_form($entries,$entries); } else { header('Location:'.$_SESSION['refer']); } break; } I do have some classes that process the login, but if the method returns true, it kicks the user to the page the logged in from. Hope that helps
  2. I'm not sure exactly what you are saying, but if I understand you croorectly, what you mentioned actually is what I am doing. I have a process within my display class that picks the "partners" to show based on specific criteria for the requested page. It loops through the ID's that are pulled from the query and then assigns the partnerID to the partner class through a setter method. Once the partner ID property is set, I just call a method within the partner class that pulls the info from the database for that specific partner and passes the values to the display class where they are formatted for display. I am baffled, however, because, while the code works just fine elsewhere in the script, in this case, the setter method works fine on, say, the first and third pass, but on the second it doesn't. I have tried a variety of possibilities. [*]The first was to set the partner ID immediately at the point where $ids->id[$b] occurs. [*]The second was to assign the value of $ids->id[$b] to a standard string ($partID) and call the method at a different point in the script [*]The final is as you see, to try to make the value a property of the display object, then pass that property through the setter method to the partner class All attempts have generated identical results. The first and third passes set the property effectively. The Second does not. I have not tested it further, but is there some sort of conflict that is negating the value of $ids->id[$b] right at the point where I pass the value? You can see that the value passes to the setter method, but it "craps out" just as it tries to pass the value. I'm really at a loss.
  3. I get the following error when I try to pass a value to a methiod in a loop: Warning: Attempt to assign property of non-object in /Users/staceyschaller/Sites/dev_zone/ckwv2/classes/class.php on line 670 This one has me very baffled. It will work the first time, and seems to work every other time, so I have no clue what is wrong. Here is the code: This code is part of my "display" class: function display_partner ($type,$loc,$rand=0,$narrow=0) { $this->partners = new partner($this->cxn); $display = ' <div id="cont_info" class="partner-list"> <div> <h3 class="settings">'.ucfirst($loc).' '.ucfirst($type).last_letter($type).'s</h3> </div> <div class="settings-value" style="height:12px;padding:0;margin:0;text-align:right;padding-right:10px;"> <a href="" class="trunc">Add your organization to this list</a></p> </div> <div style="height:2px;padding:0;margin:0;"> <hr class="account" /> </div> '; $ids = $this->partners->get_partners_list($type,$loc,$rand); for ($b=0;$b<sizeof($ids->id);$b++) { $this->partnerID = $ids->id[$b]; $display .= ($narrow)? $this->card_partner_narr():$this->card_partner(); if ($b!=(sizeof($ids->id)-1)) { $display .= '<hr class="account" />'; } } if (sizeof($ids->id)==0) { $display .= '<div style="color:#999999;display:line;text-align:center;height:20px;">No Partners found for '.ucfirst($loc).' '.ucfirst($type).'</div>'; } $display .= ' </div>'; return $display; } function card_partner () { $this->partners->set_partner_id($this->partnerID); $part_info = $this->partners->get_partner_info(); if ($part_info) { $display .= ' <table class="settings"> <tr> '.$this->show_if($part_info['partLogo']['val'],'<td class="settings-value" rowspan="2"><img src="'.LOGO_FOLDER.$part_info['partLogo']['val'].'" '.resize_img(LOGO_FOLDER.$part_info['partLogo']['val'],175).'alt="'.$part_info['partName']['val'].'" /></td>').' <td class="settings-value" colspan="2"><h5>'.$part_info['partName']['val'].'</h5></td> </tr> <tr> <td class="settings-value"> <span style="color:999999;">'.$part_info['partAddress']['val'].'<br /> '.$part_info['partCity']['val'].', '.$part_info['partST']['val'].' '.$part_info['partZIP']['val'].'<br /> '.$part_info['partPhone']['val'].'</span><br /> <a href="'.$this->form->show_href($part_info['partWeb']['val']).'" target="_blank">'.$part_info['partWeb']['val'].'</a> </td> <td class="settings-value">'.$part_info['partInfo']['val'].'</td> </tr> </table> '; } return $display; } This code is part of my "partners" class: function set_partner_id($partID) { echo '<p>partID: '.$partID.' '.gettype($partID).'<br> $this->partner->id: '.$this->partner->id.'</p>'; $this->partner->id = $partID; ///*** ERROR HAPPENS HERE ***/ echo '<p>id set: '.$this->partner->id.'<br> $this->partner->id: '.$this->partner->id.'</p><hr>'; } function get_partner_id() { return $this->partner->id; } // gets user info at login function get_partner_info() { $this->partner = $this->cxn->proc_info('partner','partID',$this->partner->id);//$this->partner->id return $this->partner; } The following is the output generated: partID: 24 string $this->partner->id: id set: 24 $this->partner->id: 24 partID: 26 string $this->partner->id: Warning: Attempt to assign property of non-object in /Users/staceyschaller/Sites/dev_zone/ckwv2/classes/class.php on line 670 id set: $this->partner->id: partID: 17 string $this->partner->id: id set: 17 $this->partner->id: 17 partID: 25 string $this->partner->id: Warning: Attempt to assign property of non-object in /Users/staceyschaller/Sites/dev_zone/ckwv2/classes/class.php on line 670 id set: $this->partner->id: As you can see, the value passes to $this->set_partner_id($partID) each time. It is formatted as a string. When it assigns the value to $this->partner->id, however, sometimes it works, and sometimes it doesn't. It's probably something obvious, but I've racked my brain to see what it is. Any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.