PDA

View Full Version : Need good coder like eric30 ;)



PixelResources
23-08-2006, 11:59 PM
i have



<?
ob_start();
//the above line needs to be above ALL HTML and PHP (except for <?).
include("config.php");
//gets the config page, which connects to the database and gets the user's information
if ($logged[username])
{
//checks to see if they are logged in
switch($_GET[page])
{
//this allows us to use one page for the entire thing
default:
echo ("- <a href=\"messages.php?page=inbox\">Inbox</a><br />
- <a href=\"messages.php?page=write\">New Message</a>");
break;
case 'write':
if (!$_POST[send])
{
//the form hasnt been submitted yet....
echo ("<form method=\"POST\" style=\"margin: 0px;\">
<dl style=\"margin: 0px;\">
<dt>recipient</dt>
<dd>
<select name=\"to\">
");
$getusers = mysql_query("SELECT * FROM users ORDER BY 'username' ASC");
while ($users = MySQL_Fetch_Array($getusers)) {
echo ("<option value=\"$users[username]\">$users[username]</option>");
}
//the above line gets all the members names and puts them in a drop down box
echo ("
</select>
</dd>
<dt>Message Subject</dt>
<dd><input type=\"text\" name=\"subject\" size=\"20\"></dd>
<dt>Message</dt>
<dd><textarea rows=\"7\" name=\"message\" cols=\"35\"></textarea>
</dd><dt> </dt>
<dd><input type=\"submit\" value=\"Submit\" name=\"send\"></dd>
</dl>
</form>
");
}
if ($_POST[to])
{
//the form has been submitted. Now we have to make it secure and insert it into the database
$subject = htmlspecialchars(addslashes("$_POST[subject]"));
$message = htmlspecialchars(addslashes("$_POST[message]"));
$to = htmlspecialchars(addslashes("$_POST[to]"));
//the above lines remove html and add \ before all "
$send = mysql_query("INSERT INTO `pmessages` ( `title` , `message` ,
`touser` , `from` , `unread` ,
`date` ) VALUES ('$subject', '$message', '$to',
'$logged[username]', 'unread', NOW())");
echo ("Your message has been sent.");
}
break;
case 'delete':
if (!$_GET[msgid])
{
echo ("Sorry, but this is an invalid message!");
}
else
{
$getmsg = mysql_query("SELECT * from pmessages where id = '$_GET[msgid]'");
$msg = mysql_fetch_array($getmsg);
//hmm..someones trying to delete someone elses messages! This keeps them from doing it
if ($msg[touser] != $logged[username])
{
echo ("This message was not sent to you!");

}
else
{
$delete = mysql_query("delete from pmessages where id = '$_GET[msgid]'");
echo ("Message Deleted");
}
}
break;
case 'inbox':
$get = mysql_query("SELECT * from pmessages where touser = '$logged[username]' order by id desc");
echo("
<table bgcolor=\"#dddddd\" border=\"0\" width=\"100%\" cellspacing=\"0\">
<tr>
<td align=\"center\">Subject</td>
<td align=\"center\" width=\"125\">From</td>
<td align=\"center\" width=\"97\">Date</td>
<td width=\"25\">Delete</td>
</tr>
</table>
");
$nummessages = mysql_num_rows($get);
if ($nummessages == 0)
{
echo ("You have 0 messages!");
}
else
{
echo("<table border=\"0\" width=\"100%\" cellspacing=\"1\">");
while ($messages = mysql_fetch_array($get))
{
//the above lines gets all the messages sent to you, and displays them with the newest ones on top
echo ("
<tr>
<td><a href=\"messages.php?page=view&msgid=$messages[id]\">");
if ($messages[reply] == yes)
{
echo ("Reply to: ");
}
echo ("$messages[title]</a></td>
<td width=\"125\">$messages[from]</td>
<td width=\"97\">$messages[date]</td>
<td width=\"25\"><a href=\"messages.php?page=delete&msgid=$messages[id]\">Delete</a></td>
</tr>");
}
echo ("</table>");
}
break;
case 'view':
//the url now should look like ?page=view&msgid=#
if (!$_GET[msgid])
{
//there isnt a &msgid=# in the url
echo ("Invalid message!");
}
else
{
//the url is fine..so we continue...
$getmsg= mysql_query("SELECT * from pmessages where id = '$_GET[msgid]'");
$msg = mysql_fetch_array($getmsg);
//the above lines get the message, and put the details into an array.
if ($msg[touser] == $logged[username])
{
//makes sure that this message was sent to the logged in member
if (!$_POST[message])
{
//the form has not been submitted, so we display the message and the form
$markread = mysql_query("Update pmessages set unread = 'read' where id = '$_GET[msgid]'");
//this line marks the message as read.
$msg[message] = nl2br(stripslashes("$msg[message]"));
//removes slashes and converts new lines into line breaks.
echo ("
<form method=\"POST\" style=\"margin: 0px;\">
<dl style=\"margin: 0px;\">
<dt><b>$msg[title] -- From $msg[from]</b></dt>
<dd>$msg[message]</dd>
<dt><b>Reply</b></dt>
<dd><textarea rows=\"6\" name=\"message\" cols=\"45\"></textarea></dd>
<dt> </dt>
<dd><input type=\"submit\" value=\"Submit\" name=\"send\"></dd>
</dl></form>");
}
if ($_POST[message])
{
//the form HAS been submitted, now we insert it into the database
$message = htmlspecialchars(addslashes("$_POST[message]"));
$do = mysql_query("INSERT INTO `pmessages` ( `title` , `message` , `touser` , `from` , `unread` ,
`date`, `reply`) VALUES
('$msg[title]', '$message', '$msg[from]', '$logged[username]',
'unread', NOW(), 'yes')");
echo ("Your message has been sent");
}
}
else
{
//hmm..this message was NOT sent to the logged in user...so we won't display it.
echo("<b>Error</b><br />");
echo ("This message was not sent to you!");
}}
break;
}
echo("<br /><br /><div align=\"center\"><b><a href=\"?page=inbox\">Inbox</a> ยท <a href=\"?page=write\">New Message</a></b>");
}
?>


I want the messages to display like this

Message from {NameOfSender} - {Subject}
Message from {NameOfSender} - {Subject}
Message from {NameOfSender} - {Subject}
Message from {NameOfSender} - {Subject}
Message from {NameOfSender} - {Subject}

Etc etc.

Thanks :)

Edited by ---MAD--- (forum moderator): Thread closed as it has gone way off topic, thanks :).

Mentor
24-08-2006, 01:43 AM
and which part of your code do you want to do that since youve got a number of forms and outputs in the script, try being a little more specific, unless u want it to happen in an error message "/

PixelResources
24-08-2006, 11:33 AM
well the part where it displays the message ;s

:Blob
24-08-2006, 11:39 AM
Well, is this a PM system? if you want it to display like that you would need something like this where it has the message

Message from $user - $subject

Sygon.
24-08-2006, 12:09 PM
Everyone's helping you like ALOT then your oging to sell it and claim it as yours -.-' Ok the ODD help is ok but then to sell it and give no credit.

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

Mentor
24-08-2006, 12:33 PM
Everyone's helping you like ALOT then your oging to sell it and claim it as yours -.-' Ok the ODD help is ok but then to sell it and give no credit.
Help is giveing people a hand, and thats fine without credit, But this is more getting people to do it all for him.
Which unlike being helped with someone is makeing other people do the work... which causes the no credit problems "/

Allan_banvict0m
24-08-2006, 03:42 PM
well, he scammed me 2T... so check www.pixelresourcesforum.co.uk... and then see if you still fancy helping him.

i also have a chat log and another link :)

Wayne. (Super Moderator) Please don't name scammers.

ADAM:
24-08-2006, 03:56 PM
well, he scammed me 2T... so check www.pixelresourcesforum.co.uk (http://www.pixelresourcesforum.co.uk)... and then see if you still fancy helping him.

i also have a chat log and another link :)


:eusa_clap :eusa_clap :eusa_clap :eusa_clap To be honest i dont think this site will be good, he asks for help all the time and for little things that if you knew PHP you could do in like 10 secs.

Edit: Does he have a fake vbulletin ?

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

PixelResources
24-08-2006, 08:22 PM
actually adam you noob mine is real i bought it from vbulletin.com, allan said he would buy the files and thats what he got..

theres alot more to this than just that and allan knows what im talking about..

and even if my site does turn out crap i aint bothered.. i do know quite a bit of php just because i dont know as much as some of you..

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

NellyMc
24-08-2006, 08:26 PM
Mate he scammed me 1 t if he's that perfetic to do it just forget about it and laugh at him for being a noob
well, he scammed me 2T... so check www.pixelresourcesforum.co.uk (http://www.pixelresourcesforum.co.uk)... and then see if you still fancy helping him.

i also have a chat log and another link :)

Wayne. (Super Moderator) Please don't name scammers.

PixelResources
24-08-2006, 08:30 PM
*Removed*your a *Removed* you scammed someone 7T so dont complain..

Catzsy (Forum Super Moderator) - Do not accuse people of scamming or avoid the filter.

ADAM:
24-08-2006, 10:22 PM
actually adam you noob mine is real i bought it from vbulletin.com, allan said he would buy the files and thats what he got..

theres alot more to this than just that and allan knows what im talking about..

and even if my site does turn out crap i aint bothered.. i do know quite a bit of php just because i dont know as much as some of you..


Me a noob?

I havent asked for any help on this forum. I aint the one asking 24/7 so you can shut up. You want people to make your scripts and dont say dont. Look at 70% of you posts its help me with this help me with that. And you dont give them credits. I have helped many people out with PHP, Javascript, HTML Etc but i dont see you doing and thing in return for all the people helping you.

So you can shut up.

PixelResources
24-08-2006, 10:28 PM
You are a noob yes, this is a forum, in forums you post QUESTIONS you *Removed*

Catzsy (Forum Super Moderator) - Please do not be rude to others or avoid the filter.

Colin-Roberts
24-08-2006, 10:32 PM
ryan your the only one that likes *Removed*
Catzsy (Forum Super Moderator) - Please do not avoid the filter.

ADAM:
24-08-2006, 10:36 PM
I aint a noob, i have been learning web design for about 11 months now. If people ask for help on here i help them. If you didnt post as much i would help you out but you post 24/7 and want people to do it for you. You need to get a life.

You think your so hard Ryan, well ya not. You just an idiot you has to get his own way. I bet your a nerd who has no life, sits on a pc all day and looks at **** and wishes that he could be with someone like that.

Edited by ---MAD--- (forum moderator): Please stay on topic and be nice to other forum members, thanks :).

Colin-Roberts
24-08-2006, 10:40 PM
adam been longer then 11 months cuz you were here before me.

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

ADAM:
24-08-2006, 10:42 PM
I only really started in September 2005, i started a habbo website with Ed and from there i got better and learnt new skills.

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

Colin-Roberts
24-08-2006, 10:42 PM
lol jango.. good times.

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

Mentor
24-08-2006, 10:43 PM
if your asking for help a good peace of advice is dont insult or ague with the advice givers. Only the people helping are allowed to be ********s a privalage i abuse often ;p

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

PixelResources
24-08-2006, 10:45 PM
Adam you obviously have that on your mind, i am not a nerd, i do not sit on the pc all day i use it in my free time which isnt that much, and i have been learning web design for over 18 months so yeah get a life mate and yeah i have a girlfriend and i dont wish to be with someone else so get a life.

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

Colin-Roberts
24-08-2006, 10:46 PM
lol 18 months and you suck that bad? god hate to see you at learning 1 week,

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

PixelResources
24-08-2006, 10:49 PM
yeah so what i am rubbish i just dont pick up on stuff too quickly ill get there one day.. ;s





Catzsy (Forum Super Moderator) - thread beacoming arguementative and way off topic closed.

:Blob
25-08-2006, 09:12 AM
Stop calling Adam a n00b, when hes not...

And who cares how long hes been here? Ive been here nearlt 2 years..

Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).

---MAD---
25-08-2006, 09:18 AM
Seems like the other moderator did hit the close thread button.

Thread is now closed ;).

Want to hide these adverts? Register an account for free!