Originally posted by arnage
View Post
(help)How to Create my Own Wapmaster Services?
Collapse
X
-
i know how to do it and i dont want to share it completely here.
demo here
Originally posted by arnage View PostNope, some other data needs to be displayed at this point, that information is useless for displaying as the user is just entered his name and site.
And we come to a paradox situation where someone who says that its "easy as 123" actualy shows that he doesn't have a clue what is needed to do next even after he got part of code done.
Also, $linkname var is not field name "Url" as URL stands for "Uniform Resource Locator" aka LINK, wich is the field below.
Var $linkname is field Linkname and $link is... guess what.
now corrected
Name : <?php echo $name;?>
Link Name: <?php echo $linkname; ?>
Link : <?php echo $link; ?>
Comment
-
Originally posted by soul_reaper View Postnot kidding bro ,but let him try ,then if is something he don`t know post here and someone would help :-D
For example, in this snipet that i wrote no one made a comment to explode delimiter (-) even though a site where we all now have the name coding-talk.com,
not to mention missed structure at header() or loop through file which is all basic... And look at this persistent caricature...
Originally posted by Ajmalrasi View Posti know how to do it and i dont want to share it completely here.
oops sorry
now corrected
Name : <?php echo $name;?>
Link Name: <?php echo $linkname; ?>
Link : <?php echo $link; ?><!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Comment
-
Sure, take your time. Anyway here is the complete example of snippet, if u have any question about it feel free to ask.
PHP Code:<?php
if (isset($_POST['submit'])) {
if (isset($_POST['name']) && isset($_POST['linkname']) && isset($_POST['link'])) {
$error = false;
if ($_POST['name'] == '') {
$error .= 'Name is empty<br/>';
}
if ($_POST['linkname'] == '') {
$error .= 'Linkname is empty<br/>';
}
if ($_POST['link'] == '') {
$error .= 'Link is empty<br/>';
} else {
if (!preg_match('/^(http:\/\/)?[a-z0-9-_.]+\.([a-z]{2,4})+$/D', $_POST['link'])) {
$error .= 'Invalid link format<br/>';
}
if (strpos($_POST['link'], 'http://') === false) {
$_POST['link'] = 'http://'.$_POST['link'];
}
}
$datafile = 'data/users.dat';
if (is_readable($datafile)) {
$handle = @fopen($datafile, 'r');
$output = fread($handle, filesize($datafile));
if ($output != '') {
for ($i = 0; $i < count($output); $i++) {
$data = explode(',', $output[$i]);
if ($data[0] == $_POST['name']) {
$error .= 'Name is token<br/>';
}
if ($data[1] == $_POST['linkname']) {
$error .= 'Linkname is token<br/>';
}
if (trim($data[2]) == $_POST['link']) {
$error .= 'Link is token<br/>';
}
}
}
fclose($handle);
} else {
echo 'Can\'t find data file<br/>';
return;
}
if (empty($error)) {
$name = (strlen($_POST['name']) <= 50)
? htmlentities(str_replace(',', ',', trim($_POST['name'])), ENT_QUOTES, 'UTF-8')
: htmlentities(str_replace(',', ',', substr(trim($_POST['name']), 0, 50)), ENT_QUOTES, 'UTF-8');
$linkname = (strlen($_POST['linkname']) <= 50)
? htmlentities(str_replace(',', ',', trim($_POST['linkname'])), ENT_QUOTES, 'UTF-8')
: htmlentities(str_replace(',', ',', substr(trim($_POST['linkname']), 0, 50)), ENT_QUOTES, 'UTF-8');
$link = (strlen($_POST['link']) <= 50)
? htmlentities(str_replace(',', ',', trim($_POST['link'])), ENT_QUOTES, 'UTF-8')
: htmlentities(str_replace(',', ',', substr(trim($_POST['link']), 0, 50)), ENT_QUOTES, 'UTF-8');
$writedata = "$name,$linkname,$link\n";
if (is_writeable($datafile)) {
$handle = @fopen($datafile, 'a');
fwrite($handle, $writedata);
fclose($handle);
echo 'Hello '.$name.', thank you for registering.<br/>Set this link to your site:<br/>
'.htmlentities('<a href="./service.php?link='.$link.'">'.$linkname.'</a>', ENT_QUOTES, 'UTF-8').'<br/>';
} else {
echo 'Can\'t find data file<br/>';
return;
}
} else {
echo $error;
unset($error);
}
}
} else {
echo '
Registration<br/>
<form method="post" action="./index.php" enctype="multipart/form-data">
<p>
Name: <br/>
<input type="text" name="name" maxlength="50" value=""/><br/>
Linkname: <br/>
<input type="text" name="linkname" maxlength="50" value=""/><br/>
Link: <br/>
<input type="text" name="link" maxlength="50" value=""/><br/>
<input type="submit" name="submit" value="Register"/>
</p>
</form>';
}
?>Last edited by arnage; 13.08.11, 15:10.<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Comment
-
i tried already the registration form and heres the result http://unliwap.net/services/form.php i didnt change anything tell me whats next
Comment
Comment