-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.php
More file actions
27 lines (25 loc) · 797 Bytes
/
script.php
File metadata and controls
27 lines (25 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: login.php");
exit;
}
?>
<?php
//index.php
//Title - Make @ system by using Regular Expression
function convertHashtoLink($string)
{
$expression = "/#+([a-zA-Z0-9_]+)/";
$string = preg_replace($expression, '<a href="user.php?search=$1">$0</a>', $string);
return $string;
}
$string = "#fabian creador de este engendro<br />";
$string .= '#bart soy un pilluelo<br />';
$string .= "#myuniverso webunderground<br />";
//<a href="">PHP</a>
$string = convertHashtoLink($string);
echo $string;
?>