-
Posts
128 -
Joined
-
Last visited
Everything posted by Freid001
-
I have tried this but it doesn't work. Each time the if returns true. Even if $Password2 = abcdefg if (!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $Password2)) { die ("Your new password should only contain letters and numbers!<br><a href='/game/account.php'>Back</a>"); }
-
It says: Warning This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. So what should I use instead?
-
The code below works in PHP 4 however in PHP 5 I get the following error: Deprecated: Function ereg() is deprecated in/srv/disk5/657046/www/worldwarfare.atwebpages.com/game/account/passwordcheck.phpon line 46 if (ereg('[^A-Za-z0-9]', $Password2)) { die ("Your new password should only contain letters and numbers!<br><a href='/game/account.php'>Back</a>"); } else { echo ""; } I think ereg doesn't work in PHP5 so what should I use instead of ereg?
-
YES! Thanks so much. It is working now! Kind of new to this PDO stuff LOL.
-
Must mean there is something wrong with the connection then because the query works fine in PHP 4. But The connection I used to connect to the db in PHP 4 also works fine. Not sure what I am doing wrong.
-
I have tried using this code. Which works but only returns a blank array. Not sure why? //PDO Connect $db= new pdo("mysql:host=$host; $mysql_database", "657046_ww", "sandon"); //PDO Statement $sth = $db->prepare("SELECT * FROM Admin"); $sth->execute(); $result = $sth->fetchAll(); print_r($result);
-
But the query works fine in PHP 4.
-
Ok so I am trying to connect to a mysql database and just simply return the id of a row in the table admin. However I get the following error message: Fatal error: Call to a member function fetch() on a non-object in /srv/disk5/657046/www/worldwarfare.atwebpages.com/testcon.php on line 19 Here is my PHP code: <?php session_start(); $mobile = $_SESSION['mobile']; $user = $_SESSION['username']; $host = '********'; $mysql_user = '******'; $mysql_password = '*******'; $mysql_database = '***********'; //PDO Connect $db= new pdo("mysql:host=$host; $mysql_database", $mysql_user, $mysql_password); //PDO Fetch Statement $query = $db->query("SELECT `id` FROM `Admin`"); while($row = $query->fetch()){ echo $row['id']; } ?> In PHP4 this is what I am trying to do in PDO $con = mysql_connect($host,$mysql_user,$mysql_password); mysql_select_db($mysql_database); $query = mysql_query("SELECT * FROM Admin"); $numrows = mysql_num_rows($query); while ($row = mysql_fetch_assoc($query)) { echo $row['id']; } Any Help Will Be Much Appreciated! Thanks
-
Thanks that works brilliantly!
-
oh yes your code works, but as you send it will need a timer added to it. How would i do this? Also would there be a way to get the session to time out?
-
I did try sessions a while ago but the problem I had was resetting the session back to 0 because if the users opens a page, then opens it in another tab user get error message and the code sets session to 0, the user opens third tab and user can access the same page twice again. Not tried your code yet but that is what I experienced when I tried using sessions a while ago.
-
I am writing some code for PHP textbased game. I just discovered that players can open a page and then if they open the same page again in another tab and then select a link on both the pages they can skip certain stuff which they should not be able to skip.
-
Does anyone know if there is any PHP code which will prevent a user from opening the same page twice at the same time. So for example: User opens a web page -> user opens the same page in another tab (Is it possible to check for this and then display a error message on the second page opened?) Thanks for any help
-
Ok I have read on the BBC webs site about a new cookie law in the UK: http://www.bbc.co.uk/news/technology-18206810 My website uses sessions to check if the user is logged and other website stuff. I think sessions uses cookies (But I might be wrong?). My website does not gather data about my users it. So does this law apply to websites that use sessions or is it just a new law to stop websites from gathering information about what pages people are viewing? If the new law does apply to php sessions does this mean that I will need to inform the users on the registration form about the php sessions/cookies? Thanks For any help. PS (Admin): I don't know where to post this so if it is in the wrong place sorry. Could you move it to the correct place thanks
-
Sending automated emails with php HELP PLEASE!
Freid001 replied to Freid001's topic in PHP Coding Help
Does anyone know how to send a URL in a php email? -
Sending automated emails with php HELP PLEASE!
Freid001 replied to Freid001's topic in PHP Coding Help
Ok ive worked out that with out a URL link in the email content it send the email but with a URL link in the content it does not send a email. wired? Any one know why this is? -
Sending automated emails with php HELP PLEASE!
Freid001 replied to Freid001's topic in PHP Coding Help
Well it says that It sends the email but then I check my inbox and there's no email I have checked the span and junk folders to but no email ? -
Sending automated emails with php HELP PLEASE!
Freid001 replied to Freid001's topic in PHP Coding Help
I need to make sure that there email address is valid. So yes. -
Sending automated emails with php HELP PLEASE!
Freid001 replied to Freid001's topic in PHP Coding Help
Is it even possible to do this? -
I have a registration form on my website which the user has to enter there email address into. My php script needs to send a email to the enter email address registered on the from in order to send the user an account activation link. Below is the code I am attempting to do this with but its not working. Any ideas? $mail = strtolower(strip_tags ($_POST["Email"])); $to = '$mail'; $email_message .= " Content \n"; if (mail ($to, 'Registration', $email_message , 'From: ' . $name . ' <' . $email . '>')){ echo "<meta http-equiv='refresh' content='5;url=/pages/register.php?error=18'>"; } else { echo("<p>An error has occurred please try again!</p>"); } Thanks for any help!