28, May 2012

Simple Question: Accessing fields /vars - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Simple Question: Accessing fields /vars
« previous next »
Pages: [1] Print

Author Topic: Simple Question: Accessing fields /vars  (Read 1960 times)
Atari ST fan
*
Posts: 7
46 credits
Members referred : 0


« on: Mar 11, 2007, 01:34:26 pm »

Hi, I am really new to this and trying to do the following:
I adjusted the profile table, page, classes etc. so it fits my needs.
One field contans a URL with a RSS feed - for this i used field_one (company in example)

So, what do I want to do: There is a page, RSS.php, with a rss parser behind it. A var $rss_url = 'http://.....' holds the RSS url in the php - now i want the rss url to be in the profile table and do someting like this: $rss_url = $filed_one so that logged in users can have their own feed on there news page.

I just don't get it to work - how do I call a var out of the table (so get the rss URL out of the $field_one in PROFILE table into my pass protected rss page)?

Thanks for your help!!
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Mar 12, 2007, 08:44:29 am »

try this:

Code:
$update_profile = new Users_profile(false); // need to be false otherwise the redirect to this page will not work
$update_profile->access_page($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']); // protect this page too.
echo $update_profile->field_one;


Atari ST fan
*
Posts: 7
46 credits
Members referred : 0


« Reply #2 on: Mar 12, 2007, 06:15:17 pm »

Thanks, got it to work (didn't delete your output all for error tracking - so i got  a lot of messages - but they are caused by my rss parser ;-) Problem now is,
1.) if i hit logout my session ins't deleted - i am still logged in - even though it tells me i'm logged out.
2.) im logged in with remeber feature -> close browser -> open new one -> still logged in but error message:
Warning: Missing argument 1 for set_user() in /srv/www/vhosts/wapeins.de/httpdocs/classes/access_user/access_user_class.php on line 119

After hitting refresh everything is ok.

Code:

<?php
include($_SERVER['DOCUMENT_ROOT']."/classes/access_user/ext_user_profile.php");
//error_reporting (E_ALL); // I use this only for testing

$update_profile = new Users_profile(false); // need to be false otherwise the redirect to this page will not work
$update_profile->access_page($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']); // protect this page too.
$hello_name = ($update_profile->user_full_name != "") ? $update_profile->user_full_name : $update_profile->user;

if (isset($_GET['action']) && $_GET['action'] == "log_out") {
   $update_profile->log_out(); // the method to log off
}

?>

Thanks - did a great job with your script!!
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Mar 12, 2007, 07:45:16 pm »

Thanks, got it to work (didn't delete your output all for error tracking - so i got  a lot of messages - but they are caused by my rss parser ;-) Problem now is,
1.) if i hit logout my session ins't deleted - i am still logged in - even though it tells me i'm logged out.
2.) im logged in with remeber feature -> close browser -> open new one -> still logged in but error message:
Warning: Missing argument 1 for set_user() in /srv/www/vhosts/wapeins.de/httpdocs/classes/access_user/access_user_class.php on line 119

After hitting refresh everything is ok.

Code:

<?php
include($_SERVER['DOCUMENT_ROOT']."/classes/access_user/ext_user_profile.php");
//error_reporting (E_ALL); // I use this only for testing

$update_profile = new Users_profile(false); // need to be false otherwise the redirect to this page will not work
$update_profile->access_page($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']); // protect this page too.
$hello_name = ($update_profile->user_full_name != "") ? $update_profile->user_full_name : $update_profile->user;

if (isset($_GET['action']) && $_GET['action'] == "log_out") {
   $update_profile->log_out(); // the method to log off
}

?>

Thanks - did a great job with your script!!


It's possible that I missed something after a related update, will check this soon.

Atari ST fan
*
Posts: 7
46 credits
Members referred : 0


« Reply #4 on: Mar 12, 2007, 09:23:44 pm »



It's possible that I missed something after a related update, will check this soon.

I checked the code again - happens with user profile class / when working with user profile.
Thanks for an update, it's my start-page ;-)
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Mar 13, 2007, 07:00:41 am »

try this modified code, and tell me if the problem is gone
Code:
function Users_profile($check_profile = true) {
$this->connect_db();
if (empty($_SESSION['logged_in'])) {
$this->login_reader();
if ($this->is_cookie) {
$this->set_user();
}
}
if (isset($_SESSION['user'], $_SESSION['pw'])) {
$this->user = $_SESSION['user'];
$this->user_pw = $_SESSION['pw'];
$get_profile = $this->get_profile_data();
if ($check_profile && !$get_profile) {
header("Location: ".$this->profile_upd_page);
exit;
} else {
if (empty($_SESSION['user_id'])) $_SESSION['user_id'] = $this->id;
}
}
}




Atari ST fan
*
Posts: 7
46 credits
Members referred : 0


« Reply #6 on: Mar 13, 2007, 09:03:40 pm »

Hi Olaf,

didn't work for me. Still the message: Warning: Missing argument 1 for set_user() in /srv/www/vhosts/xxx/httpdocs/classes/access_user/access_user_class.php on line 119

Warning: Invalid argument supplied for foreach() in /srv/www/vhosts/xxx/httpdocs/classes/access_user/index.php on line 177

I'm trying to find the bug - unf. im totally new to php :-( --> first php project, used to work with asp ;-)
Thanks!

try this modified code, and tell me if the problem is gone
Code:
function Users_profile($check_profile = true) {
$this->connect_db();
if (empty($_SESSION['logged_in'])) {
$this->login_reader();
if ($this->is_cookie) {
$this->set_user();
}
}
if (isset($_SESSION['user'], $_SESSION['pw'])) {
$this->user = $_SESSION['user'];
$this->user_pw = $_SESSION['pw'];
$get_profile = $this->get_profile_data();
if ($check_profile && !$get_profile) {
header("Location: ".$this->profile_upd_page);
exit;
} else {
if (empty($_SESSION['user_id'])) $_SESSION['user_id'] = $this->id;
}
}
}



Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Mar 14, 2007, 07:58:28 am »

right I saw something over my head:

Code:
<?php
function 
Users_profile($check_profile true$redirect true) {
$this->connect_db();
if (empty($_SESSION['logged_in'])) {
$this->login_reader();
if ($this->is_cookie) {
$this->set_user($redirect);
}
}
if (isset($_SESSION['user'], $_SESSION['pw'])) {
$this->user $_SESSION['user'];
$this->user_pw $_SESSION['pw'];
$get_profile $this->get_profile_data();
if ($check_profile && !$get_profile) {
header("Location: ".$this->profile_upd_page);
exit;
} else {
if (empty($_SESSION['user_id'])) $_SESSION['user_id'] = $this->id;
}
}
}


Atari ST fan
*
Posts: 7
46 credits
Members referred : 0


« Reply #8 on: Mar 14, 2007, 09:26:00 pm »

yes, that was it ;-) thx!
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6203
Tags : vars call field Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Simple Question: Accessing fields /vars
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 06:50:31 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.