Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Nov 2011
    Posts
    74
    Thanks
    4
    Thanked 0 Times in 0 Posts

    hide contact details

    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

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    Do a search on this. It's been answered billions and billions of times. Search bar just above your head.

  • #3
    New Coder
    Join Date
    Nov 2011
    Posts
    74
    Thanks
    4
    Thanked 0 Times in 0 Posts
    search for what?
    how is it called?
    do you think I would still ask if I knew what is called?

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    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:
    Code:
    <?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:
    Code:
    <?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.

  • #5
    New Coder
    Join Date
    Nov 2011
    Posts
    74
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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 Code:
    <?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($fir010).'***********<br />'.substr($firs06).'**************<br />'.substr($first012).'**********';

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




    PHP Code:
    session_start();
    $_SESSION['user']= 'yes';
        
    $id $_GET['id'];
        
    $fir $_GET['phone1'];
        
    $firs $_GET['phone2'];
        
    $first $_GET['adress'];
    $Message substr($fir010).'***********<br />'.substr($firs06).'**************<br />'.substr($first012).'**********'
    Last edited by _user; 02-24-2012 at 08:21 AM.

  • #6
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    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:
    Code:
    <?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:
    Code:
    <?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;
    }
    ?>

  • #7
    New Coder
    Join Date
    Nov 2011
    Posts
    74
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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
    Code:
    " SELECT * FROM table WHERE color LIKE  '%$color%'  AND  size LIKE '%$size%'"
    It list the query, and than I use
    PHP Code:
    <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)

  • #8
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    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...

  • #9
    New Coder
    Join Date
    Nov 2011
    Posts
    74
    Thanks
    4
    Thanked 0 Times in 0 Posts
    include connection
    defining strings
    query

    and

    PHP Code:
        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)"
    ?> 

  • #10
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    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?

  • #11
    New Coder
    Join Date
    Nov 2011
    Posts
    74
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •