Jump to content

Recommended Posts

MySQL client version: 5.1.57

 

hi, I need help, look, I have shoutbox script and other login/reg/admin script, in the shout box there is fields to enter like name website and text. I need to delete field name( thats easy but) and replace that with egzisting fieled in table users (where is my log/reg/admin script table) the field name is username, and that when someones shout message, shoutbox shows the logged in name, and if they are not logged, dont let to write text message, it is a litle bit of sessions, the images, and php codes:

 

48066385.png

 

codes:

 

<?php
/******************************************************************************
* shoutbox 20.                                                           *
* Copyright (C) 2010 -  Predrag Rukavina - admin@phpform.net             *
* http://phpform.net/                                                   *
******************************************************************************/

/******************************************************************************
*  Any attempt to remove or alter "Powered by PHPForm.net" link will          *
*  automatically wave your rights to any use of shoutbox 20 software!         *
*                                                                             *
* This program is distributed in the hope that it will be useful,             *
* but WITHOUT ANY WARRANTY; without even the implied warranty of              *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
******************************************************************************/
// Smiley set taken from http://www.deviantart.com/
?>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> 
<script type="text/javascript">
function dispHandle(obj) 
{
if (obj.style.display == "none")
obj.style.display = "";
else
obj.style.display = "none";
}
</script>
<style type="text/css">
body{
font-size:13px;
font-family:"trebuchet ms";
color: #555; 
background-color: #fff;
}
.button{
background-color: #FA2;
background-image: url(../shoutbox/images/btnintro.png);
background-origin: padding-box;
border-bottom-color: #FA2;
border-bottom-left-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
border-bottom-style: solid;
border-bottom-width: 1px;
border-left-color: #FA2;
border-left-style: solid;
border-left-width: 1px;
border-right-color: #FA2;
border-right-style: solid;
border-right-width: 1px;
border-top-color: #FA2;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
border-top-style: solid;
border-top-width: 1px;
color: #333;
cursor: auto;
display: block;
font-family: Arial, sans-serif;
font-size: 17px;
font-style: normal;
font-variant: normal;
font-weight: bold;
height: 24px;
line-height: normal;
margin-top: 2px;
padding-bottom: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 1px;
text-align: center;
text-decoration: none;
text-shadow: #FE6 0px 1px 0px;
width: 178px;
}
#toprow {
width: 100%;
overflow:hidden;
background-color: lightyellow;
border-top: 1px solid #fff;
position: fixed; 
top: 0;
left: 0;
right: 0;
color:#000;
z-index: 1000;
font-size:10px;
opacity:0.6;
}
#cody{
font-size:12px;
font-family:"trebuchet ms";
color: #555; 
background-color: #fff;
}
#lody{
font-size:12px;
font-family:"trebuchet ms";
color: #555; 
background-color: #fff;
}
#sfeed {
width:185px;
border:#ccc solid 1px;
background:#fff url(../shoutbox/images/user.png) no-repeat top left;
padding-left:18px;
font-family:"trebuchet ms";
font-size:12px;
color:#555;
             }
#hfeed {
width:185px;
border:#ccc solid 1px;
background:#fff url(../shoutbox/images/house.png) no-repeat top left;
padding-left:18px;
font-family:"trebuchet ms";
font-size:12px;
color:#555;
             }
#lfeed {
width:185px;
border:#ccc solid 1px;
background:#fff url(../shoutbox/images/comment.png) no-repeat top left;
padding-left:18px;
font-family:"trebuchet ms";
font-size:11px;
color:#555;
             }
a {
color: #4A8EBC; 
background: inherit;
font-size:13px;
}
a:hover {
color: #C3593C;
background: inherit;	
}
  -->
