Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. can we see some code.. its kinda hard to work without it! as a guess i would say a javascript would do it!..
  2. Add a login page, which sets a session, and have all pages check for that session if fails redirects.. other than something like this i guess only a mod will work!
  3. <?php echo $_SERVER['REMOTE_ADDR']; //IP echo $_SERVER['HTTP_USER_AGENT'] // client browser ?>
  4. try this <?php $my_array = array( 1=> 'Numbers', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven'); $count = 1; echo "<table border='1'>"; echo "<tr>"; foreach ($my_array as $num){ echo "<td>$num</td>"; if ($count == 5){ echo "</tr><tr>"; $count = 0; } $count++; } //cleanup while ($count != 1){ echo "<td> </td>"; if ($count == 5){ echo "</tr><tr>"; $count = 0; } $count++; } echo "</tr>"; echo "</table>"; ?> EDIT: added a cleanup for the table
  5. I don't understand the problem here.. (maybe because its 2:30am) Sessions will stay alive until they timeout (set in the php.ini file), as for unsetting the session.. well thats not going to work if the users just closes the window.. login.php <?php session_start(); unset($_SESSION['uid']); //check username/password if correct then do below $_SESSION['uid']=true; header( "Location: http://localhost/school/test/private.php" ); exit; ?> private.php <?php session_start(); if($_SESSION['uid'] === true) { echo "Woohoo"; exit; }else{ echo "Sorry no access"; die; } ?>
  6. ToonMariner's code looks fine $find = array('/r%#d/', '/b\*%d/','/#i#j#/'); $rep = array('<','>',''); can you post your post please.. sorry nothing is displaying is probably a problem in your existing code!
  7. using preg_match try $data = "1,600 users online"; if (preg_match('/^(.[0-9,.]+)/', $data, $regs)) { $result = $regs[0]; //1,600 } else { $result = ""; // not found }
  8. try this $query2 = "UPDATE `membership` SET `email`='$email_updated',`country`='$country_updated' WHERE `username`='$username'"; $result2 = mysql_query($query2) or die (mysql_error());
  9. Humm, it should be ok but try this revised script <?php // A 2 dimensional array with the countries...////////////////////////////////////// $countries_list = array( 54 => 'Afganistan', 65 => 'Albania', 35 => 'Algeria', 68 => 'Andorra', 36 => 'Angola', 35 => 'Algeria', 89 => 'Antigua Barbuda', 20 => 'Australia', 37 => 'Austria', 82 => 'Bahamas', 86 => 'Bangladesh', 85 => 'Barbados', 16 => 'Belgium', 34 => 'Belize', 67 => 'Bosnia Herzegovina', 18 => 'Brazil', 104 => 'Bulgaria', 60 => 'Burkina Faso', 82 => 'Bahamas', 5 => 'Canada', 51 => 'Chile', 8 => 'China', 99 => 'Colombia', 102 => 'Costa Rica', 53 => 'Congo', 97 => 'Croatia', 52 => 'Cuba', 46 => 'Czech Republic', 10 => 'Denmark', 41 => 'Dominican Republic', 103 => 'Egypt', 98 => 'Estonia', 14 => 'Finland', 6 => 'France', 7 => 'Germany', 42 => 'Greece', 43 => 'Guatemala', 33 => 'Hong Kong', 79 => 'Honduras', 74 => 'Hungary', 62 => 'Iceland', 70 => 'India', 44 => 'Israel', 9 => 'Italy', 13 => 'Ireland', 31 => 'Jamaica', 17 => 'Japan', 58 => 'Kiribati', 87 => 'Laos', 101 => 'Latvia', 100 => 'Lebanon', 69 => 'Lithuania', 32 => 'Luxembourg', 40 => 'Malaysia', 25 => 'Mexico', 63 => 'Nauru', 15 => 'Netherlands', 71 => 'Netherlands Antilles', 21 => 'New Zealand', 61 => 'Nigeria', 96 => 'North Korea', 11 => 'Norway', 45 => 'Pakistan', 90 => 'Paraguay', 83 => 'Peru', 59 => 'Philippines', 14 => 'Poland', 24 => 'Portugal', 50 => 'Puerto Rico', 75 => 'Romania', 3 => 'Russia', 47 => 'Serbia', 48 => 'Seychelles', 200 => 'Scotland', 94 => 'Senegal', 26 => 'Singapore', 64 => 'Slovenia', 29 => 'South Africa', 30 => 'South Korea', 23 => 'Spain', 1 => 'Sweden', 57 => 'Switzerland', 49 => 'Taiwan', 93 => 'Thailand', 50 => 'Togo', 78 => 'Trinidad & Tobago', 55 => 'Turkey', 55 => 'Ukraine', 12 => 'United Kingdom', 2 => 'United States of America', 88 => 'Uruguay', 56 => 'Uzbekistan', 73 => 'Venezuela', 77 => 'Vietnam', 39 => 'Western Samoa', 38 => 'Yugoslavia', ); ?> <?php // Get the users details from mysql...////////////////////////////////////////////// $query1 = "SELECT * FROM `membership` WHERE `username`='$member'"; $result1 = mysql_query($query1) or die (mysql_error()); $row = mysql_fetch_array($result1); $id = $row['id']; $username = $row['username']; $email = $row['email']; $country = $row['country']; $avatar = $row['avatar']; $user_class = $row['user_class']; $ban = $row['ban']; // if the user is banned no further...////////////////////////////////////////////// if($ban == "Y") { echo "<br /><b><h4>This Account Has Been Disabled</h4></b>"; echo "<meta http-equiv=\"refresh\" content=\"1;URL=login.php\">"; include("includes/footer.php"); exit; } // check if the user has messages in there inbox...///////////////////////////////// $query_msg = "SELECT * FROM `pms` WHERE `reciever_id`='$id'"; $result_msg = mysql_query($query_msg) or die (mysql_error()); if (mysql_num_rows($result_msg) > 0) { echo '<br /> <table border="1" bordercolor="#000000" cellspacing="0" cellpadding="10" bgcolor="red"> <tr> <td style="padding: 10px; background: red"> <strong><a class="msg_inbox" href="inbox.php">You Have Messages In Your Inbox</a> </td> </tr> </table>'; } // the POST data...///////////////////////////////////////////////////////////////// $email_updated = $_POST['email']; $country_updated = $_POST['country']; $country = $country_updated; // isset...///////////////////////////////////////////////////////////////////////// if(isset($_POST['submit'])) { // a query to update mysql.../////////////////////////////////////////////////////// $query2 = "UPDATE `membership` SET `email`='$email_updated',`country`='$country_updated' WHERE `username`='$member'"; $result2 = mysql_query($query2) or die (mysql_error()); if($result2) { echo "<br /><b>Profile Updated Successfully!</b><br /><br />"; } } else { // get the id...//////////////////////////////////////////////////////////////////// echo "<br /><h3><p align=\"center\"> Hi, <a href=\"user_details.php?id=$id\">$username</p></a></h3>"; echo '<br /> <table width="400" border="1" bordercolor="#000000" cellspacing="0" cellpadding="3" /> <form action="my_account.php" method="POST" /> <th colspan="2" bgcolor="#004E98"><font color="#ffffff">Edit Your Profile</font></th> <tr> <td align="right"><b>Your E-Mail:</b></td><td align="left"><input type="text" name="email" size="30" value="'.$email.'" /></td> </tr> <tr> <td align="right"><b>Select Your Country:</b></td><td align="left">'; $select = '<select name="country" id="country">'."\r\n"; foreach($countries_list as $key => $value) { $select .= "\t".'<option value="'.$key.'">' . $value.'</option>'."\r\n"; } $select .= '</select>'; echo $select; ################################################################## echo '<select name="country">'; foreach ($countries_list as $id => $Item) { $default = ($Item == $country)?" selected ":""; echo "<option $default value='$id'>$Item</option>"; } echo '</select>'; ################################################################## echo '</td> <tr> <td align="right"><b>Your Selected Country:</b></td><td align="center">'; ## get the flag...//////////////////////////////////////////////////////////// $query3 = "SELECT * FROM `countries` WHERE `id`='$country'"; $result3 = mysql_query($query3); $row = mysql_fetch_array($result3); $flag_pic = $row['flagpic']; echo '<img src="flags/'.$flag_pic.'">'; ## get the flag...//////////////////////////////////////////////////////////// echo ' </td> </tr> <tr> <td align="right"><b>Current Avatar:</b></td><td align="center">'; // an if incase theres no avatar.../////////////////////////////////////////// if(empty($avatar)) { echo "<img src=\"images/default_avatar.gif\" />"; } else { echo "<img src=\"avatars/$avatar\" />"; } echo ' </td> </tr> <tr> <td align="right"><b>Upload An Avatar:</b></td> <td align="left"><a href="upload_avatar.php">Upload Avatar</a></td> </tr> <tr> <td align="right"><b>Change Your Password:</b></td> <td align="left"><a href="change_password.php">Change Password</a></td> </tr> <tr> <td align="right"><b>Write About You:</b></td> <td align="left"><a href="about_me.php">About Me</a></td> </tr> <tr> <td align="right"><b>Your Friends List:</b></td> <td align="left"><a href="friends_list.php">Friends</a></td> </tr> <tr> <td align="right"><b>Your Uploaded Files:</b></td> <td align="left"><a href="my_files.php">My Files</a></td> </tr> <tr> <td align="right"><b>Your Requests:</b></td> <td align="left"><a href="my_requests.php">My Requests</a></td> </tr> <tr> <td colspan="2" bgcolor="#004E98" align="right"><input type="submit" name="submit" value="Update Details >>>"> </td> </tr> </table></form><br />'; // if the user is a site admin echo a new table out........................... if($user_class == "Site Administrator") { echo '<br /> <table width="400" border="0" bordercolor="#000000" cellspacing="0" cellpadding="3" /> <th colspan="2" bgcolor="#004E98"><font color="#ffffff">>>>>>Admin Options<<<<<</font></th> <tr> <td align="center"><a href="mass_pm.php">Mass PM All Users</a></td> </tr> <tr> <td bgcolor="#004E98" colspan="2"><font color="#ffffff"><b>>>>>>Admin Options<<<<<</b></font></td> </tr> </table><br />'; } } // end the isset...//////////////////////////////////////////////////////////////////// ?>
  10. Javascript (AJAX) then.. either that or be clearer with the question
  11. change $default = ($Item = $row['country'])?" selected ":""; to $default = ($Item == $row['country'])?" selected ":"";
  12. i stopped reading from their as if you only want to update a frame you need to give the frame a name and then set the target in the href to the frames name ie <frameset rows="105px,*" border="0" frameborder="no"> <frame src="menu.php" name="menu" noresize="noresize" scrolling="no"></frame> <frame src="main.php" name="main" noresize="noresize"></frame> </frameset><noframes></noframes> in the menu.php i would use this link <a href="main.php?Main=Login" target="main">Login</a> Note target="main" thus opening the page in the main.php frame NOT the menu (yet it was called from the menu) hope this helps
  13. I agree with frost.. His too quick on the reply button (gets me every time) LOL
  14. I was refering to the mysql_query part, i just included the whole block to make it easier to find, great job and remember mysql_error() is you friend, Well done and Happy PHPing
  15. its a link for php/flash, personally i can't see any php problems its a flash problem! loadVariables is returning the correct data! is a flash problem
  16. OK i think the problem is here if ($num2 > 0) // password is correct { $_SESSION['auth']="yes"; $logname=$_POST['fusername']; $_SESSION['logname'] = $logname; $today = date("Y-m-d h:i:s"); $sql = "INSERT INTO Login (loginName,loginTime) VALUES ('$logname','$today')"; mysql_query($sql) or die("Can't execute query."); //<---HERE header("Location: Member_page.php"); } Try commenting it out and see if the 2nd login works (were resolve the problem if this is it but we need to check to see if this is the problem first) also add some error checking change mysql_query($sql) or die("Can't execute query."); //<---HERE to #mysql_query($sql) or die(mysql_error()); //<---HERE if it works remove the # and try again.. and post the error
  17. need to see some code, could be a tagged field (set during login) in the sql, cookies/session etc.. need more info
  18. Is the file chess.php, as i think you may have a infintive loop, or a problem with the SQL server
  19. The problem seam more flash related, as for PHP sending data..well only on parameters, have you tried Connector.ai
  20. Well i tried it with #session_start(); and with session_start(); works both times...
  21. try looking into AJAX, their some great examples of drop downs http://www.phpfreaks.com/forums/index.php/topic,115581.0.html
  22. just say the call from the database is row and the field is gender i would do something like this $theList = array("Male", "Female", "CrossGender"); <select name="somename"> foreach ($theList as $Item) { $default = ($Item = $row['gender'])?" selected ":""; echo "<option $default value='Option 1'>Option 1</option>"; } </select> untested but you should get the idea
  23. You using AJAX ? try moving scripts to header, reduce scrite size.... we really need to see something first!
  24. What do you have so far? can you post some code!
  25. <?php $sqlq = "SELECT user_id, que FROM users ORDER BY que DESC"; $cont = true; $UID = 1; //users ID $counter = 0; $row = array(); $result= mysql_query($sqlq); while(($row = mysql_fetch_assoc($result)) || $cont) { $counter++; $cont = !($row['user_id'] = $UID); } echo "you are position $counter"; ?> DONE.. now click solved ..... please!! LOL
×
×
  • 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.