Jump to content

Need help with a Text MMORPG (Nearly done)


rofl90

Recommended Posts

but I just don't have the PHP knowldge for it all...

 

And you wont learn without trying either.

 

We have helped you. You need to ensure that the numbers you are deviding are not 0. We have also posted examples of how you can do this.

 

Another example.

 

<?php

 $a = 0;

 if ($a > 0) {
   $b = $a/4;
 } else {
   $b = 0;
 }

?>

 

I'll leave the rest up to you. We are not here to do the work for you.

Link to comment
Share on other sites

yeh now  need to do the first bit.. how to make a form which willend up in a special inbox which then mod and admins have choices on what do do and they can reply.. a bit like a mini advanced pms i've explained needed feaures in first post i can do form but i dont know ho handle it up to know i've never needed to send a form but to an email and replies... well i dot know nothing abou that plss help

Link to comment
Share on other sites

Look at my code here: http://www.phpfreaks.com/forums/index.php/topic,130341.msg546805.html#msg546805

 

Now tell me/us: What additions/changes was made from the original code here: http://www.phpfreaks.com/forums/index.php/topic,130341.msg546801.html#msg546801

 

Now you should be able to apply it again yourself.

 

It might help if I told you that the ?: syntax is called the ternary operator. More information here: http://php.net/operators.comparison

 

Basically,

$var = $something == "abc123" ? "hello" : "hi";

is the same as

if($something == "abc123")
{
$var = "hello";
}
else {
$var = "hi";
}

Link to comment
Share on other sites

i've explained needed feaures in first post

 

Sorry, but I think your missing the point of this board. We are not here to write tutorials or supply code. If your looking for someone to write code for you post your request in the freelance forum, this is not the place.

Link to comment
Share on other sites

Its very hard to follow what you are saying when you don't use punctuation, give us examples, or listen to what we are saying. I think if you took some time to really respond to what Thorpe has been asking you, you would get some positive results.

 

Patience. We are here to help you if you just slow down and take your time with posting code and examples. If you have a new issue, we will deal with that, but lets do one at a time.

Link to comment
Share on other sites

I've had the 2nd issue resolved but the first has been overlooked i've tried to alter the PMS but it seems you have to have choice of who recieves it so a random user could recieve a call for help also when a mod (if the user issue was resolved) gets the pm they won't have a choice about what to do other than reply.

Apologies for punctuation, missing letters, missing spaces, RUBBISH KEYBOARD!

Thanks in advance

Link to comment
Share on other sites

report:

<?php
ob_start(); //Allow cookies
session_start(); //allow sessions
include("config.php"); //get config file
switch($_GET[act]){ //change links to ?act=
default: //Make this our default page.
if($logged[username] && !$_POST[report]){ //check if they are logged in
echo "
<form method=\"post\" action=\"index.php?x=Report&act=Do\">
<b>Username</b>:<br />
<input type=\"text\" name=\"user\" size=\"15\"><br />
<b>Reason</b>:<br />
<textarea cols=\"35\" rows=\"5\" name=\"reason\"></textarea><br />
<input type=\"submit\" name=\"report\" value=\"Report User\">
</form>
"; //Echo the form
}elseif(!$logged[username] && !$_POST[report]){ //If Not Logged in
echo "<b>Error</b>: You Are Not Logged In"; //Echo Error
} //End Else If
break; //End the page

case 'Do': //Make the Go case.
if($logged[username] && $_POST[report]){ //Check if they are logged in and the form is submitted
$user = stripslashes(htmlspecialchars($_POST[user])); //User Variable
$reason = stripslashes(addslashes(htmlspecialchars($_POST[reason]))); //Reason Variable
$date = date("l, F d, Y");
$errs = array(); //Make An Array
if(empty($user)){
$errs[] = "<b>Error</b>: You Must Enter A Username<br />"; //echo error
}//end
if(empty($reason)){ //if reason is empty
$errs[] = "<b>Error</b>: You Must Enter A Reason<br />"; //echo error
} //End
if(count($errs) > 1){ //If there are more than 1 errors
foreach($errs as $oops){ //Count them up
echo "$oops"; //Echo Errors
}
}else{
$report = mysql_query("INSERT INTO reps(`username`,`reason`,`date`,`reported_by`) VALUES ('$user','$reason','$date','$logged[username]')") or die(mysql_error()); //do the query or die with an error
echo "$user Has Been Reported."; //Echo Error
} //End the queryness
}elseif($logged[username] && !$_POST[report]){ //If logged in but form not submitted
echo "<b>Error</b>: You Must Go Back And Submit The Form"; //Echo error
}elseif(!$logged[username] && !$_POST[report]){ //If not loged in and no form
echo "<b>Error</b>: You Are Not Logged In"; //Echo Error
}//End check login
break; //End The Page
} //End switch get
?>

