Page 1 of 1
need help with some php code in my topsite
Posted: Thu May 22, 2003 8:29 pm
by metalhardscripts
hey i keep getting a few errors in my topsite i just setup i fixed some little bugs but theres one big bug i know nothing about the error is error one on admin page is
Warning: Use of undefined constant url - assumed 'url' in D:\Webserver\www.everything.32k.org\topsite\admin.php on line 22
it still shows the url but i get this error and right next to this is this error
Warning: Use of undefined constant mail - assumed 'mail' in D:\Webserver\www.everything.32k.org\topsite\admin.php on line 23
and this is the same it still shows the email but i get that error and after these it should show a check box and under that a save button but dont show them and dont say a error for them any help would be great thanks
Posted: Thu May 22, 2003 9:57 pm
by AVATAr
show us line 23 and 23
Posted: Thu May 22, 2003 10:12 pm
by Jim
An undefined constant is something like $variable that is.. well.. undefined.
Assumed : 'mail' means this:
$variable is read by PHP as
'$variable'
To get rid of those errors, you can turn error_reporting off

Posted: Fri May 23, 2003 2:13 am
by twigletmac
oh sorry heres the code
Posted: Fri May 23, 2003 6:26 pm
by metalhardscripts
Code: Select all
<?php
global $adminpass,$action;
include("design.php");
session_start();
IF($adminpass == $conf['admin_pass']) {
session_register('adminpass');
IF(!$action) {
design_topp();
$sql1 = "SELECT * FROM sites WHERE accepted = 'no'";
$res1 = mysql_query($sql1);
$sql2 = "SELECT * FROM sites WHERE accepted = 'yes'";
$res2 = mysql_query($sql2);
?>
<p><?=$lang['members_to_be_accepted']?>:</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
while ($out1 = mysql_fetch_array($res1))
{
?>
<tr>
<td><font size="2"><a href="http://<?=$out1[url]?>" target="_blank"><?=$out1[url]?></a></font></td>
<td><font size="2"><a href="mailto:<?=$out1[mail]?>"><?=$out1[mail]?></a></font></td>
<td><font size="2"><a href="admin.php?action=accept&id=<?=$out1[ID]?>"><?=$lang['accept']?></a></font></td>
<td><font size="2"><a href="admin.php?action=drop&id=<?=$out1[ID]?>"><?=$lang['drop']?></a></font></td>
</tr>
<?php } ?>
</table>
<p> </p>
<p><?=$lang['delete_or_admin_members']?>:</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php while($out2 = mysql_fetch_array($res2)) { ?>
<tr>
<td><font size="2"><a href="http://<?=$out2[url]?>" target="_blank"><?=$out2[url]?></a></font></td>
<td><font size="2"><a href="mailto:<?=$out2[mail]?>"><?=$out2[mail]?></a></font></td>
<td><font size="2"><a href="admin.php?action=delete&id=<?=$out2[ID]?>"><?=$lang['delete']?></a></font></td>
<td><font size="2"><a href="admin.php?action=edit&id=<?=$out2[ID]?>"><?=$lang['edit']?></a></font></td>
</tr>
<?php } ?>
</table>
<p> </p>
<?php
design_bunn();
}
elseif($action == "accept") {
$sql = "SELECT * FROM sites WHERE ID = $id";
$res = mysql_query($sql);
$ut = mysql_fetch_array($res);
mysql_query("UPDATE sites SET accepted = 'yes' WHERE ID = $id");
header("Location: admin.php");
}
elseif($action == "drop") {
mysql_query("DELETE FROM sites WHERE ID = $id");
header("Location: admin.php");
}
elseif($action == "delete") {
mysql_query("DELETE FROM sites WHERE ID = $id");
header("Location: admin.php");
}
elseif($action == "edit") {
$sql = "SELECT * FROM sites WHERE ID = $id";
$res = mysql_query($sql);
$out = mysql_fetch_array($res);
?>
<form name="form1" method="post" action="admin.php?action=save">
<input type="hidden" name="id" value="<?=$id?>">
<table width="386" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="115"><font size="2"><?=$lang['name']?></font></td>
<td width="385">
<input type="text" name="name" value="<?=$out[name]?>">
</td>
</tr>
<tr>
<td width="115"><font size="2"><?=$lang['url']?></font></td>
<td width="385">
<input type="text" name="url" value="http://<?=$out[url]?>">
</td>
</tr>
<tr>
<td width="115"> <font size="2"><?=$lang['title']?></font></td>
<td width="385">
<input type="text" name="title" value="<?=$out[title]?>">
</td>
</tr>
<tr>
<td width="115"><font size="2"><?=$lang['banner']?>(468x60)</font></td>
<td width="385">
<input type="text" name="banner" value="http://<?=$out[banner]?>">
</td>
</tr>
<tr>
<td width="115"> </td>
<td width="385">
<input type="submit" name="Submit" value="<?=$lang['save']?>">
</td>
</tr>
</table>
</form>
<?php
}
elseif($action == "save") {
$banner = eregi_replace("http://", "", $banner);
$url = eregi_replace("http://", "", $url);
mysql_query("UPDATE sites SET name = '$name', url = '$url', title = '$title', banner = '$banner' WHERE ID = $id");
header("Location: admin.php");
}
} // End of security
elseif($adminpass != $conf['admin_pass']) {
design_topp();
?><?=$lang['administration']?><br>
<form name="form1" method="post" action="admin.php">
<input type="password" name="adminpass">
<br>
<input type="submit" name="Submit" value="<?=$lang['login']?>">
</form>
<?php
design_bunn();
}
?>
mod_edit: Code: Select all
[/size]
theres the code i still dont get what ya guys mean if you can help me more it would be great
Posted: Fri May 23, 2003 7:06 pm
by volka
please visit the link Twigletmac gave you.
After you read the document compare
and
Code: Select all
<?=$lang['members_to_be_accepted']?>
(hint: note that the syntax highlighter marked
mail and
members_to_be_accepted with different colors)
thank you all very much i fixed it
Posted: Fri May 23, 2003 8:26 pm
by metalhardscripts
you all were great help i now see what i did wrong i had missed a few '' in the scripts now all pages work like they should come and check the up and working script at
http://www.everything.32k.org/topsite/ again thank you all