ctcp Posted November 6, 2011 Share Posted November 6, 2011 echo "<script type=\"text/javascript\"> alert(\"Username or password are wrong!\"); </script>"; how to add in alert this <a href="forgot.php">forgot password?</a>? Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/ Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 echo "<script type=\"text/javascript\"> alert(\"Username or password are wrong! <a href=\"forgot.php\">forgot password?</a>\"); </script>"; Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/#findComment-1285487 Share on other sites More sharing options...
ctcp Posted November 6, 2011 Author Share Posted November 6, 2011 thank you for replay but this not work no error but no message too Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/#findComment-1285488 Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 This is really a javascript question. Post the output of your PHP script (everything in the <script> tags) and someone can help. I'm moving this to the javascript section. Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/#findComment-1285489 Share on other sites More sharing options...
ctcp Posted November 6, 2011 Author Share Posted November 6, 2011 Thank you haku echo "<script type=\"text/javascript\"> alert(\"Username or password are wrong! \"); </script>"; <a href="forgot.php">forgot password?</a> how to add link here? Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/#findComment-1285495 Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 Please post the HTML output of your script here. Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/#findComment-1285498 Share on other sites More sharing options...
ctcp Posted November 6, 2011 Author Share Posted November 6, 2011 <? include('config.php'); include_once 'common.php'; if($site->maintenance > 0){ echo "<script>document.location.href='maintenance'</script>"; exit; } if($_GET['ref'] != ""){setcookie("PlusREF", $_GET['ref'], time()+3600);} if(isset($data->login)){ echo "<script>document.location.href='facebook.php'</script>"; } if(isset($_POST['logare'])) { $dbres = mysql_query("SELECT * FROM `users` WHERE `login`='{$_POST['login']}' AND `pass`=MD5('{$_POST['pass']}')"); $num = mysql_num_rows($dbres); $data2 = mysql_fetch_object($dbres); if($data2->banned > 0){ echo "<script type=\"text/javascript\"> alert(\"Damn! Your account is banned!\"); </script>"; }else if($data2->activate > 0){ echo "<script type=\"text/javascript\"> alert(\"You need to confirm your email first to login!\"); </script>"; }else if($num > 0) { $_SESSION['IP'] = $_SERVER['REMOTE_ADDR']; $dbres = mysql_query("SELECT * FROM `users` WHERE `login`='{$_POST['login']}'"); mysql_query("UPDATE `users` SET `online`=NOW() WHERE `login`='{$_POST['login']}'"); $_SESSION['data'] = mysql_fetch_object($dbres); $_SESSION['login'] = $_POST['login']; echo "<script>document.location.href='facebook.php'</script>"; }//<a href="forgot.php">forgot password?</a> else{ echo "<script type=\"text/javascript\"> alert(\"Username or password are wrong! \"); </script>"; } } if(isset($_SESSION['login'])){ $dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`online`) AS `online` FROM `users` WHERE `login`='{$_SESSION['login']}'"); $data = mysql_fetch_object($dbres); if($data->ip == ''){ $IP = $_SERVER['REMOTE_ADDR']; mysql_query("UPDATE `users` SET `IP`='$IP' WHERE `login`='$data->login'"); } } $twc2 = mysql_query("SELECT * FROM `twitter` WHERE `user`='{$data->id}' AND `active`='0'"); $twc = mysql_fetch_object($twc2); ?> <!-- ip locate--> <!-- ip locate end --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head><title><?echo $site->site_name;?></title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="description" content="<?echo $site->site_description;?>" /> <meta name="keywords" content="<?php echo $lang['KEYWORDS'];?> /> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <!--[if IE]> <link rel="stylesheet" type="text/css" href="css/ie.css" /> <![endif]--> <!--[if lte IE 8]> <link rel="stylesheet" type="text/css" href="css/ltie8.css" /> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="css/ie7.css" /> <![endif]--> <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script> <link rel="stylesheet" href="css/home.css" type="text/css" /> <link href="../like/layout.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="container"> <div id="head"> <div id="logobox"> <div class="logo"> <a href="index.php"><img src="./images/home-logo.png" alt="logo"/></a> </div> <div id="login"> <form method="post" id="login"> <fieldset> <p> <label><?php echo $lang['USERNAME'];?></label><br/> <input class="text big" type="text" value="" name="login"/> </p> <p> <label><?php echo $lang['PASSWORD'];?></label> <br/> <input class="password" type="password" value="" name="pass"/> </p> <p> <input type="submit" class="submit" name="logare" value="<?php echo $lang['LOGIN'];?>" /> </p> </fieldset> </form> </div> </div> <div class="user_panel"> </ul> <div class="spacer" style="height:35px;"> </div> <div class="left-block"> <div class="block"> <img src="images/fb-circle.png" /> <div> <h2><?php echo $lang['GET_FREE_LIKES']; ?> </h2> <?php echo $lang['WHEN_YOU_HAVE']; ?> </div> </div> <div class="spacer" style="height:50px;"> </div> <div class="block"> <img src="images/gplus-circle.png" /> <div> <h2>xx</h2> </div> </div> </div><!--Left--> <div class="right-block"> <?php if(isset($_POST['register'])){ foreach($_POST as $key => $value) { $sec[$key] = filter($value); } $verificare1 = mysql_query("SELECT * FROM `users` WHERE `login`='{$sec['user']}' OR `email`='{$sec['email']}'"); $verificare = mysql_num_rows($verificare1); if ($verificare > 0) { $mesaj = "<div class=\"error\">". $lang['USERNAME_OR_EMAIL'] . " </div>"; }else if (!isUserID($sec['user'])) { $mesaj = "<div class=\"error\">". $lang['USERNAME_IS_INCORRECT'] . " </div>"; }else if(!isEmail($sec['email'])) { $mesaj = "<div class=\"error\">" . $lang['ENTER_A_VALID']." </div>"; }else if (!checkPwd($sec['password'],$sec['password2'])) { $mesaj = "<div class=\"error\">". $lang['PASSWORD_DO_NOT'] ." </div>"; }else{ if(isset($_COOKIE['PlusREF'])){ $ref = $_COOKIE['PlusREF']; $user1 = mysql_query("SELECT * FROM `users` WHERE `id`='{$ref}'"); $user = mysql_fetch_object($user1); mysql_query("INSERT INTO `referals`(user,referal,date) values('{$user->login}','{$sec['user']}',NOW())"); } $activare = rand(000000000, 999999909); $msg=" ". $lang['HELLO'] ." ,<br><br>" . $lang['THANK_YOU_FOR'] . " <br>" . $lang['CLICK_ON_THIS'] . " {$site->site_url}/activate.php?cod={$activare}<br><br>". $lang['CHEERST'] . ",<br>". $lang['TRADELIKE_TEAM'] . " "; $headers = "From: " . strip_tags("xxx.com@gmail.com") . "\r\n"; $headers .= "Reply-To: ". strip_tags("xx.com@gmail.com") . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($sec['email'],"xx- Activate your account",$msg,$headers); $final = VisitorIP(); $passa = $sec['password']; $passc = MD5($passa); mysql_query("INSERT INTO `users`(email,login,IP,pass,passdecoded,ref,signup,activate) values('{$sec['email']}','{$sec['user']}','$final','$passc','$passa','{$ref}',NOW(),'{$activare}')")or die(mysql_error()); $mesaj = "<div class=\"success\"> ". $lang['REGISTER_CONFIRM'] . "</div>"; }} ?> <form action="" method="post" id="register"> <h2><?php echo $lang['JOIN_TRADELIKE'];?><span><?php echo $lang['REGISTER_NOW'];?></span></h2> <div class="msg"><?echo $mesaj;?></div> <fieldset> <p> <label><?php echo $lang['USERNAME'];?>*</label><br/> <input class="text big" type="text" value="" name="user"/> </p> <p> <label>Email*</label><br/> <input class="text big" type="text" value="" name="email"/> </p> <p> <label><?php echo $lang['PASSWORD'];?>*</label> <br/> <input class="password" type="password" value="" name="password"/> </p> <p> <label><?php echo $lang['REAPEAT_PASSWORD'];?>*</label> <br/> <input class="password" type="password" value="" name="password2"/> </p> <p> <input type="submit" class="submit" value="<?php echo $lang['CREATE_ACCOUNT'];?>" name="register" /> </p> </fieldset> </form> </div> </div> <div class="clear"> </div> </div> <div class="languege"> <div class="left"> <a href="index.php?lang=en"><img src="images/en.gif" width="10" height="10" />English </a> <a href="index.php?lang=el"><img src="images/gr.gif" width="10" height="10" />Greek </a> </div></div> <div class="footer"> <div class="left"> © 2011-12 <a href="http://www.xx.com" target="_blank">xx</a> - All rights reserved </div> </div> </div> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({status: true, cookie: true, xfbml: true}); }; //Create & Append FB Connect JS (function() { var e = document.createElement('script'); e.type = 'text/javascript'; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }()); function onlogin() { alert("loggedin"); } </script> here is my index.php Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/#findComment-1285645 Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 HTML output. That means run your script, right click on the page, choose 'view source' or something like that. Copy the code, paste it here, format it so we can read it, and then we can look at what your problem is. We also don't need the whole page, just the relevant code. Quote Link to comment https://forums.phpfreaks.com/topic/250553-php-javascript-echo-help/#findComment-1285657 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.