Your Availability body<= login to proceed. p?>"; } LJ::load_user_props($u, "single_status", "single_pickw", "city", "country", "state"); my %countries; my %states; LJ::load_codes({ "country" => \%countries, "state" => \%states }); my $ret; # save mode: if (LJ::did_post()) { unless ($POST{'status'}) { LJ::set_userprop($u, "single_status", ""); return "Saved. You won't show up as available."; } if ($POST{'country'} eq "US" && length($POST{'state'}) > 2) { foreach (keys %states) { $POST{'state'} = $_ if (lc($states{$_}) eq $POST{'state'}); } } # clean/verify $POST{'age'} += 0; return "You need to provide an age." unless $POST{'age'}; return "Sorry, you're too young to use this service." unless $POST{'age'} >= 18; return $ML{'Error'} unless ($POST{'status'} =~ /^[MF][MF]$/); LJ::set_userprop($u, "single_status", join("|", map { $POST{$_} } qw(status country state city age))); LJ::set_userprop($u, "single_pickw", $POST{'single_pickw'}); $ret .= "Saved. Now, go search for somebody!"; return $ret; } $ret .= "
"; # edit mode: my ($status, $country, $state, $city, $age) = split(/\|/, $u->{'single_status'}); my $dbr = LJ::get_db_reader(); $country ||= $u->{'country'}; $state ||= $u->{'state'}; $city ||= $u->{'city'}; if (! $age && $u->{'bdate'} =~ /^(\d\d\d\d)-(\d\d)-(\d\d)$/ && $3) { $age = int($dbr->selectrow_array("SELECT (unix_timestamp()-unix_timestamp('$u->{'bdate'}'))/(60*60*24*365)")); $age = "" unless $age; } $ret .= " 'status', 'selected' => $status, }, "", "Not Available", "MF", "Male; seeking female", "FM", "Female; seeking male", "MM", "Male; seeking male", "FF", "Female; seeking female", ); $ret .= " p?>\n"; $ret .= ""; $ret .= "Country: "; $ret .= LJ::html_select({ 'name' => 'country', 'selected' => $country }, '', '(Select Country)', map { $_, $countries{$_} } "US", sort { $countries{$a} cmp $countries{$b} } keys %countries); $ret .= " p?>"; my $estate = LJ::ehtml($state); $ret .= "State: p?>\n"; my $ecity = LJ::ehtml($city); $ret .= "City: p?>\n"; $ret .= " p?>\n"; # sexiest userpic my $upinf = LJ::get_userpic_info($u); my %keywords = ("" => "(Default Picture)", map { $_ => $_ } keys %{$upinf->{kw}} ); $ret .= "userpic keyword do you want to try to seduce people with? p?>
"; $ret .= LJ::html_select({ 'name' => 'single_pickw', 'selected' => $u->{'single_pickw'} }, map { $_, $keywords{$_} } sort keys %keywords); $ret .= "
\n"; # done $ret .= ":) p?>"; $ret .= "

"; $ret .= "
"; return $ret; } _code?> <=body page?>