Jump to content

[SOLVED] Fixing My Admin File for My Shout Box


FortMyersDrew

Recommended Posts

header('Refresh:2;admin.php');

exit();

 

thats the error you cant echo anything on top of headers in your part you have alot of echo and the html are being displayed any comment that first or remove then tell me wat happen

Link to comment
Share on other sites

header('Refresh:2;admin.php');

exit();

 

thats the error you cant echo anything on top of headers in your part you have alot of echo and the html are being displayed any way comment that first or remove then tell me wat happen

 

remove this first then you will then youll find the answer

header('Refresh:2;admin.php');

exit();

 

brf explntion when the header execute theres should be output on the screen or i said echo and output through html

Link to comment
Share on other sites

Also is there a way to clear ALL shouts at once?

 

Sheesh I must be annoying also I found a glitch in the coding.

If you type one long word like AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

You can keep doing this and it shows up all over the screen. is there a way to set a character limit per word?

Link to comment
Share on other sites

i dont understand butis this wat you mean

 

switch($cmd)

{

case 'delete':

$sql = "DELETE FROM shoutbox WHERE id=".$idg."";

$result = mysql_query($sql);

header('Refresh:2;admin.php');

exit();

break;

default:

$result = mysql_query("select * from shoutbox order by id desc");

while($r=mysql_fetch_array($result))

{

$name=$r["name"];

$message=$r["message"];

$time=$r["time"];

$id=$r["id"];

echo "Shout by: ".$name." <strong>@</strong> ".$time."

".$message."

<a href='?cmd=delete&id=".$id."'>Delete me[/url]

 

";

}

break;

}

 

any way that the right way

Link to comment
Share on other sites

<?php

session_start();

//Get the cmd variable

$cmd=$_GET['cmd'];

$idg=$_GET['id'];

//include config.php

include 'config.php';

//get the username from the form and add some security

//so you cant get hacked so easy

$username = mysql_real_escape_string(strip_tags(htmlspecialchars($_POST['username'])));

$password = md5($_POST['password']);

//if login button is pressed

if ($_POST['login']){

//check if username and password are inserted

if((!$username) || (!$password)){

//if not tell them to...do insert all of info

//echo "Please enter both values";

}

//when they have we check if the username and the password exists

$sql = mysql_query("SELECT * FROM `shoutbox_admin` WHERE `name` = '$username' AND `password`= '$password'") OR die(mysql_error());

//so we need to check it for real

//mysql_num_rows() counts the rows which are returned as true

$login_check = mysql_num_rows($sql);

//if the check is true....true = 1 and $login check is set as $login_check=1

if($login_check > 0){

//so if it is larger than 1 we set some session variables -

//username and id

$r=mysql_fetch_array($sql);

$_SESSION['id'] = $r['id'];

$_SESSION['username'] = $r['name'];

//if it's not let's make him suffer...moahahahaa...

//reload the page I mean..

}else {

header("Refresh:2;admin.php");

exit();

}

}

//so if session username isn't set show user the login form

if(!isset($_SESSION['username'])){

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<title>ACP</title>

</head>

<body>

<center>

<form action='<?=$_SERVER['PHP_SELF']?>' method='POST'>

Username: <input type='text' size='15' name='username'>

 

Password: <input type='password' size='15' name='password'>

 

<input name="login" type="submit" value="Submit">

</form></center>

<? }

//if not - show him the contents and stuff...else{

else{

//welcome message and logout link...

echo "<center>Welcome, ". $_SESSION['username'] ."! <a href='logout.php'>Log Out[/url]</center>";

echo "

 

<center>";

//see my ?id= browsing tutorial to understand switch()

switch($cmd)

{

case 'delete':

$sql = "DELETE FROM shoutbox WHERE id=".$idg."";

$result = mysql_query($sql);

header('Refresh:2;admin.php');

exit();

break;

default:

$result = mysql_query("select * from shoutbox order by id desc");

while($r=mysql_fetch_array($result))

{

$name=$r["name"];

$message=$r["message"];

$time=$r["time"];

$id=$r["id"];

echo "Shout by: ".$name." <strong>@</strong> ".$time."

".$message."

<a href='?cmd=delete&id=".$id."'>Delete me[/url]

 

";

}

break;

}

}

?>

 

 

 

Link to comment
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.