
karimali831
Members-
Posts
436 -
Joined
-
Last visited
Everything posted by karimali831
-
Yes, that's what I mean. How many if conditions are true.. thanks.
-
Is it possible to count how many returns there are on a if statement? Where you can see echo 'yes'; it will echo this twice according to my condition, all I want is the the value 2 that it has returned twice... ? while($row = mysql_fetch_array($bookings)) { if(time() > $row['returnby'] && $row['returned']==0) { $books_overdue = count($row['returned']); } if(time() > $row['returnby'] && $row['returned']==1) { $returned_ontime = count($row['returned']); } if(time() <= $row['returnby']) { echo 'yes'; } } thanks for help.
-
Thanks for your replies. Well I am using a custom function to call mysql_query() which I recall safe_query() // -- MYSQL QUERY FUNCTION -- // $_mysql_querys = array(); function safe_query($query="") { global $_mysql_querys; if(stristr(str_replace(' ', '', $query), "unionselect")===FALSE AND stristr(str_replace(' ', '', $query), "union(select")===FALSE){ $_mysql_querys[] = $query; if(empty($query)) return false; if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!'); else { $result = mysql_query($query) or die('Query failed: ' .'<li>errorno='.mysql_errno() .'<li>error='.mysql_error() .'<li>query='.$query); } return $result; } else die(); } and for every query I use safe_query() does this help ?
-
I did some research and there is nothing under my search, I thought this sort of thing a lot of people would want to get their hands on. I am using many while loops from different files with many include() 's and calling many functions from different files that also has while loops inside.
-
Hi! I am looking for a script that counts how many queries is executed on page load? I hadn't realised one of my scripts was doing hundreds of queries simultaneously and never would of thought this would be the cause of high load. As I'm developing stuff in PHP, I want to ensure minimum queries are executed especially because I am doing this in a procedural manner and not OOP. Thanks in advance.
-
soo how do you do it?
-
Can you or someone please amend Crayon Violent's code to apply this condition? I will learn this way, thank you!
-
Thanks for this but I need one condition to it: If the hyperlink has this included: "?site=" then every link must have "_top" as target. Can I use this condition ?
-
Hi I want all hyperlink targets to be "_top" in a specific directory. Not sure if I can do this with JS or anything.. but thought I'd ask Thanks.
-
OOPZ yeah that was it! Now fixed! Nothing is wierd now. thanks for pointing that one out... :D
-
it's annoying that I can't just echo " <script..." it has to be a character, number, symbol or something. if it's invisible string that's fine.. at least it resolves the problem??
-
and your second request... 1 on 1 (location A) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location A) value is:---- 1 on 1 (location B) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location B) value is:---- 1 on 1 (location C) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location C) value is:---- 1 on 1 (location D) value is:--X1Kaz vs test7 X1Kaz vs test8 -- teams (location D) value is:---- s2 vars must be right also because data in output is correct. It is just the script not executing if there is no string in echo.
-
ahh ok, I viewed page source where the script WOULD NOT echo and this is what I see: </html> <script type='text/javascript'>$.jGrowl('<b>Unconfirmed Results</b> <br><br> <a href="?site=profile&id=1"><b>X1Kaz</b></a> vs <a href="?site=profile&id=2619"><b>test7</b></a> <a href="?site=cup_matches&matchID=2084&laddID=23" ><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br><a href="?site=profile&id=1"><b>X1Kaz</b></a> vs <a href="?site=profile&id=2620"><b>test8</b></a> <a href="?site=cup_matches&matchID=2083&laddID=23" ><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br> <br> ');</script> <!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"> the script is in the SOURCE but not show on the page?
-
Ok, here: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script src="js/jquery-1.3.2.js"></script> <script src="js/jquery.jgrowl.js"></script> <link rel="stylesheet" type="text/css" href="css/jquery.jgrowl.css"/> <style type="text/css"> div.jGrowl div.iphone { font-family: "Helvetica Neue", "Helvetica"; font-size: 12px; background: url(iphone.png) no-repeat; -moz-border-radius: 0px; -webkit-border-radius: 0px; opacity: .90; filter: alpha(opacity = 90); width: 245px; height: 137px; padding: 0px; overflow: hidden; border-color: #5ab500; color: #fff; } div.jGrowl div.iphone div.message { padding-top: 0px; padding-bottom: 7px; padding-left: 15px; padding-right: 15px; } div.jGrowl div.iphone div.header { padding: 7px; padding-left: 15px; padding-right: 15px; font-size: 17px; } div.jGrowl div.iphone div.close { display: none; } div#random { width: 1000px; background-color: red; line-height: 60px; } </style> </head> </html> <?php include("config.php"); if($loggedin) { $query_1on1=safe_query("SELECT * FROM ".PREFIX."cup_matches WHERE 1on1='1' && confirmscore='0' && (clan1='$userID' || clan2='$userID')"); $query_teams=safe_query("SELECT * FROM ".PREFIX."cup_matches WHERE 1on1='0' && confirmscore='0' && (clan1='".participantTeamID($userID)."' || clan2='".participantTeamID($userID)."')"); $totalRows = mysql_num_rows($query_1on1)+mysql_num_rows($query_teams); if(mysql_num_rows($query_1on1) || mysql_num_rows($query_teams)) $header1 = $unconfirmed_result.($totalRows>1 ? "s" : ""); while($ds=mysql_fetch_array($query_1on1)) { $league = league($ds['matchID']); $type = getleagueType($ds['matchID']); $content1_1on1.=getname1($ds['clan1'],$ds[$type],$ac=0,$league).' vs '.getname1($ds['clan2'],$ds[$type],$ac=0,$league).' <a href='.matchlink($ds['matchID'],$ac=0,$tg=0,$redirect=0).'><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br>'; } while($ds1=mysql_fetch_array($query_teams)) { $league = league($ds1['matchID']); $type = getleagueType($ds1['matchID']); $content1_teams.=getname1($ds1['clan1'],$ds1[$type],$ac=0,$league).' vs '.getname1($ds1['clan2'],$ds1[$type],$ac=0,$league).' - <a href='.matchlink($ds1['matchID'],$ac=0,$tg=0,$redirect=0).'><img border="0" src="images/cup/icons/edit.png" align="right" /></a><br>'; } } if($header1 && ($content1_1on1 || $content1_teams)) { ?>2<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script><?php } ?>
-
I would tidy the script first, I wouldn't want to work on that! After that, you can easily locate your header, body etc.
-
example two.. does not display script at all ... if($header1 && ($content1_1on1 || $content1_teams)) { ?><script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script><?php } does display script fine... if($header1 && ($content1_1on1 || $content1_teams)) { ?>2<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script><?php }
-
I did try debugging, this is output of your code: this is why it is wierd because it will only ECHO the script if there is a a string contained in the echo.
-
two codes: does not echo the script... if($content1_1on1 || $content1_teams) { echo ''; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } does echo the script... if($content1_1on1 || $content1_teams) { echo 's'; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } can anyone tell me why it does not echo the script if there is nothing in the first echo?? I can't figure it out
-
I just have problem with password now. I have phpBB and WS in one database, both uses different password hashes. CMS uses MD5 encryption, phpBB god knows. I've got phpbb function to get password hash, but for my sake, it will hash all the MD5 passwords which is no good. Somehow I need to decrypt MD5 then use the MD5 decrypt to get that hashed. Anyone understand? If not please say, also if this is not possible, any alternative?
-
It works with mysql_query() !! safe_query(): 1 record mysql_query(): hundreds What's wrong with safe_query then? function safe_query($query="") { global $_mysql_querys; if(stristr(str_replace(' ', '', $query), "unionselect")===FALSE AND stristr(str_replace(' ', '', $query), "union(select")===FALSE){ $_mysql_querys[] = $query; if(empty($query)) return false; if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!'); else { $result = mysql_query($query) or die('Query failed: ' .'<li>errorno='.mysql_errno() .'<li>error='.mysql_error() .'<li>query='.$query); } return $result; } else die(); } I
-
No safe query is fine, it just like mysql_query but safe manner I think. So... still not working? error_reporting(E_ALL); ini_set("display_errors", -1); include('../_phpbb_func.php'); $users = safe_query("SELECT * FROM ".PREFIX."user WHERE activated='1'"); while($dp=mysql_fetch_array($users)) { $username = $dp['username']; $nickname = $dp['nickname']; $pwd1 = $dp['password']; $mail = $dp['email']; $ip_add = $dp['ip']; $wsID = $dp['userID']; $registerdate = $dp['registerdate']; $birthday = $dp['birthday']; $avatar = $dp['avatar']; $icq = $dp['icq']; $hp = $dp['homepage']; echo $username."<br>"; // ----- Forum Bridge user insert ----- $phpbbpass = phpbb_hash($pwd1); $phpbbmailhash = phpbb_email_hash($mail); $phpbbsalt = unique_id(); safe_query("INSERT INTO `phpbb_users` (`username`, `username_clean`, `user_password`, `user_pass_convert`, `user_email`, `user_email_hash`, `group_id`, `user_type`, `user_regdate`, `user_passchg`, `user_lastvisit`, `user_lastmark`, `user_new`, `user_options`, `user_form_salt`, `user_ip`, `wsID`, `user_birthday`, `user_avatar`, `user_icq`, `user_website`) VALUES ('$username', '$username', '$phpbbpass', '0', '$mail', '$phpbbmailhash', '2', '0', '$registerdate', '$registerdate', '$registerdate', '$registerdate', '1', '230271', '$phpbbsalt', '$ip_add', '$wsID', '$birthday', '$avatar', '$icq', '$hp')"); $result = safe_query("SELECT user_id from ".PREFIX_FORUM."users WHERE username = '$username'"); $phpbbid = mysql_fetch_row($result); safe_query("INSERT INTO `".PREFIX_FORUM."user_group` (`group_id`, `user_id`, `group_leader`, `user_pending`) VALUES ('2', '$phpbbid[0]', '0', '0')"); safe_query("INSERT INTO `".PREFIX_FORUM."user_group` (`group_id`, `user_id`, `group_leader`, `user_pending`) VALUES ('7', '$phpbbid[0]', '0', '0')"); echo 'Success'; }
-
I have done what you both said, but loop is still not happy: error_reporting(E_ALL); ini_set("display_errors", -1); include_once('../_phpbb_func.php'); $users = safe_query("SELECT * FROM ".PREFIX."user WHERE activated='1'"); while($dp=mysql_fetch_array($users)) { $username = $dp['username']; $nickname = $dp['nickname']; $pwd1 = $dp['password']; $mail = $dp['email']; $ip_add = $dp['ip']; $wsID = $dp['userID']; $registerdate = $dp['registerdate']; $birthday = $dp['birthday']; $avatar = $dp['avatar']; $icq = $dp['icq']; $hp = $dp['homepage']; echo $username."<br>"; // ----- Forum Bridge user insert ----- $result = safe_query("SELECT * FROM `".PREFIX."forum`"); $ds=mysql_fetch_array($result); $forum_prefix = $ds['prefix']; $phpbbpass = phpbb_hash($pwd1); $phpbbmailhash = phpbb_email_hash($mail); $phpbbsalt = unique_id(); safe_query("INSERT INTO `".$forum_prefix."users` (`username`, `username_clean`, `user_password`, `user_pass_convert`, `user_email`, `user_email_hash`, `group_id`, `user_type`, `user_regdate`, `user_passchg`, `user_lastvisit`, `user_lastmark`, `user_new`, `user_options`, `user_form_salt`, `user_ip`, `wsID`, `user_birthday`, `user_avatar`, `user_icq`, `user_website`) VALUES ('$username', '$username', '$phpbbpass', '0', '$mail', '$phpbbmailhash', '2', '0', '$registerdate', '$registerdate', '$registerdate', '$registerdate', '1', '230271', '$phpbbsalt', '$ip_add', '$wsID', '$birthday', '$avatar', '$icq', '$hp')"); $result = safe_query("SELECT user_id from ".PREFIX_FORUM."users WHERE username = '$username'"); $phpbbid = mysql_fetch_row($result); safe_query("INSERT INTO `".PREFIX_FORUM."user_group` (`group_id`, `user_id`, `group_leader`, `user_pending`) VALUES ('2', '$phpbbid[0]', '0', '0')"); safe_query("INSERT INTO `".PREFIX_FORUM."user_group` (`group_id`, `user_id`, `group_leader`, `user_pending`) VALUES ('7', '$phpbbid[0]', '0', '0')"); echo 'Success'; } Only 1 output from loop.. Thanks for helping!!.. P.S. No errors.
-
I have merged databases so now I use one connection, but still while loop is not working... where I echo $username, there should be many outputs for this but there is only 1. what could be the reason loop is not looping? $users = safe_query("SELECT * FROM ".PREFIX."user WHERE activated='1'"); while($dp=mysql_fetch_array($users)) { $username = $dp['username']; $nickname = $dp['nickname']; $pwd1 = $dp['password']; $mail = $dp['email']; $ip_add = $dp['ip']; $wsID = $dp['userID']; $registerdate = $dp['registerdate']; $birthday = $dp['birthday']; $avatar = $dp['avatar']; $icq = $dp['icq']; $hp = $dp['homepage']; echo $username."<br>"; // ----- Forum Bridge user insert ----- $result = safe_query("SELECT * FROM `".PREFIX."forum`"); $ds=mysql_fetch_array($result); $forum_prefix = $ds['prefix']; define(PREFIX_FORUM, $forum_prefix); define(FORUMREG_DEBUG, 0); include('../_phpbb_func.php'); $phpbbpass = phpbb_hash($pwd1); $phpbbmailhash = phpbb_email_hash($mail); $phpbbsalt = unique_id(); safe_query("INSERT INTO `".PREFIX_FORUM."users` (`username`, `username_clean`, `user_password`, `user_pass_convert`, `user_email`, `user_email_hash`, `group_id`, `user_type`, `user_regdate`, `user_passchg`, `user_lastvisit`, `user_lastmark`, `user_new`, `user_options`, `user_form_salt`, `user_ip`, `wsID`, `user_birthday`, `user_avatar`, `user_icq`, `user_website`) VALUES ('$username', '$username', '$phpbbpass', '0', '$mail', '$phpbbmailhash', '2', '0', '$registerdate', '$registerdate', '$registerdate', '$registerdate', '1', '230271', '$phpbbsalt', '$ip_add', '$wsID', '$birthday', '$avatar', '$icq', '$hp')"); $result = safe_query("SELECT user_id from ".PREFIX_FORUM."users WHERE username = '$username'"); $phpbbid = mysql_fetch_row($result); safe_query("INSERT INTO `".PREFIX_FORUM."user_group` (`group_id`, `user_id`, `group_leader`, `user_pending`) VALUES ('2', '$phpbbid[0]', '0', '0')"); safe_query("INSERT INTO `".PREFIX_FORUM."user_group` (`group_id`, `user_id`, `group_leader`, `user_pending`) VALUES ('7', '$phpbbid[0]', '0', '0')"); echo 'Success'; }