PHP - If(isset()){} Not Working
Im trying to use an if isset to stop my error messages displaying before they submit the form it worked on another part of my website but wont work for this, It just wond submit the form at all when i click submit here is the code:
<html> <head> </head> <body> <form action="contact.php" method="post"> <fieldset> <legend>Contact Us</legend> Your Email:*<br> <input type="text" name="email"><br> Subject:*<br> <select name="subject"> <option value=""></option> <option value="1">Recruitment</option> <option value="2">Absense</option> <option value="3">Enquiry</option> </select> <br> Message:*<br> <textarea name="message" cols="50" rows="5"></textarea><br> <?php require_once('recaptchalib.php'); $publickey = "6LeB8LwSAAAAAKwvC3HWJNwWw9vYiSEkvFEvDduD"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <br> <input type="submit" value="Send Email"> </form> Required fields are marked with a *<br><br> <?php if(isset($_POST['Submit'])){ $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $to = "nathan_k_boothby_1994@hotmail.co.uk"; //checcking that all relevent information is entered and correct if(!$message || !$email) { $errmessage ="Please fill in all required data."; } require_once('recaptchalib.php'); $privatekey = "6LeB8LwSAAAAAA_0IIEnAxL5uOau0TBm83Iog7Ey"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $errmessage ="The text you wrote did not match the image."; } //Sending the email if nothing is wrong if(!$errmessage) { header("location:send.php?to=".$to."&subject=".$subject."&email=".$email."&message=".$message.""); }else{ echo $errmessage; } } ?> </fieldset> <br><br><br> </body> </html> And here is a link to the page: http://valiantflight.comlu.com/emailer/contact.php Any help will be greatly appriciated, Thanks, Blink359 Similar TutorialsThe below should be making it so that in order for "customer reviews" to be visible, you should need the "&review" in the url, but it's coming up regardless if it's in the URL or not. http://ghosthuntersportal.com/store.php?product=2 Code: [Select] elseif(isset($_GET['product'])){ $product_id=$_GET['product']; $sql500="SELECT * FROM $tbl_name3 WHERE product_id='$product_id'"; $result500=mysql_query($sql500); $num_rows500=mysql_num_rows($result500); if($num_rows500==0){ $average_rating=0; } else{ while($row500=mysql_fetch_array($result500)){ extract($row500); $total = $total + $review_product_rating; $review.=' <div class="review_container"> <div>'.$review_product_rating.' '.$review_title.'</div> <div>By '.$review_name.' from '.$review_location.' on '.$review_date.'</div> <div>Pros: </div><div>'.$review_pros.'</div> <div>Cons: </div><div>'.$review_cons.'</div> <div>Describe Yourself: </div><div>'.$review_describe.'</div> <div>Best Use: </div><div>'.$review_best_use.'</div> <div>'.$review_text.'</div> </div> '; } $review_product_rating_total=$total; $average_rating=$review_product_rating_total/$num_rows500; } $sql50="SELECT * FROM $tbl_name WHERE product_id='$product_id'"; $result50=mysql_query($sql50); while($row50=mysql_fetch_array($result50)){ extract($row50); $section=ucwords($product_category); $product_name=ucwords($product_name); $crumbs='<a href="./index.php">Home</a> <span class="eleven">></span> <a href="./store.php?cat='.$product_category.'">'.$section.'</a> <span class="eleven">></span> <a href="./store.php?product='.$product_id.'">'.$product_name.'</a>'; $section=" - ".$section; $product_highlights=str_replace("[","<li>", $product_highlights); $product_highlights=str_replace("]","</li>", $product_highlights); $content.=' <div class="product_wrapper"> <div>'.$product_name.'</div> <div class="product_image"> <div><img src="'.$product_image.'" alt="'.$product_name.'" /></div> </div> <div class="product_details"> <div class="product_price">Price: $'.$product_price.'</div> <div class="product_code">GHP#: '.$product_code.'</div> <div class="rating_image">'; if($num_rows500==0){ $content.='No Rating'; } else{ $content.='<img src="'.$average_rating.'.png" alt="'.$average_rating.'" />'; } $content.=' <span class="twelve">('.$num_rows500.' Reviews)</span></div><div>'; if(isset($product_highlights)){ $content.='<div class="product_highlights_text">Product Highlights</div><div class="product_highlights_item"><ul>'.$product_highlights.'</ul></div>'; } else{ } $content.='</div> </div> </div> '; } $content.='<div class="product_links_headers">Overview | Specifications | Customer Reviews</div>'; if(isset($review)){ $content.='<div style="margin-top: 400px;">'.$review.'</div>'; } elseif(isset($specifications)){ $content.='<div style="margin-top: 400px;">'.$product_specifications.'</div>'; } else{ } } Code: [Select] if (isset($_COOKIE['hide_div']['0']) && isset($_COOKIE['hide_div']['2'])){ $cookie1 = $_COOKIE['hide_div']['0']; $cookie2 = $_COOKIE['hide_div']['2']; } if ($cookie1 == $cat_id OR $cookie2 == $cat_id) { foreach ($this->forums as $forum_id => $forum_data) { if ($forum_data['category'] == $cat_id) { //----------------------------------- // We store the HTML in a temp var so // we can make sure we have cats for // this forum, or hidden forums with a // cat will show the cat strip - we don't // want that, no - we don't. //----------------------------------- $temp_html .= $this->process_forum($forum_id, $forum_data); } } if ($temp_html != "") { $this->output .= $this->html->CatHeader_Expandedhidden($cat_data); $this->output .= $this->html->end_this_cat(); } unset($temp_html); }else{ $cookie1 = ''; $cookie2 = ''; why in the world is it displaying Undefined variable: cookie1 and cookie2 as errors? When I declared both of them even AFTER my if statement, this is bogus dude, lol this isset stuff is really confusing or am i just not doing it right? Hi there, I have just move hosts with our website and it loads the frontpage but non of the subsequent pages. The site works like this, depending on the variables in the address depends which page and which template are loaded into it. If the template is "ros" it loads rosettes template, if it is "tro" it loads trophy template, and then the name of the item, ie "hazel" will load up the hazel product page. All it is doing at the moment is loading the home.php page. The code to do this is below: <? if (!isset($template)) {include ("static/home.php");} else if (isset($id)) { if (!file_exists("site_templates/$template.php")) { echo "OOPS! <P> The template you have requested does not exist!<BR><BR><BR><BR><BR><BR>"; }elseif (file_exists("site_templates/$template.php")) { include ("site_templates/$template.php"); } } ?> It worked with our last host, but refuses to work now. Is there someone out there that can help. Thanks in advance, Phil For some reason the !isset() function doesnt seem to work i cant find out why hope you guys will be able to help Here is the html code for the form where the user enters the data Code: [Select] <div id="contact_form"> <h2>On Site SEO Signup Form</h2> <form method="post" name="contact" action="http://www.techbreeze.in/freeseo.php"> <label for="uname">Name:</label> <input name="uname" type="text" class="required input_field" id="uname" /> <div class="cleaner h10"></div> <label for="email">Email:</label> <input type="text" class="validate-email required input_field" name="email" id="email" /> <div class="cleaner h10"></div> <label for="website">Website:</label> <input type="text" class="required input_field" id="website" name="website"/> <div class="cleaner h10"></div> <label for="ftp">Your FTP Login URL:</label> <input type="text" class="required input_field" id="url" name="url" /> <div class="cleaner h10"></div> <label for="username">Your FTP Username:</label> <input type="text" class="required input_field" id="user" name="user" /> <div class="cleaner h10"></div> <label for="password">Your FTP Password:</label> <input type="password" class="required input_field" id="pass" name="pass"/> <div class="cleaner h10"></div> <input type="submit" value="Send" id="submit" name="submit" class="submit_btn float_l" /> <input type="reset" value="Reset" id="reset" name="reset" class="submit_btn float_r" /> </form> </div> And here is the code for the .php file where the !isset() function is used Code: [Select] <?php // validation expected data exists if( !isset($_POST['uname'])) { die ('We are sorry, but all the fields are necessary you cant leave the "Name" field empty!'); } if( !isset($_POST['pass'])) { die ('We are sorry, but all the fields are necessary you cant leave the "Password" field empty!'); } if( !isset($_POST['email'])) { die ('We are sorry, but all the fields are necessary you cant leave the "Email" field empty!'); } if( !isset($_POST['website'])) { die ('We are sorry, but all the fields are necessary you cant leave the "Website" field empty!'); } if( !isset($_POST['url'])) { die ('We are sorry, but all the fields are necessary you cant leave the "FTP URL" field empty!'); } if( !isset($_POST['user'])) { die ('We are sorry, but all the fields are necessary you cant leave the "Username" field empty!'); Thanks in advance Sorry for the miss spell on correctly counldn't edit the title
I need to have the following 3 varibles checked to see if they are set and if not display an error saying "All fields need to be filled in." My problem is that it's not working. Did I mess up on my if statement? $tempneeded $lowtemp $gallons <?php $tempneeded = $_POST['tempneeded']; $lowtemp = $_POST['lowtemp']; $gallons = $_POST['gallons']; htmlspecialchars($tempneeded, ENT_QUOTES, 'UTF-8') . ' ' . htmlspecialchars($lowtemp, ENT_QUOTES, 'UTF-8') . ' ' . htmlspecialchars($gallons, ENT_QUOTES, 'UTF-8') . ' ' . $wgd = .5; $tempdiff = $tempneeded - $lowtemp; $wattsneeded = $tempdiff * ($gallons * $wgd); if (!isset ($lowtemp,$tempneeded,$gallons)) { echo "<b>All fields need to be filled in.</b>"; } else { echo "<b>You will need a total of $wattsneeded watts to rasie your tempature $tempdiff degress, from $lowtemp to $tempneeded.</b></td></tr>"; } ?> Edited by msebar, 08 October 2014 - 01:43 PM. I've tried both of these methods, but neither are working. The if statement fails every time. Code: [Select] if(isset($_POST['submit'])){ Code: [Select] if(isset($submit)){ This is the form: Code: [Select] <form id="form1" name="form1" method="post" action="join.php"> <label><span> <input name="email" type="text" class="keywords" id="textfield" maxlength="50" value="Join my mailing list..." onclick="make_blank();" /> </span> <input name="submit" type="image" src="images/search.gif" class="button" onclick="return checkmail(this.form.email);"/> </label> </form> Hello! This may sound like a stupid question but i have been trying to get this working all day and its driving me crazy.
Ive been asked to take over development of this project, he sent me his code and its a little out of date so im trying to update it. Here is what i cant work out.
I have this little snippet of code:
if ($page == "showthread"){ showThread(); }There are several more like that, but you dont need a whole list. That code seems to be throwing up this error when i go to that specific page: Notice: Undefined index: error in ..... All well and good, i would usually do this: if (isset($page) == "showthread"){ showThread(); }Thats fine and dandy, the error goes away. But now, when i go to that page, it redirects me and gives me my error message for a non-existing page. Its really frustrating me. Can you help me fix this little error? I have a simple log in form. By debugging I found that isset post submit function is not responding. It remains on the same page after submitting form. I have googled all the possible solutions to this problem but none worked. Any help is greatly appreciated. The form is in multiplelogin.php file and the code is in multi.php file. After login redirection is to teachers.php file. <?php session_start(); $conn = mysqli_connect("localhost", "root", "", "signup");
if(isset($_SESSION['username'])) {
?>
<head> <link rel="stylesheet" type="text/css" href="bootstrap.css"> <title> Teachers Students Login </title> </head> <body class="bg-secondary"> <div class="container"> <div class="row justify-content-center"> <div class="col-log-5 bg-light mt-5 px-0"> <h3 class="text-center text-light bg-primary py-3 px-5"> Log In </h3>
<div class="form-group px-5"> <input type="email" name="email" class="form-control form-control-lg" placeholder="Email" required> </div> <div class="form-group px-5"> <input type="password" name="password" class="form-control form-control-lg" placeholder="Password" required> </div> <div class="form-group px-5"> <input type="submit" name="submit" value="Submit" class="btn btn-primary btn-block"> </div> </form> </div> </div> </div>
<?php
ini_set( 'display_errors', 1 );
$password = $_POST['password'];
$stmt = mysqli_stmt_init($conn); header("Location: multilogin.php?error=sqlerror"); exit();
} else { mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
if ($pwdCheck == false) {
exit(); $_SESSION['username'] = $row['username']; $_SESSION['email'] = $row['email']; header("Location: teachers.php?login=success");
exit ();
exit();
exit();
else {
exit(); soory guys .. actually i am trying to add pagination in script.. but its not pagging.
but when i tried without isset($_get the code worked fine and then i tried to doing with isset($_get for a perticular cat
but its not working. can someone see my code and tell me whats worng i have done.
<!DOCTYPE HTML> <html> <head> </head> <body> <?php // include database connection include 'libs/db_connect.php'; // page is the current page, if there's nothing set, default is page 1 $page = isset($_GET['page']) ? $_GET['page'] : 1; // set records or rows of data per page $recordsPerPage = 1; // calculate for the query LIMIT clause $fromRecordNum = ($recordsPerPage * $page) - $recordsPerPage; // select all data $query = "SELECT * FROM posts ORDER BY post_id desc LIMIT {$fromRecordNum}, {$recordsPerPage}"; /* page and its LIMIT clause looks like: 1 = 0, 5 2 = 5,10 3 = 10,15 4 = 15, 20 5 = 20, 25 */ $stmt = $con->prepare( $query ); $stmt->execute(); //this is how to get number of rows returned $num = $stmt->rowCount(); //check if more than 0 record found if($num>0){ $cat=1; if(isset($_GET['cat'])){ $cat_id = $_GET['cat']; $get_posts = "select * from posts where category_id = '$cat_id'"; $run_posts = mysql_query($get_posts); while($row_posts = mysql_fetch_array($run_posts)){ $post_id = $row_posts['post_id']; $post_title = $row_posts['post_title']; $post_date = $row_posts['post_date']; $post_author = $row_posts['post_author']; $post_image = $row_posts['image']; $post_content = substr($row_posts['post_content'],0,80); echo " <div class='post_area'> <h4> <a href = 'details.php?post=$post_id'>$post_title</a> </h4> <div class='date'><div id='com'> Date</div>$post_date</div><span style='font-size:12px'><i style='color:grey;font-size:10px'>Posted By</i> </b>$post_author</span> <content><img src = '123dondadatest/news_images/$post_image' width = '100' height='100'/> <div>$post_content <br/><a id='rmlink' href = 'details.php?post=$post_id'> Read More...</a></div><br /><br/><br/><br/> </div> "; } } // *************** <PAGING_SECTION> *************** echo "<div id='paging'>"; // ***** for 'first' and 'previous' pages if($page>1){ // ********** show the first page echo "<a href='" . $_SERVER['PHP_SELF'] . "' title='Go to the first page.' class='customBtn'>"; echo "<span style='margin:0 .5em;'> << </span>"; echo "</a>"; // ********** show the previous page $prev_page = $page - 1; echo "<a href='" . $_SERVER['PHP_SELF'] . "?page={$prev_page}' title='Previous page is {$prev_page}.' class='customBtn'>"; echo "<span style='margin:0 .5em;'> < </span>"; echo "</a>"; } // ********** show the number paging // find out total pages $query = "SELECT COUNT(*) as total_rows FROM posts"; $stmt = $con->prepare( $query ); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); $total_rows = $row['total_rows']; $total_pages = ceil($total_rows / $recordsPerPage); // range of num links to show $range = 2; // display links to 'range of pages' around 'current page' $initial_num = $page - $range; $condition_limit_num = ($page + $range) + 1; for ($x=$initial_num; $x<$condition_limit_num; $x++) { // be sure '$x is greater than 0' AND 'less than or equal to the $total_pages' if (($x > 0) && ($x <= $total_pages)) { // current page if ($x == $page) { echo "<span class='customBtn' style='background:red;'>$x</span>"; } // not current page else { echo " <a href='{$_SERVER['PHP_SELF']}?page=$x' class='customBtn'>$x</a> "; } } } // ***** for 'next' and 'last' pages if($page<$total_pages){ // ********** show the next page $next_page = $page + 1; echo "<a href='" . $_SERVER['PHP_SELF'] . "?page={$next_page}' title='Next page is {$next_page}.' class='customBtn'>"; echo "<span style='margin:0 .5em;'> > </span>"; echo "</a>"; // ********** show the last page echo "<a href='" . $_SERVER['PHP_SELF'] . "?page={$total_pages}' title='Last page is {$total_pages}.' class='customBtn'>"; echo "<span style='margin:0 .5em;'> >> </span>"; echo "</a>"; } echo "</div>"; // ***** allow user to enter page number echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='GET'>"; echo "Go to page: "; echo "<input type='text' name='page' size='1' />"; echo "<input type='submit' value='Go' class='customBtn' />"; echo "</form>"; // *************** </PAGING_SECTION> *************** } // tell the user if no records were found else{ echo "<div class='noneFound'>No records found.</div>"; } ?> </body> </html> Hi there, I'm inserting data into a mysql database. My submissions works fine, however when a part of the form is not filled out the php scripit crashes. How can I submit all data that is set and skip pieces that aren't filled out? For example I have a plant database which has an option to insert different types of common names for the plant. It's ok if they aren't all filled out. My code is as follows: Code: [Select] <?php //insert general plant data into db $queryplant="INSERT INTO actualplanttable (id, scientific, common1, common2, common3, family, genus, description, planting, growing, care, duration, reference) VALUES ('NULL', '$_POST[scientific]', '$_POST[common1]', '$_POST[common2]', '$_POST[common3]', '$_POST[family]', '$_POST[genus]', '$_POST[description]', '$_POST[planting]', '$_POST[growing]', '$_POST[care]','$_POST[duration]','$_POST[reference]')"; mysql_query($queryplant) or die ('Error updating actualplanttable'); //insert maintenance data into db $querymaintenance="INSERT INTO plantmaintenancelinktable (plant_id, maintenance_id) VALUES ('$inserted_id', '$_POST[maintenance]')"; mysql_query($querymaintenance) or die ('Error updating plantdurationtable'); ?> Should I be trying to work an isset function into this code? Any help would be greatly appreciated. Thanks! Bill... Isn't this code redundant... if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == TRUE){ After all, if $SESSION['logged_in'] == TRUE then it is *obviously* set... Debbie i Have two page login.php and verify.php In login.php user is entering Username and Password and in the action of the form i am writing verify.php. If verification is a success then i will start a session() Code: [Select] session_start(); $_SESSION['ls']="loggedin"; // ls stands for login status $_SESSION['id']=$row['id']; $_SESSION['user_name']=$row['user_name']; $_SESSION['email']=$row['email']; header('location : members.php'); die (" "); and will redirect them to members.php .... Everything is working fine... But in login.php i have written a code on the top... Code: [Select] <?php if(isset($_SESSION['ls']) && isset($_SESSION['id']) && isset($_SESSION['user_name']) && isset($_SESSION['email']) ) { header('location:members.php'); die(" "); } ?> I want if a session is started and if user will access login.php they will automatically go to members.php But this script is not working... Iam not getting whats the problem... also i m not getting any error login.php or anything CODE WRITTEN ON THE TOP OF members.php IS : Code: [Select] <?php session_start(); if(@$_SESSION['ls']!=="loggedin" ) // Checks if the person has done stage one (Registration.php) { header('Location: login.php'); //If they haven't done it, it sends them back. die (" "); } ?> guys this thing called isset() is bugging me.What is the difference in when you say Code: [Select] if(isset($_POST['name'])) and Code: [Select] if($_POST['name']) and Code: [Select] if(!$_POST['name']) and why would someone require a code such as Code: [Select] if($_POST['submit']=='Submit') And what is that code which tells you the user has entered something into the form Thanks People Hello all, i am hoping someone can help me. i have some code i have been working on and i am trying to add a 404 page if it cant find the page, i know it will be some sort of if statment, but with me been pretty much a noob at php i am stuck. heres the code that the page calls. Code: [Select] function get_content() { //Get page name from browser if none call it home $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; //Get The Page Content $sql = "SELECT * FROM content WHERE page = '$page'"; $res = mysql_query($sql) or die (mysql_error()); while($row = mysql_fetch_assoc($res)){ //Show The Page Content echo '<h1>' . $row['title'] . '</h1>'; echo $row['body']; } } thanks all. I believe that my problem is with the isset on line 7 and 39, but I do not know of anyway around it. Can someone enlighten me. <?php session_start(); if (isset($_GET['logout'])){ unset($_SESSION['logged_in']); } ?> <html> <head> <title>Add a New Car!</title> <?php if (isset($_POST['submit'])) { //print_r($_POST); $password = md5($_POST['password']); //echo'<p>'.$password.'</p>'; $username = ($_POST['username']); //echo'<p>'.$username.'</p>'; } $db = new PDO('sqlite:login.sqlite'); $login = 'SELECT * FROM login WHERE userid="'.$username.'" AND password="'.$password.'";'; //echo'<p>'.$login.'</p>'; $attempt = $db->query($login); foreach ($attempt as $row) { //print_r($row); $_SESSION['logged_in'] = $username; } ?> </head> <body> <?php if (!isset($_SESSION['logged_in'])){ ?> <form method="post" action="Db_login.php"> <p>Username:<br /><input type="text" name="username" /> </p> <p>Password:<br /><input type="password" name="password" /></p> <p><input type="submit" name="submit" value="Log In!" /></p> </form> <?php } else { ?> <?php if(isset($_POST['submit'])) { print_r($_POST); $make = ($_POST['make']); $model = ($_POST['model']); $year = ($_POST['year']); $fuel = ($_POST['fuel_type']); $vin = ($_POST['vin_number']); $reg = ($_POST['reg_number']); } $db = new PDO('sqlite:cars.sqlite'); $sqlCars = 'INSERT INTO cars ( ) VALUES("'.$make.'","'.$model.'","'.$year.'","'.$fuel.'","'.$vin.'","'.$reg.'");'; echo'<p>'.$sqlCars.'</p.>'; ?> <form method="post" action="Db_new_Cars.php" enctype="multipart/form-data"> <p>Make:<br /><input type="text" name="make" /> </p> <p>Model:<br /><input type="text" name="model" /></p> <p>Year:<br /><input type="text" name="year" /></p> <p>Fuel Type:<br /><input type="text" name="fuel_type" /></p> <p>Vin Number:<br /><input type="text" name="vin_number" /></p> <p>Reg Number:<br /><input type="text" name="reg_number" /></p> <p>Choose a image to upload:<br /> <input type="file" name="myfile"></input></p> <p><input type="submit" name="submit" value="Submit!" /></p> </form> <h1> Protected Content!</h1> <p>You are logged in as <em><?php echo $_SESSION['logged_in']; ?> </em></p> <p><a href="Db_login.php?logout=true">Log out!</a></p> <p><a href="New_Cars.php">Add a new car</a></p> <p><a href="Book_Out_Cars.php">Book out a car</a></p> <?php } ?> </body> </html> why dose this not work <?php if(isset($_SESSION['SESS_ADMIN'])) $loc = ../admin/admin.php; else $loc= ../head/head.php"; ?> <form><INPUT TYPE="button" value="Main Menu" onClick="parent.location='<?php echo $loc; ?>'"></form> </body> </HTML> I want to get the COUNT of the fields (ArrayM11 - ArrayM19), which has the word "YES". The code isn't working. Appreciate any help. $Array1 = array(); for($j=0;$j<count($ArrayM1);++$j) { $result = array_count_values($ArrayM1[$j]); if (isset($result['YES'])) { $points1 = $result['YES']; } } Hi all I need to do a multiple if isset to get three variables from the URL. Here is my code for just one: if(isset($_GET['category'])) { $fetchproducts = mysql_query(" SELECT * FROM `products` WHERE category = '".$_GET['category']."'"); while($returnedProduct = mysql_fetch_array($fetchproducts)) { include('product-cell.php'); } How do I combine this to check what is the 'type' and 'colour' from the URL and fetch from the SQL accordingly? Many thanks for you help Pete This is blowing my mind. I have this function and all I want it to do is check to make sure that the var $race is set and = '0'. The default value from the form is '0'. I also want it to check the value of race and if it is anything but the two listed , submit error. Yes I've tried to replace the || with &&.. Nothing works(Meaning that it will error when its not suppose to or it wont error when its suppose to).. Any ideas? Code: [Select] function check_Race ($race,$display_name,$member_id,$description,$ip) { //echo "This is the race". $race; //exit; if (isset($race) && $race ='0' && $race !== 'White' && $race !== 'Black'){ echo "This is an errror.!"; $t_error="19"; $member_id = $member_id; notify_Admin($t_error,$member_id,$ip); // logOut ($t_error); exit; } In my index.php I use a global $_GET variable he Code: [Select] $ibforums->input = $std->parse_incoming(); parse_incoming function is: Code: [Select] function parse_incoming() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_CLIENT_IP, $REQUEST_METHOD, $REMOTE_ADDR, $HTTP_PROXY_USER, $HTTP_X_FORWARDED_FOR; $return = array(); if( is_array($HTTP_GET_VARS) ) { while( list($k, $v) = each($HTTP_GET_VARS) ) { //-- mod_sec_update_131 begin if (strpos($k, "amp;") === 0) $k = substr($k, 4); //-- mod_sec_update_131 end if ( $k == 'INFO' ) { continue; } if( is_array($HTTP_GET_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) { $return[$k][ $this->clean_key($k2) ] = $this->clean_value($v2); } } else { $return[$k] = $this->clean_value($v); } } } // Overwrite GET data with post data if( is_array($HTTP_POST_VARS) ) { while( list($k, $v) = each($HTTP_POST_VARS) ) { if ( is_array($HTTP_POST_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) { $return[$k][ $this->clean_key($k2) ] = $this->clean_value($v2); } } else { $return[$k] = $this->clean_value($v); } } } //---------------------------------------- // Sort out the accessing IP // (Thanks to Cosmos and schickb) //---------------------------------------- $addrs = array(); foreach( array_reverse( explode( ',', $HTTP_X_FORWARDED_FOR ) ) as $x_f ) { $x_f = trim($x_f); if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $x_f ) ) { $addrs[] = $x_f; } } $addrs[] = $_SERVER['REMOTE_ADDR']; $addrs[] = $HTTP_PROXY_USER; $addrs[] = $REMOTE_ADDR; //header("Content-type: text/plain"); print_r($addrs); print $_SERVER['HTTP_X_FORWARDED_FOR']; exit(); $return['IP_ADDRESS'] = $this->select_var( $addrs ); // Make sure we take a valid IP address $return['IP_ADDRESS'] = preg_replace( "/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/", "\\1.\\2.\\3.\\4", $return['IP_ADDRESS'] ); $return['request_method'] = ( $_SERVER['REQUEST_METHOD'] != "" ) ? strtolower($_SERVER['REQUEST_METHOD']) : strtolower($REQUEST_METHOD); return $return; } Now, I use my $ibforums->input throughout my forum system, and I use it in EVERY SINGLE file, I have around 50 Files and I get "unidetified variable" errors. is there a way I can just make sure my global $ibforums->input is ISSET so it it's a GLOBAL ISSET? So I don't have to go through each file that uses $ibforums->input and put a isset( ) around it? It would take over prob 10 days to go through each file and change all 300-500 errors, using the $ibforums->input, there has to be a way I can globally defined my $ibforums->input Variable with a isset.. Thank you |