...

View Full Version : hide contact details



_user
02-21-2012, 10:59 AM
I want to hide letters from a text and reveal them when I click a button.

I have contact details which I want to look like this:

contact@yo***********
+49089**************
Street. Kenn**********


and when I click "Show contact" I want to show the entire words.

Ty

sunfighter
02-21-2012, 04:02 PM
Do a search on this. It's been answered billions and billions of times. Search bar just above your head.

_user
02-21-2012, 04:15 PM
search for what?
how is it called?
do you think I would still ask if I knew what is called?

sunfighter
02-23-2012, 08:18 PM
OK. I've been called name on this and don't want things to escalate any further.
This is how I would do this. I assume only some users will be able to see the entire text without the *'s so I have used ajax, checked for authorization, and changed the div display.
Two files. This is the called php
test_3.php:

<?php
session_start();
$fir = "contact@yourmommas.com";
$firs = "+4908909876545678";
$first = "Street. Kenny Ave. West Burrow, N.M.";
$NewMessage = $fir . '<br />' . $firs . '<br />' . $first;
$Message = substr($fir, 0, 10).'***********<br />'.substr($firs, 0, 6).'**************<br />'.substr($first, 0, 12).'**********';

if($_SESSION["user"] == 'yes')
{
echo $NewMessage;
}else{
echo $Message;
}
?>


This is the main page
local.php:

<?php
session_start();
$_SESSION['user']= 'yes';
$fir = "contact@yourmommas.com";
$firs = "+4908909876545678";
$first = "Street. Kenny Ave. West Burrow, N.M.";
$Message = substr($fir, 0, 10).'***********<br />'.substr($firs, 0, 6).'**************<br />'.substr($first, 0, 12).'**********';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>New document</title>
<script type="text/javascript">
function Show_words()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("home").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","test_3.php",true);
xmlhttp.send('');
}
</script>
</head>

<body>
<div id="home">
<?php
echo $Message;
?>
</div>
<input type="button" value="Reveal" onclick="Show_words();" />
<div id="hot"></div>
</body>
</html>

Walking hand in hand. Hope this helps. :o

_user
02-24-2012, 06:34 AM
yes its ok. and thank you.
but I have a problem...
what if the contacts are called from a db using autogenerated links?
how can I get rid of test php?

I have tried this... but doesn't work.



<?php

include 'connect.php';

session_start();
$id = $_GET['id'];
$fir = $_GET['phone1'];
$firs = $_GET['phone2'];
$first = $_GET['adress'];
$NewMessage = $fir . '<br />' . $firs . '<br />' . $first;
$Message = substr($fir, 0, 10).'***********<br />'.substr($firs, 0, 6).'**************<br />'.substr($first, 0, 12).'**********';

if($_SESSION["user"] == 'yes')
{
echo $NewMessage;
}else{
echo $Message;
}
?>








session_start();
$_SESSION['user']= 'yes';
$id = $_GET['id'];
$fir = $_GET['phone1'];
$firs = $_GET['phone2'];
$first = $_GET['adress'];
$Message = substr($fir, 0, 10).'***********<br />'.substr($firs, 0, 6).'**************<br />'.substr($first, 0, 12).'**********';

sunfighter
02-24-2012, 02:30 PM
what if the contacts are called from a db using autogenerated links?
What are autogenerated links?
Second this was made to get info from a db. Where else would it come from if you wanted it to be secret?


how can I get rid of test php? Don't know what you mean here either. Are you talking about the message strings? Are you talking about the file test_3.php? That is not a 'test' file, it's what the ajax function calls. It is necessary, you can rename it if you want and you should. Remember to change it in local.php also.

You should use different names for the codes not just 'php code'. I'm gonna call the top/first one local.php, OK? Why did you change it like that? You are not accessing a db but getting info from a form. Who's filling the form if it's not the user looking at the page.
local.php top sction:

<?php
session_start(); // get into the habit session_start FIRST LINE
include 'connect.php';
$_SESSION['user']= 'yes'; // This is really set when you log user and give him/her privileges

/* Query your db here!!!!!!! */

$row[0] = "contact@yourmommas.com"; // values added here by me because I don't have access to your db.
$row[1] = "+4908909876545678"; // You get these values from the above query
$row[2] = "+1234567890987654";
$row[3] = "Street. Kenny Ave. West Burrow, N.M.";
$Message = substr($row[0], 0, 10).'***********<br />'.substr($row[1], 0, 6).'**************<br />'.substr($row[2], 0, 6).'**************<br />'.substr($row[3], 0, 12).'**********';
?>

Your test_3.php:

<?php
session_start();
include 'connect.php';
/*$_SESSION['user']= 'yes';*/ // This is set in your online pages Not Here

/* Query your db here!!!!!!! */

$row[0] = "contact@yourmommas.com";
$row[1] = "+4908909876545678";
$row[2] = "+1234567890987654";
$row[3] = "Street. Kenny Ave. West Burrow, N.M.";
$NewMessage = $row[0] . '<br />' . $row[1] . '<br />' . $row[2] . '<br />' . $row[3];
$Message = substr($row[0], 0, 10).'***********<br />'.substr($row[1], 0, 6).'**************<br />'.substr($row[2], 0, 6).'**************<br />'.substr($row[3], 0, 12).'**********';
if($_SESSION["user"] == 'yes')
{
echo $NewMessage;
}else{
echo $Message;
}
?>

_user
02-24-2012, 03:22 PM
I have a dropdown menu from where users selects 2 words and make a search for them. (color and size)
the query is something like that
" SELECT * FROM table WHERE color LIKE '%$color%' AND size LIKE '%$size%'"

It list the query, and than I use

<a href=\"product.php?id=" . $row['ID'] . "\">

and this is "autogenerated link" :) because it's not a file and I don't know how to call it :)

so....

on product.php?id=1
i list data from db including contact details.
and I try to transform "your data" (your example: contact@yourmommas.com) in strings to call from db same time with the rest of the info (description, etc) listed automatic on product.php?id=1


test = test_3.php


the code works fine...
but I can't adapt it to my needs... or... I don't know how.... yet ! (still tryin and learning)

sunfighter
02-24-2012, 11:30 PM
Post the code you are going to use to populate the Xd out strings.
Don't use SELECT *
select the items you want like
SELECT 'id', 'phone1', 'phone2', 'adress' FROM .... WHERE...

_user
02-25-2012, 08:47 AM
include connection
defining strings
query

and



if(!isset($_POST['submit'])) {
if (!is_numeric($_GET['id'])) {
die("Oh dear. Non-numeric id detected");
}
$q = "SELECT * FROM table WHERE ID = $_GET[id]";
$result = mysql_query($q);

}

echo " <table width='100%' border='0'>";
while($row = mysql_fetch_array($result)){
echo "blablablabla (here is populating the page)"
} ?>

sunfighter
02-25-2012, 03:03 PM
OK, I give up. Your going to get information WHERE ID = $_GET[id] and then hide it from $_GET[id] with xxx's. It makes no sense. Why hid something he knows?

_user
02-26-2012, 10:49 AM
I don't know what you don't understand. I don't know how to explain otherwise.
The point is that I wanna count how many times a user acces a contact details of each page. I don't wan't count views of page, just how many time he acces the contact details. Now makes sens?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum