Ik heb een berichten systeem waarbij je een bericht naar een username kan sturen, maar na dat ik dingen veranderd heb doet hij het onverwachts niet meer. ik merk dat er steeds al het een en ander mis gaat
dit is mijn pagina, ik weet 90% zeker dat hier de fout zit, maar kan hem echt nergens vinden... ben al een tijdje aan t kijken en proberen..
als je wil kijken wat hoe en wat werkt: http://web-stars.nl/
je kan een nieuwe account maken of gebruikersnaam: fabian wachtwoord: fabian gebruiken.
de error is:
else
{
$error = 'Er is een fout opgetreden, neem contact op met webstars.';
<?php
include('profielhead.php');
if(isset($_SESSION['username']))
{
$form = true;
$otitle = '';
$orecip = '';
$omessage = '';
if(isset($_POST['title'], $_POST['recip'], $_POST['message']))
{
$otitle = $_POST['title'];
$orecip = $_POST['recip'];
$omessage = $_POST['message'];
if(get_magic_quotes_gpc())
{
$otitle = stripslashes($otitle);
$orecip = stripslashes($orecip);
$omessage = stripslashes($omessage);
}
if($_POST['title']!='' and $_POST['recip']!='' and $_POST['message']!='')
{
$title = mysql_real_escape_string($otitle);
$recip = mysql_real_escape_string($orecip);
$message = mysql_real_escape_string(nl2br(htmlentities($omessage, ENT_QUOTES, 'UTF-8')));
$dn1 = mysql_fetch_array(mysql_query('select count(id) as recip, id as recipid, (select count(*) from pm) as npm from users where username="'.$recip.'"'));
if($dn1['recip']==1)
{
if($dn1['recipid']!=$_SESSION['userid'])
{
$id = $dn1['npm'];
if(mysql_query('insert into pm (id, id2, title, user1, user2, message, timestamp, user1read, user2read)values("'.$id.'", "1", "'.$title.'", "'.$_SESSION['userid'].'", "'.$dn1['recipid'].'", "'.$message.'", "'.time().'", "yes", "no")'))
{
?>
<div class="message">Het bericht is verstuurd<br />
<a href="list_pm.php">berichten</a></div>
<?php
$form = false;
}
else
{
$error = 'Er is een fout opgetreden, neem contact op met webstars.';
}
}
else
{
$error = 'You cannot send a PM to yourself.';
}
}
else
{
$error = 'The recipient of your PM doesn\'t exist.';
}
}
else
{
$error = 'A field is not filled.';
}
}
elseif(isset($_GET['recip']))
{
$orecip = $_GET['recip'];
}
if($form)
{
if(isset($error))
{
echo '<div class="message">'.$error.'</div>';
}
?>
<div class="col-md-5">
<form action="new_pm.php" method="post">
<div class="form-group">
<label for="recip">gebruikersnaam <small>(ontvanger)</small></label>
<input type="text" name="recip" class="form-control" id="recip" value="<?php echo htmlentities($orecip, ENT_QUOTES, 'UTF-8'); ?>">
</div>
<div class="form-group">
<label for="title">onderwerp</label>
<input type="text" name="title" class="form-control" id="title"value="<?php echo htmlentities($otitle, ENT_QUOTES, 'UTF-8'); ?>">
</div>
<div class="form-group">
<label for="message">bericht</label>
<textarea name="message" rows="10" cols="50" class="form-control" id="message"><?php echo htmlentities($omessage, ENT_QUOTES, 'UTF-8'); ?></textarea>
</div>
<input type="submit" value="Submit" class="btn btn-primary"/> <input type="button" onclick="javascript:document.location='http://web-stars.nl/account/list_pm.php';" value="terug" class="btn btn-default"/>
</div>
</form>
</div>
<?php
}
}
else
{
?>
<div class="message">You must be logged to access this page.</div>
<?php
}
?>
</div>
</body>
</html>