Jump to content

karimali831

Members
  • Posts

    436
  • Joined

  • Last visited

Everything posted by karimali831

  1. Ok I'm trying to insert multiple rows by using a while loop but having problems. At the same time, need to open a new mysql connection while running the insert query, close it then open the previous mysql connection. I managed to insert multiple queries before using a loop, but for this time, the loop does not work? I think it is because I am opening another connection... yh that would make sense actually? Here is the code: $users = safe_query("SELECT * FROM ".PREFIX."user"); 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." = 1 username only? "; // ----- 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); $con = mysql_connect($ds['host'], $ds['user'], $ds['password']) or system_error('ERROR: Can not connect to MySQL-Server'); $condb = mysql_select_db($ds['db'], $con) or system_error('ERROR: Can not connect to database "'.$ds['db'].'"'); 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')"); if (FORUMREG_DEBUG == '1') { echo "<p><b>-- DEBUG -- : User added: ".mysql_affected_rows($con)."<br />"; echo "<br />-- DEBUG -- : Query used: ".end($_mysql_querys)."</b></p><br />"; $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')"); mysql_close($con); } include('../_mysql.php'); mysql_connect($host, $user, $pwd) or system_error('ERROR: Can not connect to MySQL-Server'); mysql_select_db($db) or system_error('ERROR: Can not connect to database "'.$db.'"'); } So I need to be able to insert these rows using the while loop.. how can I do this? I really appreciate any help.
  2. because when I comment these two lines, the page loads fine.
  3. Webspell CMS.. I am not sure what else to give you This is too strange, anything I can use then to find out why I am getting consistent load? It is some file... but don't know where!
  4. It is only that... and that is causing consistent load.
  5. All of a sudden, my website is having constant load because apparently my website is causing high overload all because of this annoying script: session_name('ws_session'); session_start(); ?> My webhost is saying they will suspend if I do not resolve, what am I suppose to do? I wasn't doing any development at the time, didn't make any changes at all.. it just started occuring. Now it seems there is a session problem, it is my CMS or my host? How can I find out?
  6. Ahh thanks very much, figured it with the code you mentioned foreach($qualified_ID as $v) { if (in_array($v,$user)) { sendmessage($v, $sm_elig_subject, $sm_qualified); }
  7. Yes I understand that but this.. $users2 = array_merge(array(1),range(2609,2629)); you are merging and using range? why I must do this? I don't know what to put in range.
  8. Thanks for your help, I will try this but before I do... only this bit I am not sure what to do with: $users1 = array(1,2609,2612,2620,2621,2624,2627,2629); $users2 = array_merge(array(1),range(2609,2629)); I get my arrays from query: $qual = safe_query("SELECT * FROM ".PREFIX."cup_clans WHERE groupID='$ID' && $type='0' && qual='1' && pm='0'"); while($iq = mysql_fetch_array($qual)) { $qualified_ID[]=$iq['clanID']; } $participants = safe_query("SELECT * FROM ".PREFIX."cup_clans WHERE groupID='$ID' && $type='0'"); while($all = mysql_fetch_array($participants)) { $user[]=$all['clanID']; } if(my_in_array($user,$qualified_ID)) return true; does not return true however or should it?
  9. Hi folks! I have two arrays: 1) print_r($users1); Array ( [0] => 1 [1] => 2609 [2] => 2612 [3] => 2620 [4] => 2621 [5] => 2624 [6] => 2627 [7] => 2629 ) 2) print_r($users2); Array ( [0] => 1 [1] => 2609 [2] => 2610 [3] => 2611 [4] => 2612 [5] => 2617 [6] => 2618 [7] => 2619 [8] => 2620 [9] => 2621 [10] => 2624 [11] => 2625 [12] => 2626 [13] => 2627 [14] => 2628 [15] => 2629 ) now why does nothing return when I use in_array? if(in_array($users1,$users2)) return true; all values in $users1 is in $users2... Please help, need help fast! Thank you
  10. Is there a way to fully protect PHP scripts without spending over $200 on an encoder that prevents reservse engineer?
  11. Hi folks, I'm curious if I can for example, save a file from my server and it will save to all other servers - obviously if they accepted the connection first. It's for a software I developed and is almost complete and know there will be frequent updates to it. Instead of users downloading upates, I want the update files from my server to somehow synchronize to their server automatically? Anything called this?? Thanks for info.
  12. thanks this will work but won't be any good for what I need it for. I am using a while loop to generate multiple rows from a table, so I need something like jquery, you click on "show all" and it will show you full text without pageload?
  13. try: echo '<a href="'.$eformat.'rtf">Download this blog post in eFormat (.rtf)</a>';
  14. Hi If a string exceeds 65 characters then $show_all will return, what I want to achieve is to return the whole string when I click on the hyperlink (more...) can someone help me do this please? I do not want it to show the whole string and substr(getinput($ds['desc']),0, 65).$show_all if(strlen($ds['desc'] < 65)) $show_all = '<a href="#">(more...)"</a>'; echo substr(getinput($ds['desc']),0, 65).$show_all; thanks!
  15. no it is not as simple as that because it will not always be +65 if you looked at http://team-x1.co.uk/site/test.html you would of known.
  16. My question has been answered, I did not ask "how do I make this dynamic?" . Understand that not everyone is as good for your ways of doing things.
  17. It will take a week or two to design 128 brackets. Very long, but to allow customization for other users, there is no alternative.
  18. thanks anas, this is exackly what I have done but the different won't always be 65. I don't think you seen this yet: http://team-x1.co.uk/site/test.html ??
  19. what are you talking about? my tournament works perfect, I am just extending it to support 128 teams.
  20. I hope you understand when I show you this. this is basically what I want: http://team-x1.co.uk/site/test.html and the reason behind this is: http://team-x1.co.uk/site/admin/templates/64.html a tournament. the looser in $match[1] && $match[2] will go to $match[66] etc it is for automatic switching so I need to return value. if you are familar with tournaments, look on the template where $match[1] and $match[66] is and you should understand.
  21. ok, if matchno equals a value then I want it to return another value but for this, I must use hundreds of if statements which I do not want. If you look at the code above, it follows a pattern. if matchno = 1 2 3 4 5 6 7 then return= 66 67 68 69 70 71 72 I simply want an alternative method instead of using soo many if statements. or is this only way?
  22. hmm? no do not need to do this. I think I need to be using for () to make it shorter?
  23. Hi, What is a shorter way instead of having all these if statements? Here it is: if($matchno==1) return 66; elseif($matchno==2) return 67; elseif($matchno==3) return 68; elseif($matchno==4) return 69; elseif($matchno==5) return 70; elseif($matchno==6) return 71; elseif($matchno==7) return 72; elseif($matchno== return 73; elseif($matchno==9) return 74; elseif($matchno==10) return 75; elseif($matchno==11) return 76; elseif($matchno==12) return 77; elseif($matchno==13) return 78; elseif($matchno==14) return 79; elseif($matchno==15) return 80; elseif($matchno==16) return 81; elseif($matchno==17) return 82; elseif($matchno==18) return 83; elseif($matchno==19) return 84; elseif($matchno==20) return 85; elseif($matchno==21) return 86; elseif($matchno==22) return 87; elseif($matchno==23) return 88; elseif($matchno==24) return 89; elseif($matchno==25) return 90; elseif($matchno==26) return 91; elseif($matchno==27) return 92; elseif($matchno==28) return 93; elseif($matchno==29) return 94; elseif($matchno==30) return 95; elseif($matchno==31) return 96; elseif($matchno==32) return 97; someone please code shorter? I will learn this way. Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.