Jump to content

echoninja

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by echoninja

  1. to expand on what samshell said, in your when you send your info from the form to the database just simply do this $ip=$_SERVER['REMOTE_ADDR']; and then just add it into the INSERT like the rest of the data :)
  2. [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 :)
  3. $_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 ;)
  4. 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?
  5. thanks ill give a shot looking up GD
  6. Ok ill explain a bit more Im looking to learn how to do it on the fly so when I hit "upload" it uploads 2 images and one gets cropped by a defined variable of width and hieght
  7. 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?
  8. I acutally decided (before reading your post) to inster $username at the start, so then it doesn't matter if they overwrite a file, because they are changing it for their avatar anyways. Thanks for the help folks
  9. nevermind i actually found it in the membership tutorial, well the command, then used it for my own diabolical ends :) if anyone wants to know [code]$ext = strrchr($_FILES['avatar']['name'], "."); if (move_uploaded_file($_FILES['avatar']['tmp_name'],$upload_dir.session_id() .".". $ext)) { [/code]
  10. because its for user avatars, and session id's are unique. That's not important though, I cant get the mime type to add onto the end
  11. 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]
  12. 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]
  13. great stuff, I can see how it works now :) thanks very much
  14. 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.