Should be the final commit

Took 36 minutes
This commit is contained in:
Tobias Hopp 2020-10-03 20:35:44 +02:00
parent f6d2e3a62a
commit 7a6688a4a6
4 changed files with 25 additions and 16 deletions

28
.idea/workspace.xml generated
View File

@ -19,13 +19,11 @@
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="fc13552d-b118-4828-b78f-fc8714e0cfdc" name="Default Changelist" comment="">
<list default="true" id="fc13552d-b118-4828-b78f-fc8714e0cfdc" name="Default Changelist" comment="Fixing a little things">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config.inc.php" beforeDir="false" afterPath="$PROJECT_DIR$/config.inc.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/controller/DefaultController.class.inc.php" beforeDir="false" afterPath="$PROJECT_DIR$/controller/DefaultController.class.inc.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/controller/FaqController.class.inc.php" beforeDir="false" afterPath="$PROJECT_DIR$/controller/FaqController.class.inc.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/faq.tmpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/faq.tmpl.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/test.tmpl.html" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/model/DefaultModel.class.inc.php" beforeDir="false" afterPath="$PROJECT_DIR$/model/DefaultModel.class.inc.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/model/FaqModel.class.inc.php" beforeDir="false" afterPath="$PROJECT_DIR$/model/FaqModel.class.inc.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -36,7 +34,7 @@
<execution />
</component>
<component name="DarkyenusTimeTracker">
<option name="totalTimeSeconds" value="117043" />
<option name="totalTimeSeconds" value="119203" />
<option name="gitIntegration" value="true" />
<option name="naggedAbout" value="1" />
</component>
@ -80,7 +78,7 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1601618466935</updated>
<workItem from="1601618467981" duration="33029000" />
<workItem from="1601618467981" duration="35579000" />
</task>
<task id="LOCAL-00001" summary="Initial commit">
<created>1601618764031</created>
@ -131,7 +129,14 @@
<option name="project" value="LOCAL" />
<updated>1601724613157</updated>
</task>
<option name="localTasksCounter" value="8" />
<task id="LOCAL-00008" summary="Fixing a little things">
<created>1601747583143</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1601747583143</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -155,7 +160,8 @@
<MESSAGE value="Almost done, finish line!" />
<MESSAGE value="Fixing a bug where the answer is posted directly" />
<MESSAGE value="Final upload, should be running now" />
<option name="LAST_COMMIT_MESSAGE" value="Final upload, should be running now" />
<MESSAGE value="Fixing a little things" />
<option name="LAST_COMMIT_MESSAGE" value="Fixing a little things" />
</component>
<component name="WindowStateProjectService">
<state x="728" y="326" width="800" height="683" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1601632929047">
@ -194,10 +200,10 @@
<screen x="0" y="34" width="1920" height="1046" />
</state>
<state x="441" y="192" width="1037" height="736" key="SettingsEditor/0.34.1920.1046@0.34.1920.1046" timestamp="1601632853044" />
<state x="555" y="292" width="800" height="535" key="Vcs.Push.Dialog.v2" timestamp="1601724614655">
<state x="555" y="292" width="800" height="535" key="Vcs.Push.Dialog.v2" timestamp="1601747662084">
<screen x="0" y="34" width="1920" height="1046" />
</state>
<state x="555" y="292" width="800" height="535" key="Vcs.Push.Dialog.v2/0.34.1920.1046@0.34.1920.1046" timestamp="1601724614655" />
<state x="555" y="292" width="800" height="535" key="Vcs.Push.Dialog.v2/0.34.1920.1046@0.34.1920.1046" timestamp="1601747662084" />
<state x="809" y="122" width="639" height="876" key="com.intellij.database.view.ui.AbstractDbRefactoringDialog" timestamp="1601632983240">
<screen x="0" y="34" width="1920" height="1046" />
</state>

View File

@ -8,4 +8,4 @@ define( 'MYSQL_DB', 'online-faq' );
define( 'CODE_LENGTH', 4 );
define( 'SHARE_URL_PREFIX', 'https://faq.hw-table.de/?code=' );
define( 'WASTED_TIME', '32hrs and 32mins' );
define( 'WASTED_TIME', '33hrs and 7mins' );

View File

@ -31,11 +31,13 @@ class DefaultModel
public function createRoom(string $room_name)
{
$room_owner = session_id();
$stmnt = Database::getConnection()->prepare( 'INSERT INTO rooms ( name, owner_sid, code ) VALUES ( :name, :owner, :code )' );
$stmnt->execute( array( 'name' => $room_name, 'owner' => $room_owner, 'code' => $this->generateRandomStr( CODE_LENGTH ) ) );
$secret = $this->generateRandomStr( 15 );
$stmnt = Database::getConnection()->prepare( 'INSERT INTO rooms ( name, owner_sid, code ) VALUES ( :name, :owner_sid, :code )' );
$stmnt->execute( array( 'name' => $room_name, 'owner_sid' => $secret, 'code' => $this->generateRandomStr( CODE_LENGTH ) ) );
$id = Database::getConnection()->lastInsertId( );
setcookie( 'owner_room_' . $id, $secret, time()+60*60*24*365 );
if( empty( $id ) )
{
return false;

View File

@ -89,7 +89,8 @@ class FaqModel
{
return false;
}
if( $result['owner_sid'] === session_id() )
$secret = empty( $_COOKIE['owner_room_' . $a_room['id'] ] ) ? null : $_COOKIE['owner_room_' . $a_room['id'] ];
if( $result['owner_sid'] === $secret )
{
return true;
}