<?php require_once 'linkclass.php'; if (isset($_GET['code'])) { $s = new mylink(); $code = $_GET['code']; if ($url = $s->getlink($code)) { header('Location:{$url}'); die; } } header('Location:index.php');
<?php session_start(); require_once 'linkclass.php'; $s = new mylink(); if (isset($_POST['url'])) { $url = $_POST['url']; if ($code = $s->makecode($url)) { $_SESSION['resulte'] = "your new link is <a href=\"http://127.0.0.1/link/{$code}\">http://127.0.0.1/link/{$code}</a>"; } else { $_SESSION['resulte'] = "there is problem"; } } header('Location:index.php');