mirror of
				https://github.com/pikami/palm-paste.git
				synced 2025-10-30 14:28:06 +00:00 
			
		
		
		
	People can now view pastes!
This commit is contained in:
		
							parent
							
								
									d1019f8df6
								
							
						
					
					
						commit
						31ae9de368
					
				
							
								
								
									
										13
									
								
								ViewPaste.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								ViewPaste.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| <div class="panel panel-default"> | ||||
|   <div class="panel-body"> | ||||
| <?php | ||||
| if(isset($id)){ | ||||
| 	include "config/config.php"; | ||||
| 	$stmt = $conn->query('SELECT * FROM pastes WHERE id='.$id); | ||||
| 	$result = $stmt->fetch(PDO::FETCH_ASSOC); | ||||
| 	echo "<h1>".$result["title"]."</h1>"; | ||||
| 	echo "<textarea class=\"form-control\" rows=\"5\" disabled=\"true\">".$result["text"]."</textarea>"; | ||||
| } else echo "Error: id not set"; | ||||
| ?>
 | ||||
|   </div> | ||||
| </div> | ||||
							
								
								
									
										6
									
								
								post.php
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								post.php
									
									
									
									
									
								
							| @ -1,10 +1,8 @@ | ||||
| <?php | ||||
| include "config/config.php"; | ||||
| if(isset($_POST["type"])){ | ||||
| 	echo "TYPE!"; | ||||
| 	//===New_Paste===//
 | ||||
| 	if($_POST["type"]=="paste" && isset($_POST["text"])){ | ||||
| 		echo "TEXT!"; | ||||
| 		/* Set paste details */ | ||||
| 		$title = "Untitled"; | ||||
| 		$text = $_POST["text"]; | ||||
| @ -16,9 +14,11 @@ if(isset($_POST["type"])){ | ||||
| 		$stmt->bindParam(':tit', $title); | ||||
| 		$stmt->bindParam(':txt', $text); | ||||
| 		$stmt->execute(); | ||||
| 		$id = $conn->lastInsertId(); | ||||
| 		$conn = null; //close connection to database
 | ||||
| 		header("Location: ".$id); | ||||
| 		die(); | ||||
| 	} | ||||
| } | ||||
| echo "FIN!"; | ||||
| $conn = null; | ||||
| ?>
 | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user