alexdemers
-
Posts
65 -
Joined
-
Last visited
Never
Posts posted by alexdemers
-
-
Store a md5() of each card. Let's say your array is:
[
[5, 6, 7, 9, 11]
[16, 18, 21, 25, 26]
[30, 35, 36, 37, 40]
[47, 48, 51, 52, 55]
[65, 69, 71, 72, 73]
]
$stored_value = md5(serialize($bingo_card_array));
-
Also, if (isset($_POST['display'])) might not work because the actual form element will not send data to the server. It's its elements inside that will. So, you can just check isset($_POST['show']) and it will work.
Edit-Adding: Naming a form element's purpose is mostly just for JavaScript. You shouldn't name it. It might work in IE (haven't tried it) but I'm guessing future browser might not work.
-
What does the mms() function do? Does it really return the value submitted?
-
Follow the examples here: PHP: mail - Manual. There's an example with HTML emails.
Also, make sure your email client does in fact support HTML emails. If it does, is it turned on for that particular address? Maybe there's a security option in your email client that restricts parsed HTML emails if you don't know the sender.
-
Use PHP: str_replace - Manual instead for a simple replace.
-
Do the logic. Check to see what $_SERVER['REQUEST_URI'] returns for each page. Just echo the variable.
<?php $file_parts = explode('/', $_SERVER['REQUEST_URI']); $current_file = end($file_parts); ?>
This will return the file only, not its directories.
-
There's alot of things wrong with your script. First, remove completely ereg functions. Second, you don't have any $_POST variables (unless you have register globals set to on, which is a very bad idea).
Also, where you have :
<?php for ($t = 0; $t < $showtalks; $t++) { $talk_array = explode("|", $talks[$t]); echo "<b>".$talk_array[2]."</b> (<a href=\"http://collect.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=".$talk_array[1]."\" target=\"_blank\">Add</a> | <a href=\"http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=".$talk_array[1]."\" target=\"_blank\">View</a> )<BR> "; }
Replace $talk_array[1] with $talk_array[0] and $talk_array[2] with $talk_array[1]. Arrays start at 0.
-
To add to my previous post:
set headers and call readfile('yourfile.txt'); that's it.
-
We still need to see the code. PHP is server side, not client so there's no way for us to see the issue.
-
That's an awesome concept. Well, you will need ALOT of JavaScript to make that work in standard browser. Then when submitting the form, transfer that to binary and so on...
-
-
Okay i would like to find a php script where, People can enter there friend ID and there picture URL .jpg or anything else. And it will show to everyone who goes to that website.
Like a myspace whore train joiner. Something like thatt. it can be simple. and i can make the template. Alll i need is the php script or anything needed
We are help to help with your code. Not provide you complete scripts.
-
Or make use of single quotes.
<?php fwrite($banned, '$ip[] = \''.$user.'\';'."\n" ); ?>
-
It could be one of your die(). Follow the logic and try var_dump()ing different variables to see where your logic goes.
-
Like some people have here in their signature:
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); ?>
Put that at the top of your file. You will know any errors.
-
I replied and explained in your other post.
-
I am trying to run this:
<?php if(!preg_match("/^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$/", $local_array[$i]))?>
And i get this:
Unknown modifier '='
Whats up here?!
thanks
First, it's not the correct forum. Second, it's caused because you have your delimiter in there (the character before the = which is a slash which is your delimiter). The delimiter is what tells preg_* that the actual regex is between those chars. You can use / # ~ @ ! . Those are all that I saw once, possibly there's more, I don't know. The escape char is backslash \ so replacing / with \/ should do the trick. Same goes for all occurrences in your regex except the last one of the string obviously.
-
Look. Replace this code (yours):
<?php // we must never forget to start the session session_start(); if (isset($_POST['username']) && isset($_POST['password'])) { $username = $_POST['username']; $password = $_POST['password']; require_once("connect.php"); // check if the user id and password combination exist in database $query = "SELECT username FROM members WHERE username = '$username' AND password = '$password'"; $row = mysql_query($query) or die ("Error - Couldn't login user."); if (mysql_num_rows($row) == 1) { // the user id and password match, // set the session $_SESSION[username] = $row[username];
With my corrected code:
<?php // we must never forget to start the session session_start(); if (isset($_POST['username']) && isset($_POST['password'])) { $username = $_POST['username']; $password = $_POST['password']; require_once("connect.php"); // check if the user id and password combination exist in database $query = "SELECT username FROM members WHERE username = '$username' AND password = '$password'"; $row = mysql_query($query) or die ("Error - Couldn't login user."); if (mysql_num_rows($row) == 1) { // the user id and password match, // set the session $real_row = mysql_fetch_array($row); $_SESSION['username'] = real_row['username']; } ?>
If that's not what you're looking for then I really don't know what you are trying to do. But, like I said, the code you provided in your first post is correct and there's no problems with it (except security, but that's not the issue).
-
The idea is now first, if you login, print that, and not print that. My problem is i dont know the right script to call the db so it can see if someone is online or not
<?php
session_start();
require_once("connect.php");
if (mysql_num_rows($row) == 1) {
{
echo "You are currently logged in, <b>$_SESSION[username]</b>.";
}
else // bad info.
{
echo "You are currently <b>NOT</b> logged in.";
}
?>
Well, what I just explained you is it's not that script (which I just quoted here) you have problems with, it's the one where you assign the username to $_SESSION['username']. That's the problem. And I just corrected that problem. So refer to this post to fix your script http://www.phpfreaks.com/forums/index.php/topic,263787.msg1243513.html#msg1243513
-
There's 3 steps in getting data from the database.
1. Connect to the database (which hopefully you did in connect.php)
2. Query the database (which is what mysql_query() does)
a. mysql_query() returns either a resource (an internal pointer to that query) or false on failure (syntax error or any other MySQL related errors)
b. You assign that returned value to $row (in your case, but I recommand changing the variable name to something more precise like $result)
3. You fetch the results from that query: mysql_fetch_array()
a. If you're sure you will always return 0 or 1 query, you don't have to use a loop; so you can assign it directly: $row = mysql_fetch_array($result). Else, you should to while ($row = mysql_fetch_array($query)) { echo $row['username']; }
b. Now $row will contain an array which you can juggle with and do what you have to do. In your case, assign $row['username'] to a session variable: $_SESSION['username'];
-
You didn't mysql_fetch_array(). $row actually contains a result and not an array.
Change to this:
<?php if (mysql_num_rows($row) == 1) { // the user id and password match, // set the session $real_row = mysql_fetch_array($row); $_SESSION['username'] = real_row['username']; } ?>
2 things. I highly recommend you use quotes for non constant. If you didn't declare a constant then use quotes. In big applications, it will drastically slow down the application. Also, a little tip: when you do assign a variable to mysql_query(), I recommend naming it $result since it's the result and not records (array).
Hope this solves it.
-
Add quotes to keys of $_SESSION variable: $_SESSION['username'].
But that shouldn't be the problem. Do you have other code we need to see?
-
I really don't understand.
-
Create a column in your items table with integers; the higher the int is the bigger it ahs a priority.
Or, play with your ORDER BY clause.
[SOLVED] Cookie problem
in PHP Coding Help
Posted
It's caused with is_int(); it's returning false because a string is returned from mms(). So the best bet is to do if ($show > 0). PHP: is_int - Manual will return true ONLY if the type of the variable is an integer; not if it can be parsed as integer.