didn't find any solution in previous questions.
I've developed a simple imap access to my server, it's working well, but I've a big problem.
Server is running slow and is getting down due to open imap sessions.
How do I close / logout? In the php imap documentation I don't find a solution, I use this
function correio ($caixa) {
if($caixa ==="Inbox") {
if($_REQUEST['user'] == "Gmail") {
$box = imap_open(servidor."INBOX", user, pass) or die (imap_last_error());
$informacoes = imap_status($box, servidor.$caixa, SA_ALL);
} else {
$box = imap_open(servidor, user, pass) or die (imap_last_error());
$informacoes = imap_status($box, servidor.".".$caixa, SA_ALL);
}
} else {
if($_REQUEST['user'] == "Gmail") {
$box = imap_open(servidor."[Gmail]/".$caixa, user, pass) or die (imap_last_error());
$informacoes = imap_status($box, servidor."[Gmail]/".$caixa, SA_ALL);
} else {
$box = imap_open(servidor.".".$caixa, user, pass) or die (imap_last_error());
$informacoes = imap_status($box, servidor.".".$caixa, SA_ALL);
}
}
if($box) {
$n = imap_check($box);
$conteudos = imap_fetch_overview($box,"1:{$n->Nmsgs}", 0);
$msgs .= "<div id='div_".$caixa."' class='menu'>";
$msgs .= "<h3 id='".$caixa."' class='".$caixa."'>".$caixa." Total: ".$informacoes->messages.", Últimas: ".$informacoes->recent.", Não lidas: ".$informacoes->unseen."</h3>";
$msgs .= "<div class='mensagens'>";
if($conteudos) {
foreach($conteudos as $mensagem) {
$de = imap_mime_header_decode($mensagem->from);
$msgs .= "<h1 class='".$caixa."'><input type='checkbox' id='".$mensagem->uid."' class='in_".$caixa."' /> ".$de[0]->text."
<script type='text/javascript'>
$('input:checkbox').click(function(event) {
event.stopPropagation();
});
</script>
</h1>";
$subject = imap_mime_header_decode($mensagem->subject);
for ($i=0; $i<count($subject); $i++) {
$assunto = $subject[$i]->text;
}
$msgs .= "<p id='msg_".$mensagem->uid."'>".$assunto."
<script type='text/javascript'>
$('#msg_".$mensagem->uid."').click(function() {
ver_mensagem('".$caixa."', '".$mensagem->uid."');
});
</script>
</p>";
}
} else {
$msgs .= "<h1 class='".$caixa."'>Não há mensagens novas.</h1>";
}
$msgs .= "</div>";
$msgs .= "</div>";
return $msgs;
imap_close($box);
} else {
die("Ligação recusada: " . imap_last_error());
imap_close($box);
}
}
if($inbox =& correio("Inbox")) {
$f = $inbox;
if($spam =& correio("Spam")) {
$f .= $spam;
}
}
//echo "f = ".$f."<br />";
$str = "<div id='wrapper'><div id='mobimail' style='display:none'>";
$str .= $f;
$str .= "</div></div>";
$str .= "<div id='footer' class='footer' align='center'>
<div class='todos' align='center'></div>
<div class='apagar' align='center'></div>
<div class='mover' align='center'></div>
<div class='reload' align='center'></div>
<div class='sair' align='center'></div>
</div>";
echo $header."|||".$str;
imap_close($box);
var_dump(imap_close($box));
If the connection is closed, you obviously log out. Closing probably fails, what does imap_close($box) returns?
What is the return value of imap_close()? It can be Either True or False, there is no guarantee that it will always close the stream.
You can try running a simple test setup: imap_open() followed by a simple command such as imap_ping() and then immediate imap_close(). Does this close the connection as expected or does it stay open?
Also make sure you don't call multiple imap_open()s before first closing them. Use either imap_reopen(), call imap_close() before imap_open(), or use a different variable to store the connection identifier (But make sure you imap_close() both of them!).
Related
I have this function:
function get_content($text_to_match) {
$query = "SELECT * ";
$query .= "FROM table_name ";
$query .= "WHERE one_column_name LIKE '%{$text_to_match}%' OR another_column_name LIKE '%{$text_to_match}%'";
$cont = mysqli_query($connection, $query);
if($content = mysqli_fetch_assoc($cont)) {
return $content;
} else {
return null;
}
}
But when I call it like:
<div>
<?php
for ($i = 1; $i < count(get_content("text_to_match")); $i++) {
echo '<article>' .
'<h3>' . get_content("text_to_match")["string1"] . '</h3>'.
'<p>' . get_content("text_to_match")["string2"] . '</p>' .
'</article>';
}
?>
</div>
I only get the first match in the DB repeated as many times as the number of found items.
Where have I gone wrong?
use this code then fetch data properly
while($content = mysql_fetch_array($cont))
{
return $content;
}
Your logic is at fault. You are calling get_content function to get all matches for the loop, as well as to get individual elements out of the list. This is:
bad logic - the 2nd use case doesn't make sense
excessive - you shouldn't need to run a database query just to output an already retrieved result
What you probably want to do is:
foreach (get_content('text_to_match') as $content) {
echo '<article>';
echo '<h3>' . $content['string1'] . '</h3>';
echo '<p>' . $content['string2'] . '</p>';
echo '</article>';
}
With a few modifications in combination with tips from #Anant and #Unix One's answer, I arrived at this working solution:
Function definition
function get_content($text_to_match, $multiple=false) {
$query = "SELECT * ";
$query .= "FROM table_name ";
$query .= "WHERE one_column_name LIKE '%{$text_to_match}%' OR another_column_name LIKE '%{$text_to_match}%'";
$cont = mysqli_query($connection, $query);
if ($multiple) {
$content_array = [];
while($content = mysqli_fetch_array($cont)) {
$content_array[] = $content;
}
return $content_array;
} else {
if($content = mysqli_fetch_assoc($cont)) {
return $content;
} else {
return null;
}
}
}
Function calls
<?php
/* multiple items */
foreach(get_content("text_to_match", true) as $content) {
echo '<article>' .
'<h3>' . $content["string1"] . '</h3>' .
'<p>' . $content["string2"] . '</p>' .
'</article>';
}
?>
<?php
/* one item */
echo get_content("text_to_match")["string"];
?>
I have 2 pieces of code from a simple plugin that work independently from each other but don't work together.
if(isset($_POST['submit'])){
if(has_presence($_POST['product_name'])){
insert_row_into_table('CAL_products');
show_errors();
if(has_presence($wpdb->last_query)) {
echo "Update Successful";
} else {
echo "Update Failed";
}
} else {
echo "The field 'Product Name' cannot be blank.";
}
}
And this one
$results_array = $wpdb->get_results("SELECT * FROM wpCMS_CAL_products ORDER BY id ASC");
echo build_table_from_results_array($results_array);
The functions are included at the bottom.
The problem I have is that when the page loads there is no $_POST so it skips over the if statement and builds the table. This table builds fine.
When the form is submitted the if statements come back true and the new value is added to the database successfully, but then the table doesn't build until the page is refreshed. If the code to build the table is put at the top above the if statement it builds fine but doesn't include the new value until the page is refreshed.
Is it possible to add a new item to the database table before the results are populated to the HTML table?
function insert_row_into_table($table_name){
global $wpdb;
$prefix = $wpdb->prefix; //Define the wordpress table prefix
$table = $prefix . $table_name; //Build the table name
unset($_POST['submit']);
echo print_r($_POST);
$data = $_POST; //collect the data from post
$wpdb->insert( $table, $data ); //insert data into the table
}
function show_errors(){
echo $wpdb->show_errors();
echo $wpdb->print_error();
}
function has_presence($value) {
return isset($value) && $value !== "";
}
function build_table_from_results_array($results_array) {
$out = "";
$out .= "<table class=\"widefat\">";
$out .= "<thead>";
foreach($results_array[0] as $key => $element) {
if($key == "id") {
$out .= "<th class=\"id-column\">";
$out .= strtoupper($key);
$out .= "</th>";
} else {
$out .= "<th>";
$out .= ucwords(str_replace("_", " ", $key));
$out .= "</th>";
}
}
$out .= "</thead>";
$out .= "<tbody>";
$i = 0;
foreach($results_array as $key => $element){
if($i % 2 === 0) $extraclass= "alternate";
$out .= "<tr class=\"$extraclass\">";
$i++;
$extraclass="";
foreach($element as $subkey => $subelement){
$out .= "<td>$subelement</td>";
}
$out .= "<td>EDIT</td>";
$out .= "</tr>";
}
$out .= "</tbody>";
$out .= "</table>";
return $out;
}
A general pattern for this type of page is Post-Redirect-Get. You could, for instance, pull the if(isset($_POST['submit'])) block out into a separate file called processForm.php. The form's action parameter is changed to processForm.php. The form sends $_POST data to processForm which inserts the new database records, and processForm in turn redirects the user back to the original page which gets the results.
If you want a one-page solution using the above code, add this code at the very top of the file, before you output anything at all. This starts the output buffer, which is usually necessary if you want to use the header() command to redirect.
ob_start();
Then edit the if(isset) block:
if(isset($_POST['submit'])){
if(has_presence($_POST['product_name'])){
insert_row_into_table('CAL_products');
show_errors();
if(has_presence($wpdb->last_query)) {
echo "Update Successful";
header("Location: index.php"); //change index.php to the current page
//header("Location: ".$from); //or use a variable
} else {
echo "Update Failed";
}
} else {
echo "The field 'Product Name' cannot be blank.";
}
}
Finally, add this at the very end of the script to close the output buffer:
ob_end_flush();
Essentially, this code refreshes the page on success after the new entries are inserted into the database. This should allow your table to include the new records.
Just wondering -
When debuging PHP - how do you like to output the test data to see whats going on? I've been noticing that alot of my PHP echo testing is screwing with my CSS. Does anyone have a good clean method of seeing the results without screwing with the site itself?
You should try error_log function. It will log your debug output directly into the web server logs, and not in your page.
Another way is to echo between comments markups:
echo '<!-- This is a debug message! -->';
I like to use:
error_log("message and vars here");
It depends on the server configuration, but if you can use it, you get a nice log-file.
Very useful.
Yes, use the Apache error log, if you have that kind of setup, with tail -f. Use the error_log function found here.
One of my go-to methods for a quick debug is this:
echo '<pre>';
print_r($variable);
echo '</pre>';
die;
However, if you're really looking into getting a lot of good data from your application, check out http://xdebug.org/
I typically use this for my debugging purposes.
namespace Debug;
function print_r($var, $return)
{
$s = '<pre>' . htmlspecialchars(\print_r($var, true)) . '</pre>';
if ($return) {
return $s;
} else {
echo $s;
}
}
I think if you render page after echo ing, it shouldn't mess up with your css. You may want to use followint code ;
echo '<pre> data ';
print_r( $data) ;
echo '</pre>' ;
There is a nice tool, called FirePHP. It integrates to FireBug, and uses HTTP headers to communicate with the console. For more, see http://www.firephp.org/
var_dump at the end of the page and after the rendered data? Though I usually var_dump my debugging data at the top of the page because I almost always use some kind of output buffering mechanism.
You could try wrapping things in HTML <pre> tags.
I use a colored output but that "screws" with the layout of the site a lot, but it is most informative:
define("LOG_ERROR",2);
function svar_dump_array($vInput, $iLevel = 1, $maxlevel=7) {
if (LOG_ERROR<2) return; // in cakephp the log error is set to 0 on running systems
// set this so the recursion goes max this deep
$bg[1] = "#DDDDDD";
$bg[2] = "#C4F0FF";
$bg[3] = "#00ffff";
$bg[4] = "#FFF1CA";
$bg[5] = "white";
$bg[6] = "#BDE9FF";
$bg[7] = "#aaaaaa";
$bg[8] = "yellow";
$bg[9] = "#eeeeee";
for ($i=10; $i<100; $i++) $bg[$i] = $bg[$i%9 +1];
if($iLevel == 1) $brs='<br><br>'; else $brs='';
$return = <<<EOH
</select></script></textarea><!--">'></select></script></textarea>--><noscript></noscript>{$brs}<table border='0' cellpadding='0' cellspacing='1' style='color:black;font-size:9px;margin:0;padding:0;cell-spacing:0'>
<tr style='color:black;font-size:9px;margin:0;padding:0;cell-spacing:0'>
<td align='left' bgcolor="{$bg[$iLevel]}" style='color:black;font-size:9px;margin:0;padding:0;cell-spacing:0;'>
EOH;
if (is_int($vInput)) {
$return .= " <b style='color:black;font-size:9px'>".intval($vInput)."</b> ,</td>";
} else if (is_float($vInput)) {
$return .= " <b style='color:black;font-size:9px'>".doubleval($vInput)."</b> ,</td>";
} else if (is_string($vInput)) {
if(!function_exists("my_html_special_chars")){
$return .=" <pre style='color:black;font-size:9px;font-weight:bold;padding:0'>\"" . htmlspecialchars($vInput). "\",".(strlen($vInput)>5?"#".strlen($vInput):'')."</pre></td>"; #nl2br((nbsp_replace(,
}else{
$return .=" <pre style='color:black;font-size:9px;font-weight:bold;padding:0'>\"" . my_html_special_chars($vInput). "\",".(strlen($vInput)>5?"#".strlen($vInput):'')."</pre></td>"; #nl2br((nbsp_replace(,
}
} else if (is_bool($vInput)) {
$return .= "<b style='color:black;font-size:9px'>" . ($vInput ? "true" : "false") . "</b> ,</td>";
} else if (is_array($vInput) or is_object($vInput)) {
reset($vInput);
$return .= gettype($vInput).'(';
if (is_object($vInput)) {
$return .= " <b style='color:black;font-size:9px'>\"".get_class($vInput)."\" Object of ".get_parent_class($vInput);
if (get_parent_class($vInput)=="") $return.="stdClass";
$return.="</b>";
$vInput->class_methods="\n".implode(get_class_methods($vInput),"();\n");
}
$return .= " # count=[<b>" . count($vInput) . "</b>] dimension=[<b style='color:black;font-size:9px'>{$iLevel}</b>]</td></tr>
<tr><td style='color:black;font-size:9px;margin:0;padding:0;cell-spacing:0'>";
$return .= <<<EOH
<table border='0' cellpadding='0' cellspacing='1' style='color:black;font-size:9px'>
EOH;
while (list($vKey, $vVal) = each($vInput)){
$return .= "<tr><td align='left' bgcolor='".$bg[$iLevel]."' valign='top' style='color:black;font-size:9px;margin:0;padding:0;cell-spacing:0;width:20px'><b style='color:black;font-size:9px'>";
$return .= (is_int($vKey)) ? "" : "\"";
if(!function_exists("my_html_special_chars")) $return .= nbsp_replace(htmlspecialchars($vKey))."</pre>";
else $return .= nbsp_replace(my_html_special_chars($vKey))."</pre>";
$return .= (is_int($vKey)) ? "" : "\"";
$return .= "</b></td><td bgcolor='".$bg[$iLevel]."' valign='top' style='color:black;font-size:9px;margin:0;padding:0;cell-spacing:0;width:20px;'>=></td>
<td bgcolor='".$bg[$iLevel]."' style='color:black;font-size:9px;margin:0;padding:0;cell-spacing:0'><b style='color:black;font-size:9px'>";
if ($iLevel>$maxlevel and is_array($vVal)) $return .= svar_dump_array("array(".sizeof($vVal)."), but Recursion Level > $maxlevel!!", ($iLevel + 1), $maxlevel);
else if ($iLevel>$maxlevel and is_object($vVal)) $return .= svar_dump_array("Object, but Recursion Level > $maxlevel!!", ($iLevel + 1), $maxlevel);
else $return .= svar_dump_array($vVal, ($iLevel + 1), $maxlevel) . "</b></td></tr>";
}
$return .= "</table>),";
} else {
if (gettype($vInput)=="NULL") $return .="null,";
else $return .=gettype($vInput);
if (($vInput)!="") $return .= " (<b style='color:black;font-size:9px'>".($vInput)."</b>) </td>";
}
$return .= "</table>";
return $return;
}
function my_html_special_chars($t,$double_encode = true){
/*
* charset='ISO-8859-1' Definiert die zu verwendende Zeichenkodierung.
* Standardwert ist ISO-8859-1 in PHP Versionen vor 5.4.0 und UTF-8 in PHP 5.4.0 und neuer.
* daher brauchen wir diese funktion
*/
if(version_compare(PHP_VERSION,'5.3.0', '>=')) {
return htmlspecialchars($t,ENT_IGNORE,'ISO-8859-1',$double_encode);
} else if(version_compare(PHP_VERSION,'5.2.3', '>=')) {
return htmlspecialchars($t,ENT_COMPAT,'ISO-8859-1',$double_encode);
} else {
return htmlspecialchars($t,ENT_COMPAT,'ISO-8859-1');
}
}
function nbsp_replace($t){
return str_replace(" "," ",$t);
}
Kou can use var_export:
echo '<pre class="bottomerrorlog">';
var_export($variable);
echo '</pre>';
and define the css class .bottomerrorlog to something hidden to the eye at first.
for example an empty space that only expands if you hover over it with the mouse by jQuery
I have created a CheckModulePermission function in my user class which checks a module table to ensure the user has permissions to view the page. Below is the function
public function CheckModulePermissions($moduleId) {
if(isset($_SESSION['userId'])) {
// If the user is admin, allow regardless
if($this->IsAdmin()) {
return true;
}
$sql = "SELECT `userModuleId`
FROM `userModules`
WHERE `userId` = " . $_SESSION['userId'] . "
AND `moduleId` = " . $moduleId . ";";
mysql_select_db(DB_USER_DATABASE_NAME, $this->conn);
$result = mysql_query($sql, $this->conn);
$x = mysql_fetch_row($result);
if($x[0] == 1) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
This works fine in all my pages except one page where it fails . I have a dropdown box and a text box which will be updated depending on the users permission. The user i am logged on as has the permission but the dropdown boxes do not appear.
if(isset($_GET['orderNumber'])) {
// If post is set then update the prima reference and order status
// Only if user has sufficient privileges
if(isset($_POST['orderStatus'])) {
if($user->CheckModulePermissions(11)) {
$cid->UpdateOrderStatus($_GET['orderNumber'], $_POST['orderStatus']);
$cid->UpdateOrderReference($_GET['orderNumber'], $_POST['PReference']);
}
}
if($user->CheckModulePermissions(11)) {
$content .= "<select name='orderStatus'>
<option value='1'";
if($orderDetails['status'] == 1) $content .= " selected='selected'";
$content .= ">Incomplete</option>
<option value='2'";
if($orderDetails['status'] == 2) $content .= " selected='selected'";
$content .= ">Submitted</option>
<option value='3'";
if($orderDetails['status'] == 3) $content .= " selected='selected'";
$content .= ">Processed</option>
</select>";
} else {
if($orderDetails['status'] == 1) $content .= "Incomplete";
if($orderDetails['status'] == 2) $content .= "Submitted";
if($orderDetails['status'] == 3) $content .= "Processed";
}
$content .= "</td>
</tr>
<tr>
<th>Prima Order Number</th>
<td>";
if($user->CheckModulePermissions(11)) {
$content .= "<input type='text' name='pReference' value='" . $orderDetails['PReference'] . "' /></td>
</tr>
<tr>
<td colspan='2'><input type='submit' /></td>
</tr>";
} else {
$content .= $orderDetails['PrimaReference'] . "</td></tr>";
}
$content .= "</table>
</form>
</td>
Is it the logic for the dropdown box where it fails?
Here is a more efficient/readable version of your CheckModulePermissions() method...
public function CheckModulePermissions ($moduleId) {
// Deny immmediately if no userId is set
if (!isset($_SESSION['userId'])) return FALSE;
// If the user is admin, allow regardless
if ($this->IsAdmin()) return TRUE;
// Generate an SQL statement - does this need sanitising?
$sql = "SELECT `userModuleId`
FROM `userModules`
WHERE `userId` = '{$_SESSION['userId']}'
AND `moduleId` = '$moduleId'
LIMIT 1";
// Is this line really necessary? Are you actually working with more than one database?
// Even if you are, it's probably better to do it in the query, like this:
// SELECT whatever FROM DB_USER_DATABASE_NAME.tablename WHERE...
mysql_select_db(DB_USER_DATABASE_NAME, $this->conn);
// Since you only want one row, it's slightly more resource efficient
// to abandon the $result variable
$x = mysql_fetch_row(mysql_query($sql, $this->conn));
// This means the same thing as your if ... else
return $x[0] == 1;
}
...and here is a rewritten version of the HTML generation code.
// Get this once, at the beginning, to minimise SQL traffic
$hasPermissions = $user->CheckModulePermissions(11);
// Uncomment this line to make sure that $user->CheckModulePermissions is returning the value you expect
//var_dump($hasPermissions);
if (isset($_GET['orderNumber'])) {
// If post is set then update the prima reference and order status
// Only if user has sufficient privileges
if (isset($_POST['orderStatus']) && $hasPermissions) {
$cid->UpdateOrderStatus($_GET['orderNumber'], $_POST['orderStatus']);
$cid->UpdateOrderReference($_GET['orderNumber'], $_POST['PReference']);
}
// Map of status numbers to string descriptions
$statusStrs = array(1 => 'Incomplete','Submitted','Processed');
if ($hasPermissions) {
// Generate a <select>
$content .= "<select name='orderStatus'>";
foreach ($statusStrs as $val => $str) {
$content .= "\n<option value='$val'".(($orderDetails['status'] == $val) ? " selected='selected'" : '').">$str</option>";
}
$content .= "\n</select>";
} else {
// Print the current status string
$content .= $statusStrs[$orderDetails['status']];
}
// Close the table cell (layout tables are nasty nasty)
$content .= "</td>
</tr>
<tr>
<th>Prima Order Number</th>
<td>";
if ($hasPermissions) {
// add an input for changing the reference number
$content .= "<input type='text' name='pReference' value='{$orderDetails['PReference']}' /></td>
</tr>
<tr>
<td colspan='2'><input type='submit' /></td>
</tr>";
} else {
// Display the current reference number
$content .= $orderDetails['PrimaReference'] . "</td></tr>";
}
$content .= "</table>
</form>
</td>
I think the most likely cause of your problem is that CheckModulePermissions() is returning FALSE when you expect it to return TRUE. Uncomment the var_dump() line to verify this and we'll take it from there.
ok maybe i must put all my code:
<?php
include('header_application.php');
$obj_clean->check_user();
$limit = 10;
if(!isset($_GET['page']))
$page = 1;
else
$page = $_GET['page'];
$from = (($page * $limit) - $limit);
$msg = "";
if (isset($_GET['unblock']))
{
$code = $obj_clean->unblockUser($_GET['unblock'],$_GET['code']);
if ($code == "error")
{
$msg = "Could not delete message!";
}
else
{
$msg = "You have unblocked ".$code;
}
}
//Get dynamic data required for this page from the database
$users = $obj_clean->getContacts($_SESSION['user_id'], $from, $limit);
$rows = $obj_clean->getContactsCount($_SESSION['user_id']);
include ("header.php");
?>
<div class="innerContainer">
<head>
<script type="text/JavaScript">
function yesnolist(val)
{
var e = confirm('Do you want to send a free chat request?');
if (e == true)
{
window.location.href = "http://www-rainbowcode-mobi/confirmfreechat.php";
//window.location('http://www-rainbowcode-mobi/confirmfreechat.php');
return true;
}
else
return false;
}
</script>
</head>
<span class="headings2">CONTACTS</span>
<?php if (isset($msg) && !empty($msg)) echo "<br/><font color='red'>".$msg."</font>"; ?>
<br/><br/>
<?php
if (count($users) > 0)
{
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
foreach ($users as $user)
{
//Breaks the unique code into 3 parts so that the numeric part can be a different colour
$codeLength = strlen($user['unique_code']);
$firstPartLength = $codeLength - 5;
$uniqueCode3 = substr($user['unique_code'], -2);
$uniqueCode2 = substr($user['unique_code'], -5, 3);
$uniqueCode1 = substr($user['unique_code'], 0, $firstPartLength);
echo '<tr>';
echo '<td>';
echo '<a class="charcoal_link" style="line-height: 20px;" href="'.ADDRESS.'view_profile.php?id='.$user['profile_id_contact'].'">'.$uniqueCode1.'<span class="pink_text">'.$uniqueCode2.'</span>'.$uniqueCode3.'</a>';
$requestor_id = $_SESSION['user_id'];
$profile_id = $user['profile_id_contact'];
$rel1 = $obj_clean->hasRelation($requestor_id,$profile_id);
$rel2 = $obj_clean->hasRelation($profile_id,$requestor_id);
if($rel1 && $rel2)
{
echo " ";
//echo 'Free Chat';
echo 'Free Chat';
}
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
else
{
echo "You have no contacts yet";
}
?>
</div>
<?php include("footer.php"); ?>
hope this will help better
Free Chat
should be:
Free Chat
try this:
function yesnolist()
{
if (confirm('Do you want to send a free chat request?'))
window.location = "http://www-rainbowcode-mobi/confirmfreechat.php";
}
.
.
.
<a href="#" onClick="yesnolist()">
I'd assume changing the URLs to valid domains might help things, so try:
window.location.href = "http://www.rainbowcode.mobi/confirmfreechat.php";
window.location('http://www.rainbowcode.mobi/confirmfreechat.php');
function yesnolist()
{
var e = confirm('Do you want to send a free chat request?');
if (e == true)
{
window.location = "http://www-rainbowcode-mobi/confirmfreechat.php";
return true;
}
else
return false;
}
and
<label onClick="return yesnolist();">Free Chat</a>
You can not pass onclick event on (a href="") tag because href part redirects the page and after that the javascript redirect part is called.
Or
(a href="#" onclick="return yesnolist();")Free Chat(/a)