![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
White_Lily
-
Posts
531 -
Joined
-
Last visited
-
Days Won
1
Posts posted by White_Lily
-
-
and AyKay47, its the php that calculates the numbers needed for the styles of the avatars, and since the problem is with the php calculations and not the css then this is therefore a php problem and stays here.
-
The size of the image you see on the website is 166(width) by 132(height).
Im not sure how the website managed to figure out 83px margins since whne i figured it out paper i got 17px (margin-top)... (I used the same equations as the website is using.
-
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)?
-
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?
-
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.
-
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.
-
The values for $width and $height are determined by the image given by getimagesize("/path/image.jpg");
-
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.
-
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
-
$target is the target directory yes? I was under the impression $source was the file name...
-
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
-
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?
-
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>"; } } ?>
-
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.
-
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.
-
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...
-
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)
-
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 }
-
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.
-
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
-
if you going to use joins you need to have
while($stats = mysql_fetch_array($user)){ //other code }
-
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)) { } } }
-
A+ = $FinalGrade > 93
A = $FinalGrade > 88 || <= 93
etc etc,
however:
F = $FinalGrade < 49
-
if it cant find the function then you probably haven't included the file properly.
?t=Reg And Spammers
in PHP Coding Help
Posted
Good point, maybe the OP should take a look into URL Rewrites, he might find something there to help him hide the values in the url.