and admin cp

<?php
ob_start(); //Allow cookies
session_start(); //allow sessions
include("config.php"); //get config file
switch($_GET[x]){ // Make Links ?x=case
default: // set default case
if(!$logged[username] || $logged[level] !== 5){ //check if they are logged in and an admin
echo "<b>Error</b>: You Are Either Not Logged In Or You Are Not An Admin"; //they are not
}else{ //or if they are
$get = mysql_query("SELECT * FROM reps") or die(mysql_error()); //get all reports
$gnum = mysql_num_rows($get); //get how many there are
if($gnum == 0){ //check if there are any
echo "<b>Error</b>: There Are No Reports To Review"; //if not...
}else{ // or if there are
echo "There Are Currently $gnum Reports To Review"; //Yay there are some
while($ec = mysql_fetch_array($get)){ //repeats the data
echo "<table width='150' align='center'>
<tr>
<td width='150' align='center' valign='top'>
<b>$ec[user]</b><br />
 <b>Reported By:</b>: $ec[by]
</td>
</tr>
<tr>
<td width='200' colspan='2' align='center' valign='top'>
<p>$ec[reason]</p>
</td>
</tr>
<tr>
<td width='350' colspan='3' align='center' valign='top'>
<b>Date Reported</b>: $ec[date] | <a href='repcp.php?x=warn&y=$ec[user]'>Warn User</a> | <a href='repcp.php?x=delete&id=$ec[id]'>Delete</a>
</td>
</tr>
</table>"; //echo the report
} //End: the while
} //End: check if there are reports or not
} //End: level check
break; //end the default case
case 'warn': //the warn area 
if(!$logged[username] || $logged[level] !== 5){ //check if logged in and admin
echo "<b>Error</b>: You Are Either Not Logged In Or You Are Not An Admin"; //echo this
}else{ //or do other things
if(!$_GET[y]){ //check if theres a user selected
echo "<b>Error</b>: No User Selected"; //if not
}else{ //or do other things
if(!$_POST[warn]){ //check if the form was submitted or not
echo "<form method='post'>
<b>Username</b>:<br />
<input type='text' name='user' value='$_GET[y]' readonly='readonly'><Br />
<b>Warn Reason</b>:<Br />
<textarea rows='5' cols='35' name='reason'></textarea><br />
<input type='submit' name='warn' value='Warn $_GET[y]'>
</form>"; //Echo The Form
}else{ //the form was submitted...
$user = strip_tags(stripslashes($_POST[user]));
$reason = stripslashes(strip_tags($_POST[reason]));
$date = date("l, F d, Y");
mysql_query("INSERT INTO warnings (`user`,`reason`,`from`,`date`) VALUES ('$user','$reason','$logged[username]','$date')") or die(mysql_error()); //mysql query to insert or die
echo "$user Has Been Warned"; //Echo this if success
} //End: check if form was submitted
} //End: check if user is selected
} //End: check if logged in and an admin
break; //End warn case
case 'delete': //delete case
if(!$Logged[username] || $logged[level] !== 5){ //check if logged in and an admin
echo "<b>Error</b>: You Are Either Not Logged In Or You Are Not An Admin"; //error
}else{ //or do this
if(!$_GET[id]){ //check if user/report was selected
echo "<b>Error</b>: No Report Was Selected To Delete"; //if not echo this
}else{ //or do the following
mysql_query("DELETE FROM reps WHERE id = '$_GET[id]'") or die(mysql_error()); //delete the report
echo "Report Deleted"; //echo this
} //End: check if id selected
} //end: login and admin check
break; //end delete case
} //end switch and get
?>

??????

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.