Przedszkolak
Postów: 81 Ostrzeżeń: 4
Data rejestracji: 20.10.2007 13:25
|
Witam, nadal dopracowuję skrypcik tzw. Application Form. Tym razem borykam się z problemem warunku if iMEMBER, który uprzednio był warunkiem if !iMEMBER (nie znam niestety tego), który przenosił na stronę główną, jeśli pacjent był niezalogowany. Po drobnych modyfikacjach wszystko prawie działa, z wyjątkiem końcówki
] else [
Mianowicie chodzi o to, że chciałbym dodać maincore.php i header.php do tego 'else' czyli komunikatu gdy user jest niezalogowany. W tym momencie pokazuje się tylko tło i tekst który wyznaczyłem.
Oto skrypt:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: application.php
| Author: Starefossen
+--------------------------------------------------------+
| Form is made on request by Starefossen.
| No warranty is given, please visit the PHP-Fusion
| MODs & Infusions site for help :)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
if (iMEMBER) {
/*-------------------------------------------------------+
| APPLICATION SETTINGS |
+--------------------------------------------------------*/
$form_settings['name'] = "Application Form"; // This will be the name of the Application Form
$form_settings['desc'] = "Please fill this application completely. It will be automatically posted on the forums.";
$form_settings['subject_key'] = "form_character_name,_specialization_and_class"; // This will be the form input which is used as subject.
$form_settings['subject_prefix'] = "Application: "; // This will come right before the subject. Set this to blank if not needed.
$form_settings['forum_id'] = "2"; // This will be the forum the thread is posted in.
/*-------------------------------------------------------+
| APPLICATION FORM |
+--------------------------------------------------------*/
/*
IMPORTANT
ALL FORM INPUTS MUST START WITH form_ OR ELSE THEY WILL NOT BE SUBMITTED
EG: <input type='text' class='textbox' name='form_name' style='width:250px;' />
*/
function application_form($country_opts) {
global $form_settings;
// Start Form
echo "<form action='".FUSION_SELF."' method='post'>";
echo "<table class='tbl-border' width='100%'>\n<tr>\n";
echo "<td class='tbl1' colspan='2'>".$form_settings['desc']."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl2' colspan='2'><strong>A. Basic Information </strong></td>\n";
// Name Input
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Name: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_name' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Age Input
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Age: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_age' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Gender Input
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Gender: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_gender' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Country Input
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Country: </td>\n";
echo "<td class='tbl1'><select class='textbox' name='form_country' style='width:370px;'>$country_opts</select></td>\n";
// Occupation
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Occupation: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_occupation' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Yourself
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Tell us a little bit about yourself: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_tell_us_a_little_bit_about_yourself' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Playtime
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>How long have you played WoW? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_how_long_have_you_played_wow' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Playtime 2
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Total time played on this character: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_total_time_played_on_this_character' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl2' colspan='2'><strong>B. System Information </strong></td>\n";
// System specs
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>System specs: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_system_specs' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Microphone
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Do you have a microphone? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_do_you_have_a_microphone' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Vetrilo
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Can you use Ventrilo? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_can_you_use_ventrilo' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Disconnects
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Do you have any disconnection problem at all? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_do_you_have_any_disconnection_problems_at_all' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// FPS
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Average FPS in raid during a boss encounter? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_avarage_fps_in_raid_during_a_boss_encounter' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Ping
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Average latency while raiding? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_avarage_latency_during_raiding' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl2' colspan='2'><strong>C. Raiding and Character Information </strong></td>\n";
// Character
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Character Name - Spec Class: <br><u>(example: Saarg - Protection Warrior)</u></td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_character_name,_specialization_and_class' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Armory
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Armory Link: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_armory_link' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Sons of Hodir
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>Are you exalted with Sons of Hodir? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_are_you_exalted_with_sons_of_hodir' style='width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Vanilla WoW EXP
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Vanilla WoW experience: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_vanilla_wow_experience' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// TBC EXP
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>The Burning Crusade experience: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_the_burning_crusade_experience' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// WotLK EXP
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Wrath of the Lich King experience: </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_wrath_of_the_lich_king_experience' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Leader
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Have you ever been a raidleader or guildmaster? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_have_you_ever_been_a_raidleader_or_guildmaster' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Elixirs
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Do you have the will and time to put in enough effort flasks and consumables for the raid? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_do_you_have_the_will_and_time_to_put_in_enough_effort_flasks_and_consumables_for_the_raid' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Tactics
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Will you come to a progression raid having already read any available information relevant to encounters? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_will_you_come_to_a_progression_raid_having_already_read_any_available_information_relevant_to_encounters' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Raidtime
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>What do you think about beginning raids early and staying beyond the required raid times to down new content? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_what_do_you_think_about_beginning_raids_early_and_staying_beyond_the_required_raid_times_to_down_new_content' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl2' colspan='2'><strong>D. Other Questions </strong></td>\n";
// Current guild
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>What guild are you currently in? Who is/was the GM? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_what_guild_are_you_currently_in?_Who_is/was_the_GM' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Current guild history
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Why are you leaving your current guild? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_why_are_you_leaving_your_current_guild' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Activity
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Do you play actively outside of raiding? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_do_you_play_actively_outside_of_raiding' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Bench time
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>There will be Bench time. Everyone will have to sit at one point in time or another. Are you okay with this? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_there_will_be_Bench_time._everyone_will_have_to_sit_at_one_point_in_time_or_another._Are_you_okay_with_this' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Interested in joining
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Why are you interested in joining Duality? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_why_are_you_interested_in_joining_duality' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Referaals
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>Do you currently know anyone in Duality? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_do_you_currently_know_anyone_in_duality' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Referaals
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' valign='top'>What kind of raider can we expect you to be? </td>\n";
echo "<td class='tbl1'><input type='text' class='textbox' name='form_what_kind_of_raider_can_we_expect_you_to_be' style='height:40px; width:370px;' onkeydown=\"if (event.keyCode == 13) {return false;}\"/></td>\n";
// Submit Form
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'></td>\n";
echo "<td class='tbl1'>";
echo "<input type='submit' class='button' name='submit_form' value='Submit' />\n";
echo "<input type='reset' class='button' name='reset_form' value='Reset' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
}
/*-------------------------------------------------------+
| NO EDIT BELLOW THIS NEEEDED |
+--------------------------------------------------------*/
if (!function_exists("stripos")) {
function stripos($haystack, $needle){
return strpos($haystack, stristr( $haystack, $needle ));
}
}
if (isset($_POST['submit_form'])) {
$message = "";
$subject = "Unknown Name";
while (list($key, $value) = each($_POST)) {
if (stripos($key, "form_") === 0) {
if ($key == $form_settings['subject_key']) {
$subject = $form_settings['subject_prefix'].stripinput($value);
}
$new_key = str_replace("form_", "", $key);
$new_key = str_replace("_", " ", $new_key);
$new_key = ucfirst(strtolower($new_key));
$message .= "[b]$new_key:[/b]\n".stripinput($value)."\n\n";
}
}
$result = dbquery("INSERT INTO ".DB_THREADS." (
forum_id,
thread_subject,
thread_author,
thread_views,
thread_lastpost,
thread_lastpostid,
thread_lastuser,
thread_postcount,
thread_poll,
thread_sticky,
thread_locked
) VALUES (
'".$form_settings['forum_id']."',
'".$subject."',
'".$userdata['user_id']."',
'0',
'".time()."',
'0',
'".$userdata['user_id']."',
'1',
'0',
'0',
'0'
)");
$thread_id = mysql_insert_id();
$result = dbquery("INSERT INTO ".DB_POSTS." (
forum_id,
thread_id,
post_message,
post_showsig,
post_smileys,
post_author,
post_datestamp,
post_ip,
post_edituser,
post_edittime
) VALUES (
'".$form_settings['forum_id']."',
'".$thread_id."',
'".$message."',
'1',
'1',
'".$userdata['user_id']."',
'".time()."',
'".USER_IP."',
'0',
'0'
)");
$post_id = mysql_insert_id();
$result = dbquery("UPDATE ".DB_FORUMS." SET forum_lastpost='".time()."', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastuser='".$userdata['user_id']."' WHERE forum_id='".$form_settings['forum_id']."' LIMIT 1");
$result = dbquery("UPDATE ".DB_THREADS." SET thread_lastpostid='".$post_id."' WHERE thread_id='".$thread_id."' LIMIT 1");
$result = dbquery("UPDATE ".DB_USERS." SET user_posts=user_posts+1 WHERE user_id='".$userdata['user_id']."' LIMIT 1");
redirect(BASEDIR."forum/viewthread.php?thread_id=".$thread_id."&pid=".$post_id."#post_".$post_id);
}
$country_list = array(
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bhutan",
"Bolivia",
"Bosnia and Herzegovina",
"Botswana",
"Brazil",
"Brunei",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cambodia",
"Cameroon",
"Canada",
"Cape Verde",
"Central African Republic",
"Chad",
"Chile",
"China",
"Colombi",
"Comoros",
"Congo (Brazzaville)",
"Congo",
"Costa Rica",
"Cote d'Ivoire",
"Croatia",
"Cuba",
"Cyprus",
"Czech Republic",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"East Timor (Timor Timur)",
"Ecuador",
"Egypt",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Ethiopia",
"Fiji",
"Finland",
"France",
"Gabon",
"Gambia, The",
"Georgia",
"Germany",
"Ghana",
"Greece",
"Grenada",
"Guatemala",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Honduras",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Iran",
"Iraq",
"Ireland",
"Israel",
"Italy",
"Jamaica",
"Japan",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"Korea, North",
"Korea, South",
"Kuwait",
"Kyrgyzstan",
"Laos",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macedonia",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Mauritania",
"Mauritius",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Morocco",
"Mozambique",
"Myanmar",
"Namibia",
"Nauru",
"Nepa",
"Netherlands",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Poland",
"Portugal",
"Qatar",
"Romania",
"Russia",
"Rwanda",
"Saint Kitts and Nevis",
"Saint Lucia",
"Saint Vincent",
"Samoa",
"San Marino",
"Sao Tome and Principe",
"Saudi Arabia",
"Senegal",
"Serbia and Montenegro",
"Seychelles",
"Sierra Leone",
"Singapore",
"Slovakia",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Swaziland",
"Sweden",
"Switzerland",
"Syria",
"Taiwan",
"Tajikistan",
"Tanzania",
"Thailand",
"Togo",
"Tonga",
"Trinidad and Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Vatican City",
"Venezuela",
"Vietnam",
"Yemen",
"Zambia",
"Zimbabwe"
);
$country_opts = ""; $sel = ""; $selected = "";
while(list($key, $country) = each($country_list)){
$sel = ($country == $selected ? " selected='selected'" : "");
$country_opts .= "<option".$sel.">".$country."</option>\n";
}
opentable("Application Form");
application_form($country_opts);
closetable();
echo "<!-- Application From Made by Starefossen @ <a href='http://dev.starefossen.com'>http://www.starefossen.com</a> -->";
require_once THEMES."templates/footer.php";
} else {
echo "<center><b>You cannot watch this content untill you are logged in.
<br><a href='index.php'>Go Back</a></b></center>
";
}
?>
A to sama końcówka, czyli } else { :
} else {
echo "<center><b>You cannot watch this content untill you are logged in.
<br><a href='index.php'>Go Back</a></b></center>
";
}
?>
Próbowałem tam dodać
require_once "maincore.php";
require_once THEMES."templates/header.php";
ale nic nie dało. Chyba moje umiejętności w HTML i PHP nie są wystarczające.
Proszę o pomoc, i pozdrawiam! |