Jump to content

White_Lily

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by White_Lily

  1. So basically I should re-code it so that sent messages get put into some kind of "sent" folder (or table since that where messages are stored)?
  2. More to the point, how do they even know that you have a T variable in your script in the first place? Unless you have tester's that are trying to break the script?
  3. If the sender sends a message, then obviously they have read it, but the reciever may not have read it... in which case the message would appear bold in the reciever's inbox, but not bold in the sender's inbox.
  4. AyKay47 why the css section? im using PHP to determine the position of the image since (believe it or not) everyone's avatars would be different sizes.
  5. The values for $width and $height are determined by the image given by getimagesize("/path/image.jpg");
  6. winningdave good logic however the only problem with that is that if read is set to 0 then both users would see it as unread, and if it was set to 1 both users would see it as read, even if one of the users has NOT read the message.
  7. Okay so i did what you said and it works, but now I have a slightly new problem. Here is the uploading code: <?php $newdir = $dir."/uploads/"; if(!empty($_POST['imgsubmit'])){ if (isset ($_FILES['new_image'])){ $imagename = $_FILES['new_image']['name']; $parts = explode( '.', $imagename ); $extension = strtolower( $parts['1'] ); $new_filename = uniqid().".".$extension; $source = $_FILES['new_image']['tmp_name']; $target = $doc.$new_filename; move_uploaded_file($source, $target); $imagepath = $new_filename; $save = $doc.$imagepath; //This is the new file you saving $file = $doc.$imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 166; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; if(!empty($imagepath)){ $imageavi = $dir2.$imagepath; $changeavi = update("users", "avatar = '$imageavi'", "username = '$u'") or die(mysql_error()); if($changeavi){ echo "Avatar Changed!"; } } } } ?> The new problem I have is on the profile page: $getbg = select("*", "users", "username = '$u'"); $bg = mysql_fetch_assoc($getbg); $pic = $bg["background"]; $propicmargin = $bg["avatar"]; if($propicmargin){ list($width, $height) = getimagesize($propicmargin); /*//Calculates Height of images that have an exact width of the box. if($width == 166){ $margin = 166-$height; $margin = $margin/2; if($margin < 0){ $margin = 0; } }*/ //Calculates Width & Height of small images to find the margin left & top. if($width < 166 && $height < 166){ $margin = 166-$height; $margin = $margin/2; if($margin <= 0){ $margin = 0; } $marginw = 166-$width; $marginw = $marginw/2; if($marginw <= 0){ $marginw = 0; } } $avatar = '<img src="'.$propicmargin.'" />'; }else{ $avatar = '<img src="'.$GLOBALS["nav"].'images/avatar.png" />'; } To see the actual problem I am having: http://janedealsart.co.uk/social User: Guest Pass: Guest657
  8. $target is the target directory yes? I was under the impression $source was the file name...
  9. Sorry forgot to post those lol Here they are: Warning: move_uploaded_file(/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploads) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 76 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpU6IZwg' to '/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploads' in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 76 Warning: getimagesize(/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploadsGuildWars2-Guardian-GW2.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 82 Warning: Division by zero in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 88 Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 89 Warning: imagecreatefromjpeg(/home/sites/janedealsart.co.uk/public_html/social/users/Dr4g0nhe4rt/uploadsGuildWars2-Guardian-GW2.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 90 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 91 Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/sites/janedealsart.co.uk/public_html/social/gd.php on line 93
  10. Okay so i made 2 columns in my database, "read_1" and "read_2", how would i go about defining which user has/hasn't read whatever messages?
  11. Im getting lots of errors on my image uploading script, but i can't figure out why they are showing, the filepath and names are correct. $doc Variable: $doc = $_SERVER['DOCUMENT_ROOT']."social/users/".$u."/uploads/"; Upload Code: <form action="" method="POST" enctype="multipart/form-data"> <input name="new_image" type="file" class="input" /> <input name="imgsubmit" type="submit" class="buttons" value="Upload" /> </form> <?php $newdir = $dir."/uploads/"; if(!empty($_POST['imgsubmit'])){ if (isset ($_FILES['new_image'])){ $imagename = $_FILES['new_image']['name']; $source = $_FILES['new_image']['tmp_name']; $target = $doc; move_uploaded_file($source, $target); $imagepath = $imagename; $save = $doc.$imagepath; //This is the new file you saving $file = $doc.$imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 500; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; echo "Large image: <img src='".$newdir.$imagepath."'><br>"; } } ?>
  12. I tried to use the 0 or 1 method but if its set to 0 then it comes up on both users as unread, and if it is set to one then it comes up on both users as read... even if they haven't read it.
  13. Um, tbh - if i knew how to go about doing it, I wouldn't be posting here... would I? Ass in, what does my database need in it as all it has at the moment is the simple things like; content, message id, from, to, subject... what else is needed? Maybe give me some links to look at or some sample code that I can build on, I have tried looking on the internet but nothing seems to do what I need it to do.
  14. how can you explain a read/unread system for an inbox? A user has either read a message, or not read a message, however when a user sends a message to another, the receiver needs to see it as unread... im not entirely sure how else to explain it...
  15. Hi I have created an inbox system, but i want to implement a read/unread system. Messages would consist of 2 people always. (Sender & Receiver). I was wondering how I would go about this. (I would like to avoid javascript / jquery if possible)
  16. I see the problem, your doing it correct in a way that you are including the file, NOT the function. to use functions: include "connect.php"; connect(); connect.php: function connect(){ //connection code }
  17. As for what Jess said on like the first or second post she did - about the indenting - when you copy and paste code into the text editor, the text editior takes out all of the indenting thereby making it all just a plain list.
  18. do not use session_register(). use: session_start(); $_SESSION["user"]; $_SESSION["pass"]; //as I found out a while ago you shouldn't need to put the password into a session anyway
  19. if you going to use joins you need to have while($stats = mysql_fetch_array($user)){ //other code }
  20. This is how I am doing my registration forms at the moment, however it requires 1 error message for all the empties it finds. if($_POST["submitReg"]){ $validateArray = array("name" => "text", "email" => "email"); foreach($validateArray as $key => $value) { if($value == "text") $$key = htmlspecialchars(mysql_real_escape_string($_POST[$key])); else $$key = mysql_real_escape_string($_POST[$key]); if(empty($$key)) { } } }
  21. A+ = $FinalGrade > 93 A = $FinalGrade > 88 || <= 93 etc etc, however: F = $FinalGrade < 49
  22. if it cant find the function then you probably haven't included the file properly.
  23. Hmm, okay - that worked thanks! I didn't relize just putting ` around each column name made a difference...
  24. Hi, I am trying build a system in which users can send messages to eachother. The problem im having is that the script is having problems inserting the message into the database and i cant figure out why. Here is the code form that the user fills out: <?php echo '<div id="pronav">'; echo '<ul>'; echo '<li><p>Nav to go here.</p></li>'; echo '</ul>'; echo '<div class="clear"></div>'; echo '</div>'; echo '<img src="'.$GLOBALS["nav"].'images/vertical-rule.png" />'; echo '<p>'.$u.'</p>'; echo '<form action="" method="POST">'; echo '<table border="0" style="width:auto;">'; if(!empty($senderr)){ echo '<tr>'; echo '<td colspan="2"><div class="error">Error: '.$senderr.'</div></td>'; echo '</tr>'; }if(!empty($sendpass)){ echo '<tr>'; echo '<td colspan="2"><div class="pass">Success: '.$sendpass.'</div></td>'; echo '</tr>'; } echo '<tr>'; echo '<td>To:</td>'; echo '<td><input type="text" name="sendto" id="sendto" class="input" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td align="top">Subject:</td>'; echo '<td><input type="text" name="sendsubject" class="input" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td>Message:</td>'; echo '<td><textarea name="writemsg" id="sendmsg" class="input" style="height:200px;"></textarea></td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan="2"><input style="float:right;" type="submit" name="sendmsg" class="buttons" value="Send" /></td>'; echo '</tr>'; echo '</table>'; echo '</form>'; ?> Here is the script that inserts the message: //Send Message $sendmsg = $_POST["sendmsg"]; $to = $_POST["sendto"]; $subject = $_POST["sendsubject"]; $message = $_POST["writemsg"]; if(!empty($sendmsg)){ if(empty($to) || empty($message)){ $senderr = "Please fill out the needed fields in order to send a message. (To: & Message:)"; }else{ $date = date('Y/m/d H:i:s', time()); $putmsg = insert("messages", "id, title, content, to, from, date", "1, '$subject', '$message', '$to', '$u', '$date'"); if($putmsg){ $sendpass = "You have successfully sent your friend a message."; }else{ $senderr = "Failed to send message to your friend. Please try again later.<br><br>".mysql_error(); } } } Here is the error I am recieving: Error: Failed to send message to your friend. Please try again later. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to, from, date) VALUES (1, 'Testing Subject', 'Testing message', 'White_Lily', '' at line 1 Any help would be appreciated.
  25. Sorry for the code being non-indented(?) For some reason this forums text-editor removes indenting when you click submit :/ Thanks Psycho I will look at that list of things to do and see what happens
×
×
  • 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.