Jump to content


Photo

how to make pages like blah?user=username


  • Please log in to reply
29 replies to this topic

#21 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 September 2006 - 03:33 PM

post the code you got and having problams with.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#22 w32

w32
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 02 September 2006 - 03:36 PM

I did not write the script for you lol...it was an example for you to work upon ...I did comment it, thought you'd modify it :D

#23 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 02 September 2006 - 05:37 PM

ok i need help with this
????????????????????

:(

i can't get it to work

when i link the to the user profile
the page shows blank?
some one help
here's the page http://www.pokebash.com/user.php
and the code
<?php
include ("config.php");
//###########################################################
if($_GET['uid'])
  {
   $sql['userdata'] = mysql_query("SELECT * FROM pokebash_users WHERE maaking_users='".$_GET['uid']."' ");
    //########IF USERID EXISTS#####
    if(mysql_num_rows($sql['userdata'])>0)
      {
       $sql['userdata'] = mysql_fetch_array($sql['userdata']);
        //######GET & DISPLAY SOME USER DATA#####
        $username = $sql['userdata']['username'];
        $email = $sql['userdata']['email'];
        echo $username .'
'. $email;

      }
    //#####USER DOESN'T EXIST######
   else
     {
     echo 'This user is not in our database';
     }

  }
//#########REDIRECT IF UID IS NOT IN THE URL#########
 else
 {
  echo '<meta http-equiv="refresh" content="0;URL=user.php" />';
 }
?>


#24 w32

w32
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 02 September 2006 - 05:42 PM

questions the 'maaking_users' field contains the users id or their username??

if it does contain the userid  browsing user.php?uid=1  or any id that's actually in the dbase should bring out your user's info :)

#25 w32

w32
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 02 September 2006 - 05:44 PM

better yet give me allllll the fields in your database and info of what they contain, and I'll make you a working script :)

#26 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 02 September 2006 - 05:53 PM

ok i will thanks for the posts
they are

id
username
password
email
fullname

#27 w32

w32
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 02 September 2006 - 06:15 PM

<?php
//##your db script##
include("config.php");

if($_GET['uid'])
{
$id = $_GET['uid'];
$get['userdata'] = mysql_query("SELECT * FROM pokebash_users WHERE id='$id'");

$get['userdata'] = mysql_fetch_array($get['userdata']);

echo 'Username: ' .$get['userdata']['username'] .'<br />';
echo 'E-mail: ' .$get['userdata']['email'] .'<br />';
echo 'fullname: ' .$get['userdata']['fullname'];

}
else
{
//########REDIRECTS TO YOUR HOME PAGE IF UID IS NOT PRESENT IN THE URL#########
echo '<meta http-equiv="refresh" content="0;URL=index.php" />';
}
?>

That'd work I think :)

you should now use something like user.php?id=1  or any id you want

#28 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 02 September 2006 - 06:31 PM

when ever i lin..
ohh i think i just thought of something!

#29 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 02 September 2006 - 06:36 PM

ok here's the code
when ever i click on the link to view the profile
it sends me back to the same page with a different url
here's the page
http://www.pokebash.com/user.php
heres the code
<? include ("header.php"); ?>

<?php
   //connect to and select db
   $conn = mysql_connect('localhost','//yes i left these blank for secrurity purposes','') or die(mysql_error());
   $db = mysql_select_db('pokebash_users',$conn) or die(mysql_error());
   
   //get a list of the info from the table to make the linkies
   $sql = "select * from maaking_users";
   $result = mysql_query($sql, $conn) or die(mysql_error());

   // for each row fetched from the results...   
   while ($list = mysql_fetch_array($result)) {
       //make the custom linkie
       echo "<font color='black'><a href= 'http://www.pokebash.com/user.php?id={$list['userid']}'>{$list['username']}</a><br>"; 
   } // end while

   // if the user clicked on a linkie and therefore an id exists (the is_numeric is a basic security precaution) ...
   if (is_numeric($_GET['username'])) {
      // for easier var syntax handling
      $id = $_GET['userid'];
       
       
      $sql = "select username from maaking_users where video_id = '$id'";
      $result = mysql_query($sql, $conn) or die(mysql_error());

      $videofound = mysql_num_rows($result);
      if ($videofound) {
         $user = mysql_fetch_array($result);
         include ("header.php");
echo "  ";

      } // end if found
   } // end if there was a linkie clicked
?>

<?php
//##your db script##

if($_GET['userid'])
{
$id = $_GET['userid'];
$get['userdata'] = mysql_query("SELECT * FROM pokebash_users WHERE userid='$id'");

$get['userdata'] = mysql_fetch_array($get['userdata']);

echo 'Username: ' .$get['userdata']['username'] .'
';
echo 'E-mail: ' .$get['userdata']['email'] .'
';
echo 'fullname: ' .$get['userdata']['fullname'];

}

?>


#30 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 02 September 2006 - 09:44 PM

people pleeze




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users