Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsWeb Design & DevelopmentServer Side ScriptingPHP right
  Closed Topic Start new topic
left right
MrTouz
post Jan 13 2009, 08:20 PM
Post #1


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



Hello,

Almost done with my script i need to find 2 more things, either to DL or a tutorial to remake... does not really matter to me. I just can't find them or not searching hard enough... im working to hard on it that ive lost senses...

Profile picture :

I have my database set for my users info, i just need them to have ONE profile picture. I need to be able to set the size (or not does not really matter... but its always better) but set the format (only jpg bmp png....) and not allow cetain formats such as exe files and stuff like that. The script needs to be able to replace pictures n case the user changes his pics. And better... delete the old one (so my server does not get crowed by morons who love to change their profile pictures)

(my other thought was to make them upload their pic on their server and just set up a link <input> box so it shows what ever they have set... less problems as well) still not sure about that !

Message system :

Ok this is the one i am really lost... i dunno where to start, what to look for... or even how to do it. I would like to have a system where users can have a message system. Not a WYSIWYG coz i can add that later on but more over a page where i can send messages and receive some.

Sendmess.php ?

To : (profile name input)
Subject : (subject input)
Content : (textarea for its content)


Receivemess.php ?

Once sent, the user gets the message on his inbox like

date | from sender | title | (select box used for delet) (when i think about it... basically like zymics tongue.gif

___

But nothing to fancy... i don't really care if there is a Read unread... i just want a limit of 10 messages. And the field not to accept more than 1000 caracters.

Anyone can help ? knows where to find that type of things ?

Thanks biggrin.gif
Go to the top of the page 
 
  + Quote Post
uncled1023
post Jan 13 2009, 09:15 PM
Post #2


Super Duper Ninja
*****

Group: Members
Posts: 423
Joined: 24-February 08
Member No.: 11,718



um, i have a message system tutorial in the tutorials section, and for the profile picture, i have one set up, and ill put it into tutorial format for you.
Go to the top of the page 
 
  + Quote Post
MrTouz
post Jan 14 2009, 07:19 AM
Post #3


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



Wow thanks a lot ! going to look right now !
Go to the top of the page 
 
  + Quote Post
MrTouz
post Jan 19 2009, 01:04 PM
Post #4


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



Sorry, i am bumping this lady.

Thanks uncled for this awesome PM system which i integrated PERFECTLY into my system...

But i need 'still' a avatar system.

Now that i see the Message system, i think i can write my own but should i use the same path ?

create a table called 'avatars'
username (primary)
avatar (image name and extension)
change (number of how many times they changed it tongue.gif just coz i want to try the adding data +1 again:P)

Should i start that way ?
Go to the top of the page 
 
  + Quote Post
uncled1023
post Jan 19 2009, 09:14 PM
Post #5


Super Duper Ninja
*****

Group: Members
Posts: 423
Joined: 24-February 08
Member No.: 11,718



yea, i have my avatar in my users table though to help make it easier to attribute to their account.
Go to the top of the page 
 
  + Quote Post
MrTouz
post Jan 19 2009, 11:08 PM
Post #6


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



That's what i have now. I have a row called avatar. I was thinking on integrating the data like that.
Im still having issues with the uploads.

My problem is that if someone changes his avatar than the old one is still on my server. Which pisses me off since if everybody changes their avatar all the time... i am one screwed mother fucker. Ill end up with 10 000 avatars for 1000 members :/ that sucks.

I need a script that replaces the image (deletes the old one) when a new one is set up.
Go to the top of the page 
 
  + Quote Post
flyboy
post Jan 19 2009, 11:38 PM
Post #7


Ninja
***

Group: Members
Posts: 234
Joined: 23-May 08
From: Scotland
Member No.: 29,312



Hmm well the only way that i would suggest is somehow have the image name be the exact name as the previous avatar image. That way it will replace the old one. How you go about doing that i do not know.

Are you tryn to work with a cms or using your own system built from scratch.
Go to the top of the page 
 
  + Quote Post
MrTouz
post Jan 19 2009, 11:56 PM
Post #8


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



Its my own system from scratch. I believe i can set it so the name is the session's username. No sure about that but i think i can do it. The only problem i see is uppercase names and lower case names :/

I have to try that. You gave me one more option.

Thank you flyboy
Go to the top of the page 
 
  + Quote Post
Ed
post Jan 20 2009, 12:50 AM
Post #9


Outrageously Uber Ninja
*******

Group: Administrators
Posts: 2,831
Joined: 11-March 07
From: UK
Member No.: 9



Providing the directory has execute permissions, just use http://www.php.net/unlink

Remove the existing file, move the new one into location, update the db column. Perhaps use the user index as the unique identifier for the image, so the user index prefixed to the file extension (so it renders correctly).
Go to the top of the page 
 
  + Quote Post
uncled1023
post Jan 20 2009, 02:06 AM
Post #10


Super Duper Ninja
*****

Group: Members
Posts: 423
Joined: 24-February 08
Member No.: 11,718



Heres the code i use to upload a pic and save it to the database under Seal (aka avatar)

this is for both posting a url to the pic, and uploading your own. the form is as follows.

CODE
<form enctype="multipart/form-data" action="upload.php" method="POST">
            <!-- MAX_FILE_SIZE must precede the file input field -->
            <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
            <!-- Name of input element determines name in $_FILES array -->
            Upload Avatar:
            <input name="file" type="file" id="file" />
            <input type="radio" name="upload" value="file"><br />
            <br />
            Use URL:
            <input name="text" type="url" id="url" />
            <input type="radio" name="upload" value="url"><br />
            <br />
            <input type="submit" value="Upload" />
          </form>


aand here is the upload.php

CODE
<?php

require 'db_connect.php';

$upload = $_POST['upload'];

//check if they are using a url.

if($upload == 'url') {
    
    $sql = "UPDATE users SET url_seal='1', seal='".$_POST['url']."' WHERE governor_name='".$_SESSION['username']."'";

    $query=mysql_query($sql);

    
} else {

//they are uploading a file.

    $seal_name = $now.'_'.$_FILES[file]['name'];

//this is the target directory where your saving the file

    $target_path = "seals/";

    $target_path = $target_path . $seal_name;

    if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
    
        $user = $_SESSION['username'];

        $sql = "UPDATE users SET url_seal='0', seal='$seal_name' WHERE governor_name='".$_SESSION['username']."'";

        $query=mysql_query($sql);
    
    ?>
    
            &lt;script type="text/javascript">
        <!--
        window.location = "/index.php?id=edit_account&art=<?php echo $_SESSION['username'];?>"
        //-->
        </script>
    
    <?php
    
    } else{
     ?>
    
            &lt;script type="text/javascript">
        <!--
        window.location = "/index.php?id=edit_account&art=<?php echo $_SESSION['username'];?>&error=5"
        //-->
        </script>
    
    <?php
    }
}
?>
Go to the top of the page 
 
  + Quote Post
MrTouz
post Jan 20 2009, 02:41 AM
Post #11


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



Thanks a lot.

I am not at home now, once i am back i will try that.
Go to the top of the page 
 
  + Quote Post
 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 19th June 2013 - 09:44 PM