wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Sorry I meant to say this line $next_draw = $last_draw + 3600; replaces this $next_draw=$last_draw+($plot['draw_days']*(3600*24)); If it still doesn't work then please tell us, what your script is supposed to do and you're trying to. Post all relevant code here.
-
EDIT: CV beat me preg_match_all will return an array of matches ($matches). You'll have to loop through the array. preg_match_all('~{AUTHOR}([^{]+)~is', $fcontents, $matches); foreach($matches[1] as $match) { echo nl2br(trim($match)) . '<br />'; }
-
im at ' 0 days 5 hrs 48 mins and 19 secs moved up an houir ? then when i did that it went to Were getting so close!! Pardon? I did not understand what you just said
-
We got there finally!
-
Get rid of this line $row_selected_topics = mysql_fetch_assoc($selected_topics); This is removing the first result.
-
I think this is what you're after $next_draw = $last_draw + 3600;
-
You would only check the username/password when they login not for every page they view. Instead when they login successfully define a new session variable called is_logged_in and set it to true. Now on every page that requires the user to be logged have the following at the top of the page. <?php session_start() // check if they are logged in if(!isset($_SESSION['is_logged_in']) || isset($_SESSION['is_logged_in']) && $_SESSION['is_logged_in'] != true) { header('Location: login.php'); exit; } // code for page here When they logout destroy the session or unset the is_logged_in session variable.
-
No one can read the contents of a session. All session data is stored on the server. Why are saving the password in the session?
-
You wont need to times 3600 by anything, if there's 60 secounds in a minute and there's 60 minutes in an hour, 60 * 60 = 3600
-
running admin programs on a production server
wildteen88 replied to mottwsc's topic in PHP Coding Help
By admin programs are you referring to phpmyadmin? Which is popular web based administrative tool for MySQL commonly used by many websites. By default configuration phpMyAdmin logs you in without asking for username/password. This is because the username/password are hard coded into the config.inc.php. A much more secure way is to setup phpMyAdmin to asked for a MYSQL username/password for logging in. To do this simply edit the config.inc.php file and change where it says config on this line $cfg['Servers'][$i]['auth_type'] = 'config'; to http. Now phpMyAdmin will require you to use a MYSQL username/password to login (just like MySQL Query Browser does). To add extra security if you're using Apache Server you can add a .htaccess file within your phpmyadmin folder and add the following code: Order Deny,Allow Deny from all Allow from xxx.xxx.xxx.xxx Change xxx.xxx.xxx.xxx to your computers IP Address. Now only you can access yoursite.com/phpmyadmin. However this will only work if you're using a static IP Address. Alternatively you can setup a new MySQL user which allows for remote connections to your MySQL server. You can then use normal desktop applications such as MySQL Query Browser or MySQL Administrator to login remotely. -
You need to start your regex patterns with delimiters first, eg ~your pattern here~ So the following pattern ^[a-zA-Z0-9]*$ can be rewritten as ~([A-Z0-9]+)~i I would recommend you to have read of this regex tutorial for the basics on regular expressions. Also check out regular-expressions.info too.
-
Use {AUTHOR}([^{]+) Example: $text = '{AUTHOR} author1 staff1 {HEADLINE} DISPOSABLE DECOR: THE CUTTING EDGE DULLS FAST\ STYLE AT A SPEED USUALLY ASSOCIATED WITH WARDROBE ITEMS.'; preg_match('~{AUTHOR}([^{]+)~is', $text, $matches); echo nl2br(trim($matches[1]));
-
[SOLVED] Can anyone help me make a countdown timer?
wildteen88 replied to gergy008's topic in PHP Coding Help
You'll want use Javascript for this. Search google for javascript countdown timer -
[SOLVED] simple echo statement not working
wildteen88 replied to sandbudd's topic in PHP Coding Help
mysql_fetch_object returns an object not an array. So you cant use echo $row['firstname']; echo $row['lastname']; You need to use echo $row->firstname; echo $row->lastname; -
Ok fixed my mistake now. First drop your existing players table. I have modified the table. Replace this line (`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY, With (`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY, `player_id` VARCHAR( 32 ) NOT NULL, Change foreach($chunk_all_players_data as $chunk_players_data) To $row_id = 1; foreach($chunk_all_players_data as $chunk_players_data) Now change // check to see if the player already exist $player_name = sql_safe($player_data[13]); $user_exists_sql = "SELECT `name` FROM `$player_table_name` WHERE `name`=$player_name "; $result = mysql_query($user_exists_sql) or die('Error checking user!<br />'.mysql_error()); // if the user does not exist, use an INSERT STATEMENT // we'll add the user into the database if(mysql_num_rows($result) == '0') { $sql = "INSERT INTO `$player_table_name` SET "; $update_user = false; } to // check to see if the player already exist $player_id = md5($player_data[13] . $row_id++); $user_exists_sql = "SELECT `player_id` FROM `$player_table_name` WHERE `player_id`='$player_id'"; $result = mysql_query($user_exists_sql) or die('Error checking user!<br />'.mysql_error()); // if the user does not exist, use an INSERT STATEMENT // we'll add the user into the database if(mysql_num_rows($result) == 0) { $sql = "INSERT INTO `$player_table_name` SET `player_id`='$player_id', "; $update_user = false; } All 3500 records should get inserted.
-
Ignore the post I made earlier. I messed up. Undo the changes I told you to do.
-
EDIT IGNORE THIS COMPLETELY F'D UP
-
There are duplicate entries in player.txt You have three entries for Sean Collins, and two entries for Adam Courchaine and for Trevor Lewis. This is why it skips some entries.
-
[SOLVED] simple echo statement not working
wildteen88 replied to sandbudd's topic in PHP Coding Help
You're not calling session_start() at the top of your login script. This function needs to be called on the first line of any page that uses sessions (this does not include files that are being included). It cannot be called after any output has been made (eg, text, html etc). So add session_start() to your login script as highlighted below: Again $session needs to be $_SESSION within newsession.php -
[SOLVED] simple echo statement not working
wildteen88 replied to sandbudd's topic in PHP Coding Help
Post your full code here for when the user logs in and for the page that requires the user to login. -
[SOLVED] simple echo statement not working
wildteen88 replied to sandbudd's topic in PHP Coding Help
You should not be using session_register to create a session variable. Instead you use the $_SESSION superglobal array. Example page1.php <?php session_start(); $_SESSION['name'] = 'John Smith'; ?> <a href="page2.php">Go to Page2.php</a> page2.php <?php session_start(); echo 'Hello! Your name is: ' . $_SESSION['name']; ?> -
[SOLVED] simple echo statement not working
wildteen88 replied to sandbudd's topic in PHP Coding Help
Have you called session_start() at the very top of your script? eg <?php session_start(); //code for page here ... Also where/how are you defining your session variables? -
[SOLVED] simple echo statement not working
wildteen88 replied to sandbudd's topic in PHP Coding Help
Are you using sessions? If you are $session should be $_SESSION (must be in caps). You should also be calling session_start on any page that uses $_SESSION's -
[SOLVED] xampp/phpmyadmin security problem
wildteen88 replied to simon551's topic in PHP Installation and Configuration
Rather than hard code the username/password within config.inc.php change this line within config.inc.php $cfg['Servers'][$i]['auth_type'] = 'config'; To $cfg['Servers'][$i]['auth_type'] = 'http'; This time phpMyAdmin will prompt you to provide a username/password. This is much more secure. -
You can use either method. Both will work just fine. However the 2nd method seems unnecessary.