| | |
Linking username to profile...
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 2
Reputation:
Solved Threads: 0
Posting this for a friend here is his question...
Thanks in Advance.
hey, this is my first post on these forums, i have just started learning php after doing no coding whatsoever for a while. i have to successfully get past this first, so here goes.
i have a site, where you login in, and then i want to show stats (name, favourite football club, games played, goals scored etc)
i have this file called view_profile.php that then links to view_profile.tpl.php.
the error im getting is 'There was no username entered in the URL.'
I think all that need to happen is for it to get the right username that your logged in under, but this is not showing it, can someone tell me what is missing?
Also, if you fancy helping to complete this website, and play fifa 08/09, please give me a shout
Thanks in Advance.
hey, this is my first post on these forums, i have just started learning php after doing no coding whatsoever for a while. i have to successfully get past this first, so here goes.
i have a site, where you login in, and then i want to show stats (name, favourite football club, games played, goals scored etc)
i have this file called view_profile.php that then links to view_profile.tpl.php.
the error im getting is 'There was no username entered in the URL.'
I think all that need to happen is for it to get the right username that your logged in under, but this is not showing it, can someone tell me what is missing?
Also, if you fancy helping to complete this website, and play fifa 08/09, please give me a shout
PHP Syntax (Toggle Plain Text)
<?php require "global.php"; $body = new template(TPL_ROOT); check_login(); if(!$_GET['get_username']) { full_error("Error", "There was no username entered in the URL."); exit; } $get_username = secure_input($_GET['get_username']); $get_username = str_replace("_", " ", $get_username); $user_query = $mysql->query("SELECT username, user_level, real_name, favourite_clubs, age, short_bio, nationality, second_nationality, positions, register_timestamp, lastlogin_timestamp FROM users WHERE username='".$get_username."'"); if($mysql->num_rows($user_query) < 1) { full_error("Error", "There is no user with the name of, <strong>".$get_username."</strong>."); exit; } $user_results = $mysql->fetch_array($user_query); $title = $user_results['username']; $body->set('user_results', $user_results); $tpl->set('title', $title); $body->set('error', null); $tpl->set('body', $body->fetch("view_profile.tpl.php")); echo $tpl->fetch('template.tpl.php'); $mysql->close(); ?>
copy the url from the address bar and post it and I'll tell you what is wrong.
Last edited by R0bb0b; Sep 27th, 2008 at 4:20 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
•
•
Join Date: Sep 2008
Posts: 15
Reputation:
Solved Threads: 1
Hi there,
I believe the problem here is this may not be entirely your system (correct me if i'm wrong here). If you've just started coding PHP, as you've stated, I doubt you'll have reached templating or advanced security coding like this.
However, the problem lies in the following statement:
The page is expecting a GET parameter named "get_username", which means your url should look like this:
view_profile.php?get_username=heenix
As a side note, .tpl.php or .tpl files are usually Smarty Template files so I'm not sure as to why you would want to link to them?
Christopher Lord.
I believe the problem here is this may not be entirely your system (correct me if i'm wrong here). If you've just started coding PHP, as you've stated, I doubt you'll have reached templating or advanced security coding like this.
However, the problem lies in the following statement:
PHP Syntax (Toggle Plain Text)
if(!$_GET['get_username']) { full_error("Error", "There was no username entered in the URL."); exit; }
The page is expecting a GET parameter named "get_username", which means your url should look like this:
view_profile.php?get_username=heenix
As a side note, .tpl.php or .tpl files are usually Smarty Template files so I'm not sure as to why you would want to link to them?
Christopher Lord.
The above posters are correct, it's looking for a variable passed to it through the address bar. If this is user data make sure you that the function "secure_input()" is properly sanitizing the information. What php functions is this function using?
"Beneath this mask there is more than flesh. Beneath this mask there is an idea, Mr. Creedy, and ideas are bulletproof." - V
![]() |
Similar Threads
- Simple login (read data through txt file) (Visual Basic 4 / 5 / 6)
- The Definitive Guide to which Forum Software Information (Growing an Online Community)
Other Threads in the PHP Forum
- Previous Thread: PHP progress bar
- Next Thread: System Advice: Best Way To Approach This Problem?
| Thread Tools | Search this Thread |
5.2.10 action apache api array beginner beneath binary broken cakephp checkbox class classes cms code cron curl database date destroy display dynamic echo echo$_get[x]changingitintovariable... email encode error fcc file files folder form forms function functions google header howtowriteathesis href htaccess html image images include insert ip javascript joomla limit link local login mail memberships menu mlm mod_rewrite multiple multipletables mysql mysqlquery neutrality oop open passwords paypal pdf php provider query radio random record remote rss script search server sessions sockets source space sql strip_tags syntax system table template thesishelp tutorial update upload url validator variable video voteup web window.onbeforeunload=closeme; youtube





