
strategos
Members-
Posts
28 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
strategos's Achievements

Member (2/5)
0
Reputation
-
I don't know if this can be done in PHP, but what I'm wanting to do is calculate the amount of time a user has spent in a session. I am planning on making a script that allows users to race through questions and the person who does it the fastest is the winner. Could someone help me out with this? Thanks
-
Thank's for your quick replies. Ok I get it now. I can declare the function as a variable. That works too <?php function checkname() { if($_SESSION['name'] == '') { return false; } elseif(isset($_POST['cont']) && $_SESSION['name'] != '') { return true; } } $t = checkname(); var_dump($t); ?>
-
Hello, I am trying to define some variables in a function, but the variable just returns null no matter what I do. Could someone please tell me what I'm doing wrong? <?php function checkname() { global $t; if($_SESSION['name'] == '') { return false; $t = false; } elseif(isset($_POST['cont']) && $_SESSION['name'] != '') { return true; $t = true; } } var_dump($t); // returns NULL upon correct or incorrect submit. ?>
-
Ok, how would I convert that into a string? I tried using implode('', $curbans); All I get is an error.
-
Hello, I am a bit confused on the preg_match subject. here is a snippet where I use the preg_match func: <?php foreach ($bans as $ban){ $curbans = $ban["user_steamid"]; if(isset($_POST['submit2'])) { $_SESSION['isbanned'] = preg_match('/'.$_SESSION['inputid'].'/i', $curbans) } }; ?> The array, $curbans, looks like this STEAM_0:1:25941882STEAM_0:1:37863673STEAM_0:0:49096012STEAM_0:0:31113930 How would I get it to match something like "STEAM_0:0:49096012" with a value in the array?
-
Thanks for the reply. However, I decided to do it the hard way and have it download a bans.txt every 10 minutes via cron. Same effect, just slightly delayed. Thanks
-
Hello, this script originally works by reading a physical copy of 'bans.txt' located in the same directory. How could I get it to read the remote bans.txt located here and parse info from it like the on-site copy? the remote file: http://108.163.211.219/bans.txt <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Data Tables and Cascading Style Sheets Gallery</title> <style>/* Tema: Soft Table - A Simple table style with the use of the soft brown color Author: Newton de G?es Horta Site: -- Country Origin: Brazil */ table { font-size:0.9em; font-family: Arial, Helvetica, verdana sans-serif; background-color:#fff; border-collapse: collapse; width: 100%; } caption { font-size: 25px; color: #1ba6b2; font-weight: bold; text-align: left; background: url(http://www.nghorta.com/csstg/header_bg.jpg) no-repeat top left; padding: 10px; margin-bottom: 2px; } thead th { border-right: 1px solid #fff; color:#fff; text-align:center; padding:2px; text-transform:uppercase; height:25px; background-color: #a3c159; font-weight: normal; } tfoot { color:#1ba6b2; padding:2px; text-transform:uppercase; font-size:1.2em; font-weigth: bold; margin-top:6px; border-top: 6px solid #e9f7f6; } tbody tr { background-color:#fff; border-bottom: 1px solid #f0f0f0; } tbody td { color:#414141; padding:5px; text-align:left; } tbody th { text-align:left; padding:2px; } tbody td a, tbody th a { color:#6C8C37; text-decoration:none; font-weight:normal; display:block; background: transparent url(http://www.nghorta.com/csstg/links_yellow.gif) no-repeat 0% 50%; padding-left:15px; } tbody td a:hover, tbody th a:hover { color:#009193; text-decoration:none; } /* tr:nth-child(even) { background-color: grey; } */ </style></head> <body> <table summary="Submitted table designs"> <thead><tr> <th style="font-size:12px" scope="col"><center>Nickname</center></th> <th style="font-size:12px" scope="col"><center>Admin</center></th> <th style="font-size:12px" scope="col"><center>Banned</center></th> <th style="font-size:12px" scope="col"><center>Reason</center></th> <th style="font-size:12px" scope="col"><center>SteamID</center></th> <th style="font-size:12px" scope="col"><center>Length</center></th> <th style="font-size:12px" scope="col"><center>Status</center></th> </tr></thead> <tbody> <!-- <tr><th scope="row" id="r100"><a href="100.php">rows table template</a></th> <td><a href="http://www.adobati.it">Omar '0m4r' Adobati</a></td><td>Italy</td> <td>Simple, clean and a quite classic table template </td> <td><a href="http://www.adobati.it/labs/CSSTable/0m4r.table.css" title="Download the rows table template CSS file">Download</a></td> <td>test</td> <td>test2</td> </tr> --> <?php // Credits to justin as he was able to understand my messy PHP code and do this much better code for me. function buildBanList($arr) { $filename = "bans.txt"; $bans = array(); $tmp_array = array(); // Build Ban Array if (file_exists($filename)) { foreach( $arr as $line ) { if( substr(trim($line), 0, 7) == '"STEAM_' ) { $tmp_array["user_steamid"] = str_replace('"', '', trim($line)); } if( substr(trim($line), 0, 6) == '"time"' ) { $tmp = explode(' ', trim($line)); $tmp_array["user_bantime"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, 15) == '"modified_time"' ) { $tmp = explode(' ', trim($line)); $tmp_array["user_modified"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, 7) == '"unban"' ) { $tmp = explode(' ', trim($line)); $tmp_array["user_unban"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, 7) == '"admin"' ) { $tmp = explode('" "', trim($line)); $tmp2 = explode('(', $tmp[1]); $tmp_array["admin_name"] = str_replace('"', '', $tmp2[0]); } if( substr(trim($line), 0, 6) == '"name"' ) { $tmp = explode('" "', trim($line)); $tmp_array["user_name"] = str_replace('"', '', $tmp[1]); } if( substr(trim($line), 0, == '"reason"' ) { $tmp = explode('" "', trim($line)); $tmp_array["user_reason"] = str_replace('"', '', $tmp[1]); } // Save ban record to main array once detected end. if( substr(trim($line), 0, 1) == '}' ) { // If console ban then set required fields. if( $tmp_array["admin_name"] == "") $tmp_array["admin_name"] = "Console"; array_push($bans, $tmp_array); $tmp_array = array(); } } } //Sort Array by Ban Date $tmp = array(); foreach($bans as &$ma) $tmp[] = &$ma["user_bantime"]; array_multisort($tmp, SORT_DESC, $bans); return $bans; } //Begin Presentation $file = file("./bans.txt"); date_default_timezone_set("Europe/London"); $bans = buildBanList($file); foreach ($bans as $ban) { echo '<tr> '; // Output if ($ban["user_name"] != '') echo '<td style="text-align:center; font-size: 12px">'.$ban["user_name"].'</td><td style="text-align:center; font-size: 12px" class="admin">'; else echo '<td style="text-align:center; font-size: 12px"><span style="color:#FF0000">N/A</span></td><td style="text-align:center; font-size: 12px" class="admin">'; echo $ban["admin_name"].'</td><td style="text-align:center; font-size: 12px">'.date('H:i - d/m/y',$ban["user_bantime"]).'</td>'; /* Unban date. if ($ban["user_unban"] != "0") { echo date('H:i - d/m/y',$ban["user_unban"]); } else { echo "Never"; }*/ echo '<td style="text-align:left; font-size: 11px">'.$ban["user_reason"].'</td>'; // Status $today = strtotime("now"); echo '</td><td style="text-align:center; font-size: 12px">'.$ban["user_steamid"].' </td>'; // Ban Length $date1 = date('y-m-d H:i:s',$ban["user_bantime"]); $date2 = date('y-m-d H:i:s',$ban["user_unban"]); $to_time=strtotime($date1); $from_time=strtotime($date2); $ban_length = round(abs($to_time - $from_time) / 60,0); if ($ban["user_unban"] != "0") { // Days if ($ban_length >= 1440) { $ban_length = round(abs($to_time - $from_time) / 24 / 60 / 60,0); // Years couldn't be arsed to think of another way to do it. if ( $ban_length >= 365 ) { $ban_length = round(abs($to_time - $from_time) / 360 / 24 / 60 / 60,0); if ($bans_length > 1) echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Years </td>"; else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Year </td>"; } else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Days </td>"; } // Hours else if ($bans_length >= 60) { $ban_length = round(abs($to_time - $from_time) / 60 / 60,0); if ($bans_length > 1) echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Hours </td>"; else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Hour </td>"; } else echo "<td style=\"text-align:center; font-size: 12px\">".$ban_length." Minutes </td>"; } else { echo "<td style=\"text-align:center; font-size: 12px\">Permanent</td>"; } if ($ban["user_unban"] == "0") echo '<td style="text-align:center; font-size: 12px"><span style="color:#FF0000">Banned</span></td>'; else if ( $today > $ban["user_unban"] ) echo '<td style="text-align:center; font-size: 12px"><span style="color:#008000">Expired</span></td>'; else echo '<td style="text-align:center; font-size: 12px"><span style="color:#FF0000">Banned</span></td>'; echo '</tr>'; } ?></table> <center><p>Web-based ULX bans by Russy.</p></center> </div> </body> </html> I've tried experimenting w/ stuff like $filename = "http://108.163.211.219/bans.txt"; $contents = file_get_contents($filename); but it doesn't seem to want to work.
-
The ban data is the first example where the code is not highlighted. It is in a .txt file on a remote server. I want to import that data. I can't change the format of the ban file, because that's how the administration system is designed to interpret it. I want to save key details from the data to a mysql table, but right now I just want to focus on being able to capture the data.
-
Hello, I am new to PHP and am trying to make a script that will ftp into the server via a cron of every hour or so and save the data to a mysql table. The first step is to draw variables out of information in the file via ftp. Its a ban list for a game server I run. How could I get php to single out the ban reason, admin, etc. the looks like this "STEAM_0:0:42741441" { "name" "good mom" "unban" "0" "time" "1329161245" "admin" "(Console)" "reason" "no more trolling for you" } "STEAM_0:1:40563669" { "unban" "0" "admin" "Headcrap(STEAM_0:1:42287608)" "time" "1332855999" "reason" "" } "STEAM_0:1:17693550" { "name" "ʎɖɑɱ" "time" "1323055427" "modified_time" "1323221308" "unban" "0" "modified_admin" "Strategos(STEAM_0:0:26662109)" "admin" "Strategos(STEAM_0:0:26662109)" "reason" "And so died the trolling" } Example: <?php $bannedid = "STEAM_0:0:42741441"; $bannedby "(console)"; // and so on ?>
-
I have tried using a session var, but the result is the same. Here is the code (I know its inefficient; its my first script) <?php session_start(); $amount = $_POST['amount']; $cents = $_POST['coins']; $agree = $_POST['confcheck']; // Steam Donation System by Strategos if (isset($_COOKIE['FormSubmitted']) && !isset($_POST['confirm'])){ die(' <html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="english" id="vbulletin_html"> <head> <title>Donation Title</title> <link rel="stylesheet" href="css/structure.css" type="text/css" /> <link rel="stylesheet" href="css/form.css" type="text/css" /> <link rel="stylesheet" href="css/button.css" type="text/css" /> <!--[if lt IE 10]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body style="margin-top:20%; margin-bottom:20%;"> <div id="container" class="ltr"> <h1 id="logo"> STG </h1><br><center><h3>You just submitted a form. Please wait 5 seconds before trying again.</h3></center> <center><a href="check.php">Try Again</a></center><br> </div><!--container--> </body> </html>'); } // Checks if qualifies for benefits if($total >= 5){ $donator_qual = true; } //* // Begin Processing $inputid = $_POST['steamid']; $steam_prefix = substr($inputid, 0, 10); $prefix_length = 10; $char_total = strlen($inputid); $amount_chars = strlen($amount); $steam_suffixchars = ($char_total - $prefix_length); $suffix_check = substr($inputid, 10, $steam_suffixchars); $class_set = "notranslate"; $class_set2 = "notranslate"; $error_set = "hidden"; $coin_chars = strlen($cents); $errordiv_p = ""; if(is_numeric($suffix_check) == true) $suffix_valid = true; elseif(is_int($suffix_check) == false) $suffix_valid = false; if($char_total > 25 || $char_total < 11) $char_valid = false; else $char_valid = true; if($steam_prefix === "STEAM_0:1:" || $steam_prefix === "STEAM_0:0:") $prefix_check = true; elseif($steam_prefix != "STEAM_0:1:" || $steam_prefix != "STEAM_0:0:") $prefix_check = false; if (preg_match('/^[A-Z0-9-:]+$/', $inputid)) $chars_matched = true; else $chars_matched = false; $inputid = $_POST['steamid']; if (preg_match('/^[0-9-]+$/', $cents) && $cents >= 0 && $cents <= 99 && $coin_chars == 2) $coin_check = true; else $coin_check = false; if (preg_match('/^[0-9-]+$/', $amount) && $amount >= 0) $amount_check = true; else $amount_check = false; if ($amount == 0 && $cents == 0) $iszero = true; else $iszero = false; if (isset($_POST['submit'])) { if($suffix_check == true && $prefix_check == true && $char_valid == true && $chars_matched == true && $amount_check == true && $coin_check == true && $iszero == false){ $part1 = true; } elseif(isset($_POST['anon'])){ $part2 = true; $inputid = ""; } elseif($suffix_check == false || $prefix_check == false || $char_valid == false || $chars_matched == false){ $class_set = "notranslate error"; $errordiv_p = '<p style="text-align: center; background: #FFDFDF !important; padding-top: 4px; color:red; border-style:solid; border-width:1px; padding-bottom: 7px;"> <b>Error:</b> There is an error with the highlighted field(s)</p>'; $error_set = ""; } if($amount_check == false || $coin_check == false || $iszero == true){ $class_set2 = "notranslate error"; $errordiv_p = '<p style="text-align: center; background: #FFDFDF !important; padding-top: 4px; color:red; border-style:solid; border-width:1px; padding-bottom: 7px;"> <b>Error:</b> There is an error with the highlighted field(s)</p>'; $error_set = ""; } } if($part1 == true || $part2 == true && $amount_check == true && $coin_check == true && $iszero == false || isset($_POST['confirm'])){ setcookie('FormSubmitted', '1', time()+10); // STEAM ID CONVERSION $X = substr($inputid, 6, 1); $Y = substr($inputid, 8, 1); $c_id = (($suffix_check * 2) + $X + $Y + 76561197960265728); //* // RANK DONATION if($inputid != ""){ $steamid_div = '<div id="radio" name="hide"> <li id="foli111" class="notranslate"> <label class="desc" id="title111" for="Field111"> SteamID: <br /> <p style="font-family: verdana; color:green; font-weight: bold;">'.$inputid.'</p> </label> <div> <p style="font-family: verdana; color:green; font-weight: bold;"></p> </div> </li> </div>'; } elseif($inputid == "") $steamid_div = ""; //* $total = "$amount.$cents"; // CONFIRMATION TEMPLATE $conf_page = '<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html"> <head> <title>Confirm</title> <link rel="stylesheet" href="css/structure.css" type="text/css" /> <link rel="stylesheet" href="css/form.css" type="text/css" /> <script src="scripts/hide.js"></script> <script src="scripts/submitcl.js"></script> <!--[if lt IE 10]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> </label> <div id="container" class="ltr"> <h1 id="logo"> STG </h1> <form onSubmit="return clearForm(MyForm)" id="MyForm" name="conf_form" class="wufoo topLabel page" autocomplete="off" enctype="multipart/form-data" method="post" novalidate action="check.php"> <header id="header" class="info"> <h2>Confirm Information</h2> <div></div> </header> <div style="visibility: ;" id="errorset" name="errorset"> '.$conf_error.' </div> <br /> <ul> '.$steamid_div.' <li id="foli0" class="notranslate"> <label class="desc" id="title0" for="Field0"> Donation Amount: </label> <span> <p style="font-family: verdana; color:green; font-weight: bold;">$ '.$total.'</p> </span> </li> <li id="foli10" class="notranslate "> <fieldset> <![if !IE | (gte IE ]> <legend id="title10" class="desc"> </legend> <![endif]> <!--[if lt IE 8]> <label id="title10" class="desc"> </label> <![endif]--> <div> <span> <input id="check" name="confcheck" type="checkbox" onclick="" value="agree" tabindex="7" /> <label class="choice" for="Field10">I agree to the terms and conditions.</label> </span> </div> </fieldset> </li> <li class="buttons "> <div> <input id="saveForm" name="confirm" class="btTxt submit" type="submit" value="Submit" /></div> </li> </ul> <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" /> </form> <p style="font-size: 10px; text-align: center;">By donating, you agree to the terms and conditions found <a style="font-size: 10px; text-align: center;" href="http://forums.stgdarkrp.org/showthread.php?619-Donation-Rules&p=3712#post3712" >here</a></p> <br /> </div><!--container--> </body> </html>'; //* END CONFIRMATION TEMPLATE // Accept terms check if($agree == NULL && isset($_POST['confirm'])){ $conf_error = '<p style="text-align: center; background: #FFDFDF !important; padding-top: 4px; color:red; border-style:solid; border-width:1px; padding-bottom: 7px;"> <b> You must agree to the terms and conditions.</b></p>'; } elseif($agree == "agree" && isset($_POST['confirm'])){ $conf_error = ""; session_destroy(); header("Location: http://www.google.com"); } var_dump($total, $amount); //* echo $donator_qual; echo $conf_page; echo '<a href="http://steamcommunity.com/profiles/'.$c_id.'" target="_blank"> <img src="http://badges.steamstatus.com/profile/default/steam/'.$c_id.'.png" /> </a>'; } elseif (!isset($_COOKIE['FormSubmitted'])) echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="english" id="vbulletin_html"> <head> <title>Donation Title</title> <link rel="stylesheet" href="css/structure.css" type="text/css" /> <link rel="stylesheet" href="css/form.css" type="text/css" /> <link rel="stylesheet" href="css/button.css" type="text/css" /> <script src="scripts/hide.js"></script> <script src="scripts/submitcl.js"></script> <!--[if lt IE 10]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> </label> <div id="container" class="ltr"> <h1 id="logo"> STG </h1> <form onSubmit="return clearForm(MyForm)" id="MyForm" name="MyForm" class="wufoo topLabel page" autocomplete="off" enctype="multipart/form-data" method="post" novalidate action="check.php"> <fieldset class="form"> <header id="header" class="info"> <h2>Donation Form</h2> <div></div> </header> <div style="visibility: notranslate error;" id="errorset" name="errorset"> '.$errordiv_p.' </div> <br /> <ul> <div id="radio" name="hide"> <li id="foli111" class="'.$class_set.'"> <label class="desc" id="title111" for="Field111"> Please enter your SteamID here or check the box below. </label> <div> <input placeholder="STEAM_0:X:XXXXXX" id="steamid" name="steamid" type="text" class="field text medium" value="" maxlength="30" tabindex="3" onkeyup="" /> </div> </li> </div> <li id="foli0" class="'.$class_set2.'"> <label class="desc" id="title0" for="Field0"> Donation Amount <span id="req_0" class="req">Must be $5 or greater for benefits </span><a target="_blank" href="http://forums.stgdarkrp.org/showthread.php?619-Donation-Rules&p=3712#post3712"><img src="images/question.png" alt="Help" /></a> </label> <span class="symbol">$</span> <span> <input placeholder="5" id="Field0" name="amount" type="text" class="field text currency nospin" value="" size="4" tabindex="4" required /> <label for="Field0">Dollars</label> </span> <span class="symbol radix">.</span> <span class="cents"> <input placeholder="99" id="Field0-1" name="coins" type="text" class="field text nospin" value="" size="2" maxlength="2" tabindex="5" onkeyup="handleInput(this);" onchange="handleInput(this);"> <label for="Field0-1">Cents</label> </span> <li id="foli10" class="notranslate "> <fieldset> <![if !IE | (gte IE ]> <legend id="title10" class="desc"> </legend> <![endif]> <!--[if lt IE 8]> <label id="title10" class="desc"> </label> <![endif]--> <div> <span> <input id="check" name="anon" type="checkbox" onclick="toggleAlert()" class="field checkbox" value="" tabindex="7" /> <label class="choice" for="Field10">Do not change my rank upon donation <a target="_blank" href="http://forums.stgdarkrp.org/showthread.php?619-Donation-Rules&p=3712#post3712"><img src="images/question.png" alt="Help" /></a></label> </span> </div> </fieldset> </li> <li class="buttons"> <div> <button type="submit" id="button" class="positive" name="submit"> <img src="images/money.png" alt="Announcement">Donate</button> </div> </li> </ul> </fieldset> </form> <p style="font-size: 10px; text-align: center;">By donating, you agree to the terms and conditions found <a style="font-size: 10px; text-align: center;" href="http://forums.stgdarkrp.org/showthread.php?619-Donation-Rules&p=3712#post3712" >here</a></p> <br /> </div><!--container--> </body> </html>'; ?>
-
Hello, I am having an issue where PHP nulls the donation amount after multiple form submits. Here is a synopsis of what is happening. 1: User enters donation amount and clicks 'submit' 2: Is taken to a confirmation page where they must agree to terms 3: User fails to agree to the terms, the page is reloaded with an error message, and the donation amount is set to null I want to make the donation amount display despite multiple confirm page reloads. How would I do this? Here is the site to test it yourself. Ignore the steamid input and check "do not change my rank upon donation" to test. http://forums.stgdarkrp.org/donate2/check.php Please note: If you use IE, the formatting is messed up, that is a problem I will look into later
-
Hi, I'm new to PHP and testing a simple script. However, it won't change to red when I input the red radio button. Would anyone happen to know why? <?php $check = $_POST['check']; $submit = $_POST['S1']; if ($check = "1") { $color = "green"; } elseif ($check = "2") { $color = "red"; } var_dump($check); ?> <html> <body> <h1 style="color:<?php echo $color; ?>;">The h1 is <?php echo $color; ?>!</h1> <form method="POST" action="test.php"> <input type="radio" value="1" name="check" /> Green <br /> <input type="radio" value="2" name="check" /> Red <br /><br /> <input type="submit" name="S1" value="submit" /> </form> </body> </html>
-
Ok thank you very much. When I tried that, i was missing the {} lol
-
Hello, this is my first PHP project, and I am having issues getting it to correctly display an error ONLY if the input is an error It displays the error upon first load of the page w/o pressing submit. How would I use isset($_POST['submit']) to fix it? <?php $inputid = $_POST['steamid']; $steam_prefix = substr($inputid, 0, 10); $prefix_length = 10; $char_total = strlen($inputid); $steam_suffixchars = ($char_total - $prefix_length); $suffix_check = substr($inputid, 10, $steam_suffixchars); $class_set = "notranslate"; $is_submit = isset($_POST['submit']); if(is_numeric($suffix_check) == true) $suffix_valid = true; elseif(is_int($suffix_check) == false) $suffix_valid = false; if($char_total > 25 || $char_total < 11) $char_valid = false; else $char_valid = true; if($steam_prefix === "STEAM_0:1:" || $steam_prefix === "STEAM_0:0:") $prefix_check = true; elseif($steam_prefix != "STEAM_0:1:" || $steam_prefix != "STEAM_0:0:") $prefix_check = false; if (preg_match('/^[A-Z0-9-:]+$/', $inputid)) $chars_matched = true; else $chars_matched = false; if($suffix_check == true && $prefix_check == true && $char_valid == true && $chars_matched == true) echo "Approved!"; elseif(isset($_POST['anon'])) echo "Approved!"; else echo "error!"; ?>