Jump to content

echoninja

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Posts posted by echoninja

  1. [code]if(!$page) { **your register bit** }
    if($page == "registered") { echo "You have registered succesfully"; } [/code]

    this assumes you are using ?page=
    so register.php would display the register form
    and register.php?page=registered will display the message :)
  2. $_SESSION['username'] = $row['username'];
    $_SESSION['email'] = $row['email'];

    is from the sender right? well for that simply register $session_user with the session when they login and do a db query for their personal data like email and register them. that way you can just use $session_whatever instead of drawing them each time and causing problems

    could be the cure, could not, its still some good advice for ya ;)
  3. Ok at the moment I have a list of entries for articles, I want a quick preview when the person hovers over the link, this is the code I have at the moment

    [code]$str=$a["body"];
                  $newlength="60";              
                  $a_body=substr($str, 0, $newlength);
                  echo "&nbsp; ● <acronym title=". $a_body ."><a href=showarticle.php?id=". $id .">". $a_title ."</a></acronym> [posted ". $a_date ."]";[/code]

    It works to an extent, it only displays the [b]first word[/b], what am I forgetting?
  4. Ive looked on various forums and websites but cant find any results. I want to upload an image twice, 1st will be normal size, 2nd will be a cropped 100x100 image, now, I DONT want to resize it, i want a 100x100 area of the image displayed. Is it possible to do with php?
  5. Hi again folks, I have an upload script for avatars/images, but I dont want them to retain their original name I want them to use the session id, now I can get the files to upload with the session ID but I cant get the extension to go on, any help?
    I have currently:

    [code]$ext = $_FILES['avatar']['type'];
    if (move_uploaded_file($_FILES['avatar']['tmp_name'],$upload_dir.session_id() .".". $ext)) {
    [/code]
  6. If you are using sessions, when you first create it in login_process.php or whatever then put
    [code]  $session_username=$_POST["username"];
        session_register("session_username");   [/code]

    then you can display

    [code]<? echo $session_username ?>  [/code]
    anywhere on the page, if someone is logged in then it will display theirname you can expand on that by doing this
    [code]<?
    if(!$session_username) //if there is no session username do the following
    {
    echo "You are not logged in, please either <a href=login.php>login</a> or <a href=register.php>register</a>, its free!";
    }
    else //if there is a session username do the following
    {
    echo "Welcome Back $session_username";
    }
    ?>[/code]
  7. I have been trying to find a tutorial on how to display the first X words from a database entry, like google does with search "..."'s
    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]PHP: Hypertext Preprocessor
    PHP is a server-side HTML embedded scripting language. It provides web developers
    with a full suite of tools for building dynamic websites: native APIs to ...
    [/quote]

    How can this be acheived?
×
×
  • 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.