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:
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?
Quote:
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;
}
?>
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)
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...
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)"
} ?>
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?
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?