</style>
</head>
<body>
<div style="background-color:#f8f8f8;margin-top:16px;border:1px solid #ccc;margin-bottom:8px;">
<center>
<img src="../shoutbox/images/logo.png">
<form action='../shout.php' method='post' name='form'>
<input type="text" id="sfeed" name="text" value="" title="Username"><br>
<input type="text" id="hfeed" name="home" value="" title="Home URL with http://"><br>
<textarea name="text1" id="lfeed" rows="2" title="Comment"></textarea><br>
<a onClick="addSmiley(' colly ')"><img src="<?php $root ?>/shoutbox/images/smiles1.png"></a> 
<a onClick="addSmiley(' greeny ')"><img src="<?php $root ?>/shoutbox/images/smiles2.png"></a>
<a onClick="addSmiley(' idimid ')"><img src="<?php $root ?>/shoutbox/images/smiles3.png"></a>
<a onClick="addSmiley(' smily ')"><img src="<?php $root ?>/shoutbox/images/smiles4.png"></a>
<a onClick="addSmiley(' bluey ')"><img src="<?php $root ?>/shoutbox/images/smiles5.png"></a>
<a onClick="addSmiley(' redy ')"><img src="<?php $root ?>/shoutbox/images/smiles6.png"></a><br>
<input type="submit" class="button" name="submit" value="shout"><br>
</form>
</center>
</div>
<script language="Java Script" type="text/javascript">
function addSmiley(textToAdd)
{
document.form.text1.value += textToAdd;
document.form.text1.focus();
}
</script>
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include ('shoutbox/menage/sett.php');
include ('shoutbox/menage/settings.php');
$resulty = mysql_query("SELECT commid, text, home, date, text1 FROM comment ORDER BY date DESC LIMIT $temp")
or die(mysql_error()); 
while($row=mysql_fetch_array($resulty)){
$cctext = $row['text'];
$cctext = stripslashes ($cctext);  
$cchome = $row['home'];
$ccdate = $row['date'];
if($cchome == true){
echo"<center><a href=\"$cchome\" target=\"_blank\" border=\"0\"><img src=\"../shoutbox/images/house.png\" title=\"$cchome\" border=\"0\"></a> ";
}else{
echo"<center><img style=\"opacity:0.6\" src=\"../shoutbox/images/house.png\" title=\"$cctext did not leave there web address\" border=\"0\"> ";
}
echo"<img src=\"../shoutbox/images/user.png\" border=\"0\" title=\"$cctext\"> ";
echo"<a onClick=\"addSmiley(' @$cctext ')\" title=\"Mention $cctext\"><b>$cctext</b></a>";
echo"<br> ";
echo $ccdate;
echo"</center><hr style=\"background-color: #e8e8e8; border: none;\" width=\"100%\" align=\"left\"></hr>";
echo" <img src=\"../shoutbox/images/comment.png\" border=\"0\">   ";
$message = $row['text1'];
$message = stripslashes ($message); 
$output = wordwrap($message, 25, ' ', 1); 
$a1 = '<img src="../shoutbox/images/smiles1.png">';
$a2 = '<img src="../shoutbox/images/smiles2.png">';
$a3 = '<img src="../shoutbox/images/smiles3.png">';
$a4 = '<img src="../shoutbox/images/smiles4.png">';
$a5 = '<img src="../shoutbox/images/smiles5.png">';
$a6 = '<img src="../shoutbox/images/smiles6.png">';
$a7 = '<img src="../shoutbox/images/smiles5.png">';
$a8 = '<img src="../shoutbox/images/smiles5.png">';
$a9 = '<img src="../shoutbox/images/smiles5.png">';
$a10 = '<img src="../shoutbox/images/smiles5.png">';
$a11 = '<img src="../shoutbox/images/fingerup.png">';
$a12 = '<img src="../shoutbox/images/fingerdown.png">';
$smiley = array('colly','greeny','idimid','smily','bluey','redy','href','http','fuck','porn','upfin','downfin');
$imgs = array("$a1","$a2","$a3","$a4","$a5","$a6","$a7","$a8","$a9","$a10","$a11","$a12");
echo str_replace ($smiley,$imgs,$output);
echo '<hr style="color:grey;" width="100%" align="left">';
}
echo '<center><a href="http://phpform.net" target="_blank"><font style="color:#a8a8a8;font-size:11px;">powered by phpform.net</font></a></center>';
if(isset($_POST['submit'])){
$text = $_POST['text'];
$text = addslashes ($text);
$home = $_POST['home'];
$text1 = $_POST['text1'];
$text1 = addslashes ($text1);
$name=array($text,$text1,$home);
foreach ($name as $name) 
{
if(preg_match("/%/", $name)) { 
echo "<center><div id=\"toprow\">Invalid Characters \"%\" </div>";
Die(); 
}
if(preg_match("/;/", $name)) { 
echo "<center><div id=\"toprow\">Invalid Characters \";\" </div>";
Die(); 
}
if(preg_match("/</", $name)) { 
echo "<center><div id=\"toprow\">Invalid Characters \"<\" HTML is not allowed"; 
Die(); 
}
if(preg_match("/\\[/", $name)) { 
echo "<center><div id=\"toprow\">Invalid Characters \"[\" BB code is not allowed"; 
Die(); 
}
}
if (strlen($text) < 4) {
echo "<center><div id=\"toprow\">The field must be at least 4 characters long.";    
Die();
}
if (strlen($text) > 45) {
echo "<center><div id=\"toprow\">Name. The field cannot contain more than 45 characters";
Die(); 
}
if (strlen($text1) < 4) {
echo "<center><div id=\"toprow\">The field must be at least 4 characters long.";    
Die();
}
if (strlen($text1) > 160) {
echo "<center><div id=\"toprow\">Comment. The field cannot contain more than 160 characters";
Die();  
}
if (strlen($home) > 80) {
echo "<center><div id=\"toprow\">URL. The field cannot contain more than 80 characters.";
Die();  
}
if (strlen($home) > 0) {
if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i",$home))
{
echo "<center><div id=\"toprow\">Invalid URL. Please try again or leave field blank";
Die();
}
}
echo "<center><div id=\"toprow\"><img src=\"../shoutbox/images/ajax-loader.gif\"></div><body style=\"opacity:0.2;\">";    
$result = mysql_query("INSERT INTO comment (text, home, date, text1)
VALUES ('$text','$home',NOW(),'$text1')")
or die(mysql_error());  
$asty = $_SERVER['HTTP_REFERER'];
?>
<script type="text/javascript">
<!--
function delayer(){
    window.location = "<?php echo $asty ?>"
}
//-->
</script>
<body onLoad="setTimeout('delayer()', 2000)">
<?php
}
?>

 

I think the code is something like that in that session.php, is the log/reg/admin script sessions settings. :)

include(".../login/include/session.php");
$session->username

 

I tryed:

That codes, tryed to google for about 23 pages, tryed other forums.

Link to comment
https://forums.phpfreaks.com/topic/243624-mysql-session-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.