Files
Testing/motmquestions.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

70 lines
2.6 KiB
PHP

<?php
/* $Id: search_advanced.php 42 2009-01-29 04:55:14Z john $ */
ob_start();
$page = "general";
include "header.php";
// DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION
if($user->user_exists == 0 && $setting['setting_permission_search'] == 0)
{
$page = "error";
$smarty->assign('error_header', 639);
$smarty->assign('error_message', 656);
$smarty->assign('error_submit', 641);
include "footer.php";
}
function general()
{
global $user, $database;
if($_POST["save"]=="Save")
{
$database->database_query("DELETE FROM motm_answers WHERE motm_answers.user_id='".$user->user_info["user_id"]."'");
$x=0;
while($x<count($_POST["id"]))
{
$database->database_query("INSERT INTO motm_answers SET motm_answers.user_id='".$user->user_info["user_id"]."', question_id='".$_POST["id"][$x]."', answer='".$_POST["question"][$x]."'");
$x++;
}
header("Location: /profile.php?user=".$user->user_info["user_username"]);
exit;
}
$query=$database->database_query("SELECT motm_questions.*,motm_answers.answer, motm_answers.id as answer_id FROM motm_questions LEFT JOIN motm_answers ON motm_answers.question_id=motm_questions.id AND motm_answers.user_id='".$user->user_info["user_id"]."' WHERE motm_questions.active=1");
?><form method="post"><?
$x=0;
while($row=$database->database_fetch_array($query))
{
?><div><?=$row["question"]?><br /><input type="hidden" name="id[]" value="<?=$row["id"]?>" />
<textarea rows="6" cols="50" name="question[]" class="form-control"><?=$row["answer"]?></textarea></div><?
}
?><input type="submit" value="Save" name="save" />
</form>
<?
}
$smarty->assign('hidden', $hidden);
$smarty->assign_by_ref('signups', $group_files);
// ASSIGN VARIABLES AND INCLUDE FOOTER
$smarty->assign('introvids', $introvids);
$smarty->assign('for', $for);
$smarty->assign('users', $user_array);
$smarty->assign('total_users', $total_users);
$smarty->assign('maxpage', $page_vars[2]);
$smarty->assign('p', $page_vars[1]);
$smarty->assign('p_start', $page_vars[0]+1);
$smarty->assign('p_end', $page_vars[0]+count($user_array));
$smarty->assign('showfields', $showfields);
$smarty->assign('url_string', $url_string);
$smarty->assign('linked_field_title', $linked_field_title);
$smarty->assign('linked_field_value', $linked_field_value);
$smarty->assign('cats_menu', $cat_menu_array);
$smarty->assign('cat_selected', $cat_selected);
$smarty->assign('cats', $cat_array);
$smarty->assign('sort', $sortby);
$smarty->assign('task', $task);
$smarty->assign('user_online', $user_online);
$smarty->assign('user_withphoto', $user_withphoto);
include "footer.php";
?>