Dethman Posted January 14, 2008 Share Posted January 14, 2008 I keep getting this error when I try to do the inviteName Function Fatal error: Call to undefined function: invitename() in /home2/gt/public_html/managealliance.php on line 30 <?php //start title $pagetitle="Alliance Control"; //end title require("db_connect.php"); require("functions/global.php"); require("functions/alliance.php"); if( isset($_SESSION['userid']) ){ $user=getUserInfo($_SESSION['userid']); $race=getUserRace($user); $memberlist=getPending($user['aid']); } else { header("Location: index.php"); } if(($user['aid']!='')&&($user['arank']==2)){ $alliance=getAlliance($user['aid']); }else{ header("Location: base.php"); } if($_POST['name2']){ updateName($_POST['name'],$user['aid']); } if($_POST['site2']){ updateSite($_POST['site'],$user['aid']); } if($_POST['desc2']){ updateDesc($_POST['desc'],$user['aid']); } if($_POST['invite2']){ inviteName($_POST['invite'],$user['aid']); } if($_POST['aprove']){ $id=$_POST['id']; member(1,$id); } if($_POST['decline']){ $id=$_POST['id']; member(2,$id); } if($_POST['allow2']){ $allow=$_POST['allow']; $q="UPDATE `alliance_details` SET `allowNew` = '".$allow."' WHERE `aid` = '".$user['aid']."'"; mysql_query($q) or die("SQL eror: ".mysql_error()); header("Location: managealliance.php?strErr=allowing new members toggled"); } if($_POST['invite2']){ $invite=$_POST['invite']; $q="INSERT INTO `user_pm` (`mid`,`fromid`,`toid`,`subject`,`message`,`date`) VALUES ('','".$user['userid']."','".$invite."','Alliance Invite','you have been invited to join the alliance ".$alliance['aName']." go to this link here to join http://stargaterealms.com/joina.php?i=".md5($user['aid'])."','".(time())."')"; mysql_query($q); header("Location: managealliance.php?strErr=invite sent"); } $msg=$_GET['strErr']; include("includes/header.php"); ?> <html> <head> </head> <body> <center><Table width=100% cellspacing=1 cellpadding=5> <tr> <td width=15% valign=top><?php include("includes/navi.php"); ?></td><td valign=top> <?php print $msg."<br>"; ?> <form name="form1" method="post" action=""> <table width="100%" border="0" cellspacing="1" cellpadding="5" class="table_lines"> <tr> <td><b>Manage <?php print($alliance['aName']); ?> Alliance </b></td> </tr> <tr> <td>Name: <input name="name" type="text" id="name" value="<?php print($alliance['aName']); ?>"> <input name="name2" type="submit" id="name2" value="Update Name"></td> </tr> <tr> <td>Site: http:// <input name="site" type="text" id="site" value="<?php print($alliance['aSite']); ?>"> <input name="site2" type="submit" id="site2" value="Update Site"></td> </tr> <tr> <td>Dont Allow New Members? check for no new members: <input name="allow" type="checkbox" id="allow" value="1" <?php if($alliance['allowNew']==1){ print("checked"); }?>> <input name="allow2" type="submit" id="allow2" value="Update"></td> </tr> <tr> <td>Description: <textarea name="desc" id="desc"><?php print($alliance['aDesc']); ?></textarea> <input name="desc2" type="submit" id="desc2" value="Update Description"></td> </tr> <tr> <td>Invite User (ID only!) : <input name="invite" type="text" id="invite"> <input name="invite2" type="submit" id="invite2" value="Invite User"></td> </tr> </table> </form><table width="100%" border="0" cellspacing="1" cellpadding="5" class="table_lines"> <tr> <td><b>Username</b></td> <td><b><div align="center">Rank</div></b></td> <td><b><div align="center">Approve Membership </div></b></td> <td><b><div align="center">Decline Membership </div></b></td> </tr> <?php print($memberlist); ?> </table> <h2> </h2></td> </tr></Table><br> <?php include("includes/bottom.php"); ?> </center> </body> </html> here is the function/alliance.php code <?php function vDate($time){ $timenow=time(); $timenow=date ("M d, Y",$timenow); $time1=date ("M d, Y",$time); if ($timenow==$time1){ $time1=date ("H:i",$time); } return $time1; } function getUserRace2($user){ $q="SELECT * FROM `race_details` WHERE `raceID` = '".$user['raceID']."'"; $v=mysql_query($q); $r=mysql_fetch_array($v); return $r['raceName']; } function getList($aid){ $q="SELECT * FROM `user_users` WHERE `aid` = '".$aid."' ORDER BY `overallRank` ASC"; $v=mysql_query($q); while($row=mysql_fetch_array($v)){ $race=getUserRace2($row); $page.=" <tr> <Td>".$row['username']."</td> <Td>".$row['overallRank']."</td> <Td>".$race."</td> <Td>".vDate($row['datejoined'])."</td> </tr> "; } $count=mysql_num_rows($v); if($count==0){ $page="<Tr><td colspan=4 align=center><b><i>This Alliance Does Not Exist</i></b></td></tr>"; } return $page; } function getAlliance($aid){ $q="SELECT * FROM `alliance_details` WHERE `aid` = '".$aid."'"; $v=mysql_query($q); $a=mysql_fetch_array($v); return $a; } function dispandAlliance($aid){ $q="DELETE FROM `alliance_details` WHERE `aid` = '$aid'"; mysql_query($q); $q="UPDATE `user_users` SET `aid` = '',`arank` = '' WHERE `aid` = '$aid'"; mysql_query($q); header("Location: base.php?strErr=You Alliance Has Been Dispanded"); } function leaveAlliance($id){ $q="UPDATE `user_users` SET `aid` = '',`arank` = '' WHERE `userid` = '$id'"; mysql_query($q); header("Location: base.php?strErr=You Have Left Your Alliance"); } function updateName($var,$id){ $q="SELECT * FROM `alliance_details` WHERE `aName` = '$var'"; $v=mysql_query($q); $count=mysql_num_rows($v); if($count==0){ mysql_query("UPDATE `alliance_details` SET `aName` = '$var' WHERE `aid` = '$id'") or die("SQL Error: ".mysql_error()); header("Location: managealliance.php?strErr=Alliance Name Changed"); }else{ header("Location: managealliance.php?strErr=Alliance Name In Use"); } } function updateSite($var,$id){ mysql_query("UPDATE `alliance_details` SET `aSite` = '$var' WHERE `aid` = '$id'") or die("SQL Error: ".mysql_error()); header("Location: managealliance.php?strErr=Alliance Site Changed"); } function updateDesc($var,$id){ mysql_query("UPDATE `alliance_details` SET `aDesc` = '$var' WHERE `aid` = '$id'") or die("SQL Error: ".mysql_error()); header("Location: managealliance.php?strErr=Alliance Description Changed"); } function getPending($aid){ $q="SELECT * FROM `user_users` WHERE `aid` = '$aid' AND `arank` = 0"; $v=mysql_query($q) or die("SQL Error: ".mysql_error()); $rowcount=mysql_num_rows($v); if($rowcount==0){ $page="<tr><Td colspan=4 align=center><i>No Users Pending To Join</i></td></tr>"; return $page; }else{ while($row=mysql_fetch_array($v)){ $i+=1; $page.=" <tr> <Td><A href=stat.php?id=".$row['userid'].">".$row['username']."</a></td> <td>".number_format($row['overallRank'])."</td> <form name=aprove".$i." method=POST action=''><Td><input type=hidden value='".$row['userid']."' name=id id=id><input type=submit name=aprove id=aprove value='Accept Member'></td></form> <form name=decline".$i." method=POST action=''><td><input type=hidden value='".$row['userid']."' name=id id=id><input type=submit name=decline id=decline value='Decline Member'></td></form> </tr> "; } return $page; } } function member($type,$id){ if($type==1){ $q="UPDATE `user_users` SET `arank` = 1 WHERE `userid` = '$id'"; mysql_query($q); }else{ $q="UPDATE `user_users` SET `aid` = 0 WHERE `userid` = '$id'"; mysql_query($q); } header("Location: managealliance.php?strErr=Membership Aproved/Declined"); } function getAlliances($pageNum){ $offset = ($pageNum-1) * 50; $offset2=$pageNum*$rowsPerPage; $q="SELECT * FROM `alliance_details` LIMIT $offset, 50"; $v=mysql_query($q) or die("SQL error: ".mysql_error()); $rowcount=mysql_num_rows($v); if($rowcount==0){ $page="<tr><Td colspan=7 align=center><b><i>There Are No Alliances Created Yet In This Range</i></b></td></tr>"; return $page; }else{ while($row=mysql_fetch_array($v)){ $q1="SELECT * FROM `user_users` WHERE `userid` = '".$_SESSION['userid']."'"; $v2=mysql_query($q1); $user=mysql_fetch_array($v2); if(($user['aid']!=0)||($row['allowNew']!=1)){ $btn="Unavailable"; }else{ $btn=" <input type=hidden name=aid id=aid value=".$row['aid']."> <input type=submit name=join id=join value='Request Membership'>"; } $i+=1; $qt="SELECT * FROM `user_users` WHERE `aid` = '".$row['aid']."' AND `arank` = '2'"; $vt=mysql_query($qt); $t=mysql_fetch_array($vt); $qt="SELECT * FROM `user_users` WHERE `aid` = '".$row['aid']."' AND `arank` > '0'"; $vt=mysql_query($qt); $count=mysql_num_rows($vt); if($row['allowNew']==0){ $allow="Open"; }else{ $allow="Closed"; } $page.=" <tr><td>".$row['aName']."</td> <td><a href='stats.php?id=".$t['userid']."'>".$t['username']."</a></td> <td><font size=-1>".$row['aDesc']."</font></td> <td><a href='a_members.php?aid=".$row['aid']."'>".number_format($count)."</a></td> <td>unkown</td> <td>".$allow."</td> <form name=join".$i." method=POST action=''><td>".$btn."</td></form> </tr> "; } return $page; } } ?> Quote Link to comment Share on other sites More sharing options...
interpim Posted January 14, 2008 Share Posted January 14, 2008 I don't see the invitename() function anywhere in your code... if you want to use that function you have to declare it and build it first. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.