Jump to content

ICYUH8

New Members
  • Posts

    7
  • Joined

  • Last visited

ICYUH8's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry, I guess I don't fully understand what you meant by having the isset come first. I thought the second statement in my last post was what you meant since it was at the beginning of the statement and thus it was first. I'll check that again. I was looking at this part too since the notices match these exactly. I will add them in and post the results. Out of curiousity, is it possible to have just one isset cover all of them so they don't each have to be added individualy? It just seems like redundancy to me. But what do I know for a new guy. Understood if it is possible, but would require recoding much of the file. Thanks again for your help with this.
  2. Thank you guys. Taking both of your ideas, the results were the same in both instances. The database value was correctly interpreted as 'Y', however I still have the same notices appearing. Here is what I tried so you can see: if($settings['set_payment']=='Y' && isset($settings['set_payment'])) { if(isset($settings['set_payment']) && $settings['set_payment']=='Y') { Now I'm studying how Muddy wants the things wrapped so I can try that. If I'm looking at it correctly, I'll need to move blocks of code around to accomplish it. I'll post those results once I figure it out.
  3. I'm trying to fix an old website that was developed several years ago which had been mothballed. Now I want to recesutate it and get it up and running again. What I'm trying to do at this point is fix any Warnings, Notices, and of course Errors. Being a new guy to PHP it's been kind of challenging, but definitley rewarding fixing whatever I can (thank you google). But there is one problem I cannot figure out, hopefully someone here can help me. I'm getting a bunch of notices on one page when it loads. I know where the problem is, and thought I knew how to fix it which is just by adding isset(). But adding it is not giving me the desired results. Adding isset() removes the notices, but a database value that is set to 'N' is ignored and interpretted as 'Y'. FYI, the affected database values are 'Y' which forces a paid membership, or 'N' which makes it free and no payment required. These are the notices when the page loads: Notice: Undefined index: hou_title /home/mysite/public_html/config.php(420) : eval()'d code:63 Notice: Undefined index: hou_desc /home/mysite/public_html/config.php(420) : eval()'d code:73 Notice: Undefined index: hou_areax /home/mysite/public_html/config.php(420) : eval()'d code:80 Notice: Undefined index: hou_areay /home/mysite/public_html/config.php(420) : eval()'d code:81 Notice: Undefined index: hou_rooms /home/mysite/public_html/config.php(420) : eval()'d code:91 Notice: Undefined index: hou_travlrs /home/mysite/public_html/config.php(420) : eval()'d code:98 Please see my code below. I pasted the entire page, but the line that's causing me issues starts at 16. <? include "init.php"; $title2 = "- Add Your Home"; $submitted=false; if(!$user) { $center = message(eval_template("register_or_login")); } else { #check paypal balance here if($settings['set_payment']=='Y') { // this works the way it should, however the page gives Undefined index warnings // if (isset($settings['set_payment'])=='Y') { // this remove the notices, but will go to paypal even though set_payment in DB is set to 'N' $now=time(); $r = query("SELECT * FROM {$prefix}payments WHERE pay_usr_id=$user[usr_id] AND pay_validupto>=$now") or cdie("gps:".mysql_error()); if(numr($r) == 0) { $r = query("SELECT * FROM {$prefix}prices WHERE pri_locked='N' ORDER BY pri_days ASC") or cdie("gps2:".mysql_error()); if(numr($r)==0) cdie("No payment plans in database, please visit later."); $pay = "<b>Please select a plan below:</b><br> <table border=0 width=100%> <tr bgcolor=#eeeeee> <td width=70%>Memberships</td> <td align=center># Days valid</td> <td align=center>Price (USD)</td> </tr> "; while($price = fetch($r)) { $pay .= " <tr> <td> <a href='$settings[set_site_url]/pay.php?pri_id=$price[pri_id]'>$price[pri_title]</a><br> <span style='color:gray'>$price[pri_desc] </td> <td align=center>$price[pri_days]</td> <td align=center>\$$price[pri_amount]</td> </tr> "; } $pay .= "</table>"; $center = message("You either need to open a new membership account, or your balance is too low to add a listing!<br><br>$pay"); } } else { $ret= "<select name=hou_cou_id id=hou_cou_id onchange=\"javascript: //var cou_obj = document.getElementById('hou_cou_id'); if(this.value != '0') { var ifra = document.getElementById('loadlist'); ifra.src = '$settings[set_site_url]/list_cities_array.php?cou_id='+this.value; document.getElementById('clist').innerHTML = 'Loading cities list'; } else document.getElementById('clist').innerHTML = '<i>No country selected to list cities of</i>'; \" >"; $ret .="<option value='0'>Select country</option>"; $q = "SELECT * FROM {$prefix}countries WHERE cou_locked='N' ORDER BY cou_title ASC"; $r = query($q) or ddie(mysql_error().":".$q); if(numr($r)==0) return "None"; $arr = Array(); $arr2 = Array(); while($c = fetch($r)) { $arr []= "<option value='$c[cou_id]'>"._html($c['cou_title'])."</option>"; $r2 = query("SELECT * FROM {$prefix}cities WHERE cit_cou_id=$c[cou_id] ORDER BY cit_title ASC"); $temp = "<option value=c$c[cou_id]>"._html($c['cou_title'])."</option>"; if(numr($r2) > 0) { while($ct = fetch($r2)) { //echo "$ct[cit_title] = "; $ct['cit_title'] = enc_unicode($ct['cit_title']); //echo "$ct[cit_title]<br>"; $temp .= "<option value='i$ct[cit_id]'> - $ct[cit_title]</option>\n"; $selected=true; } } $arr2 []= $temp; } $hou_cou_id = $ret . implode("\n",$arr) ."</select>"; $country_wise_cities= implode("\n",$arr2); $months = Array("January","February","March","April","May","June","July","August", "September","October","November","December"); $cmonth = date("F"); $dat_date1_mon = Array(); foreach($months as $k=>$month) { $sel = $cmonth==$month ? ' selected' : ''; if(isset($_POST['dat_date1_mon'])) if($k+1==intval($_POST['dat_date1_mon'])) $sel=' selected'; $dat_date1_mon []= "<option value='".($k+1)."'$sel>$month</option>"; } $dat_date1_mon = implode("\n",$dat_date1_mon); $dat_date2_mon = Array(); foreach($months as $k=>$month) { $sel = $cmonth==$month ? ' selected' : ''; if(isset($_POST['dat_date2_mon'])) if($k+1==intval($_POST['dat_date2_mon'])) $sel=' selected'; $dat_date2_mon []= "<option value='".($k+1)."'$sel>$month</option>"; } $dat_date2_mon = implode("\n",$dat_date2_mon); $dat_date1_day = Array(); for($i=1; $i<31;$i++) { if(isset($_POST['dat_date1_day'])) { if($i==intval($_POST['dat_date1_day'])) $sel=' selected'; else $sel=''; } else $sel = $i==intval(date("d")) ? ' selected' : ''; $dat_date1_day []= "<option value='$i'$sel>$i</option>"; } $dat_date1_day = implode("\n",$dat_date1_day); $dat_date2_day = Array(); for($i=1; $i<31;$i++) { if(isset($_POST['dat_date2_day'])) { if($i==intval($_POST['dat_date2_day'])) $sel=' selected'; else $sel=''; } else $sel = $i==intval(date("d")) ? ' selected' : ''; $dat_date2_day []= "<option value='$i'$sel>$i</option>"; } $dat_date2_day = implode("\n",$dat_date2_day); $cyear = intval(date("Y")); $dat_date1_year = Array(); for($i=$cyear; $i<=$cyear+10; $i++) { $dat_date1_year []= "<option value='$i'>$i</option>"; } $dat_date2_year = $dat_date1_year = implode("\n",$dat_date1_year); if(!isset($_GET['process'])) { $center = eval_template("addhome"); } else { $error = ''; check_magic_quotes(); $dat_date1 = mktime (0,0,0,$_POST['dat_date1_mon'],$_POST['dat_date1_day'],$_POST['dat_date1_year']); $dat_date2 = mktime (0,0,0,$_POST['dat_date2_mon'],$_POST['dat_date2_day'],$_POST['dat_date2_year']); //echo "From ".date("F d, Y",$dat_date1) ." to ".date("F d, Y",$dat_date2) ."<hr>"; if(intval($_POST['hou_cou_id']) ==0) $error = "No country selected"; else if($dat_date1 == $dat_date2) $error = "Availability dates are the same"; else if($dat_date1 > $dat_date2) $error = "Invalid availability dates. Date 'From' is after date 'To' that you've selected"; else if(!isset($_POST['hou_cit_id'])) $error = "No city selected. The country you selected does have cities listed"; else if(strlen($_POST['hou_title']) < 5) $error = "Title too short. 5 character minimum required"; else if(strlen($_POST['hou_desc']) < 5) $error = "Description too short. 5 character minimum required"; else if(intval($_POST['hou_areax']) < 1) $error = "Invalid house area measure X"; else if(intval($_POST['hou_areay']) < 1) $error = "Invalid house area measure Y"; else if(intval($_POST['hou_rooms']) < 1) $error = "Invalid rooms specification"; else if(intval($_POST['hou_travlrs']) < 1) $error = "Invalid number of travelers"; if($error != '') { $center = eval_template("addhome"); } else { #process form $array = $_POST; $array['hou_date'] = time(); $array['hou_ip'] = _ip(); $array['hou_usr_id'] = $user['usr_id']; $q = make_ins_query("houses", $array,"dat_date1_day,dat_date1_mon,dat_date1_year,dat_date2_day,dat_date2_mon,dat_date2_year,dest_list,destinations,locations"); $date = date("F d, Y", time()); $time = date("h:i:s A", time()); if(query($q)) { $house_id = mysql_insert_id(); $q = "INSERT INTO `${prefix}destinations` (`des_reg_id`,`des_cou_id`,`des_cit_id`,`des_hou_id`,`des_usr_id`) VALUES "; $destarr = explode("^",$_POST['locations']); $qarr = Array(); $any=false; foreach($destarr as $de) { if(eregi("i",$de)) { $city = city(intval(substr($de,1,strlen($de)-1))); if($city) { $regi = region($city['cit_reg_id']); if(!$regi) continue; $coun = country($city['cit_cou_id']); if(!$coun) continue; } else continue; } else if(eregi("c",$de)) { $coun = country(intval(substr($de,1,strlen($de)-1))); if($coun) { $regi = region($coun['cou_reg_id']); $city = Array('cit_id'=>0); if(!$regi) continue; } else continue; } else continue; $qarr []= "($regi[reg_id],$coun[cou_id],$city[cit_id],$house_id,$user[usr_id])"; $any=true; } if($any) { $q .= implode(",\n",$qarr); query($q) or cdie(mysql_error()."<hr>DESIRED LOCATIONS INSERTION ERROR : $q"); } $q = "INSERT INTO `{$prefix}dates` (dat_hou_id,dat_usr_id,dat_date1,dat_date2) VALUES($house_id,$user[usr_id],$dat_date1,$dat_date2)"; query($q) or cdie(mysql_error()."<hr>DATE INSERTION ERROR $q"); $body = "Dear admin, A new listing has been submitted to the database for approval. Submitter : '"._html($user['usr_name'])."' also known as '"._html($user['usr_title'])."' Time : $time Date : $date IP Address : $array[hou_ip] Approval link (where you can view details and approve the new listing): $settings[set_site_url]/admin.php ---------------------------------------------------------------------------- This is an automated email sent to the administrator."; @mail("$settings[set_email]","New listing added for approval",$body,"From:\"$settings[set_from]\" <$settings[set_email]>"); $center = message("Your listing has been submitted successfully and will appear after administrator approval.<br /> <a href='$settings[set_site_url]/index.php'>Click here to return to homepage</a>"); $submitted=true; } else { $center = message("Internal error : please report to administrator at <a href='mailto:$settings[set_email]'>$settings[set_email]</a>"); } } } } } echo eval_template("header"); echo eval_template("body"); echo eval_template("footer"); cdie(); ?> Thank you to whoever has the solution and can explain it to me.
×
×
  • 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.