-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
the way you would do it in PHP would be to make the PHP write XML to a file. You can't make an RSS feed with PHP alone. So, assuming since you want to use PHP since you are on the PHP forums, i would suggest you do a search for file input and output with PHP. I have a script that makes an RSS feed with PHP somewhere on my old computer, but unfortunately i'm at work so I can't post it
-
$_SESSION[username] = $row[username]; this is your problem. the $row variable holds a mysql resource, not a mysql associative array. to do that you need to do $array = mysql_fetch_assoc($row); $_SESSION['username'] = $array['username']; hope that helps
-
ahh ok I misread something in there haha.
-
posting your login script would help, but make sure of a few things 1. that the session 'username' is the correct name of the session variable you set when a user logs in 2. that you actually set the username to a value. this is a very common problem
-
instead of checking if the value is empty by comparing it to an empty string, try checking the length of the value, IE: if (form.city.value.length < 1) { alert( "Please select a town." ); form.city.focus(); return false ; } beyond that it looks fine to me
-
s it possible to use a variable as a modifier for a regex pattern. for example: Code: mod = "^"; match = "string to match"; string.match(mod + match);
-
I believe you to have single quotes around your keys when you have an associative array
-
You should use javascript to do that.
-
How to have a script run automaticly everyday at certain time
mikesta707 replied to DigitalGuard's topic in PHP Coding Help
um... I think instead of username you have to put the actual USERNAME of your ftp account or something like that -
Ok. I'm going to assume that in an actual email, you want the location to be somewhere near the bottom of the message itself, like blah blah blah blah blah blah 101 lexinton ave, manhattan new york, 10001 is that correct? Well you are going to have to add the location to the text of your body. In your mail function, there are a few lines that look like: // Set and wordwrap message body $body = "From: $name\n\n"; $body .= "Message: $message"; $body = wordwrap($body, 70); this is where the function creates the information for the body of the message itself. What you want to do (I'm assuming, correct me if I'm wrong) is add the location to the bottom of the email message. So that means we want to effect the Message of the $body variable. to do that, try something like $body .= "Message: $message" . "\n" . $location; instead of $body .= "Message: $message"; I haven't done a mailing script in a long while, So i could be a little off. I took a look through the php.net entry for the mail() function, and I didn't see any "location" header so I believe that the message body is the only place it can go. Hope that helps!
-
try not using the $news variable as the variable used to store the assoc array. maybe while ($row = mysql_fetch_array($news, MYSQL_ASSOC))
-
if (w) { //code } else { if (y) { //code } elseif (z) { //code } else { //code } } elseif (x) { //code } there much better. Looks fine to me. BTW this code is invalid =P. cant have an else before an elseif
-
Im not entirely sure what you mean by "this actually doesn't display page3.php but i think fetching it from cookies." but on page 2, you always set the session to something no matter what, so it will show you as logged in. change on page 2 $username=$_POST['username']; $_SESSION['username']=$username; to if (isset($P_POST['username'])){ $username=$_POST['username']; $_SESSION['username']=$username; } that way you don't set the session even if the user didn't actually send a post request to log in. Also, you should have some sort of validation. With the current set up (assuming this is all the code you have) all anyone has to do to log in is type in a username.
-
this, but its just personal preference, not based on anything else really.
-
so i'm assuming your having trouble with is passing the two fields from the database to the other php file. if all that file does is get whatever fields, than just include that file in the other file that evaluates stuff. hope that helps
-
make sure that on every page you have you have the following code at the top: if(!(isset($_SESSION['username']))) { header('Location: page1.php'); } beyond that, that script SHOULD work for logging someone out
-
PhP login tutorial: http://www.phpeasystep.com/workshopview.php?id=6 general php tutorials from w3schools: http://www.w3schools.com/PHP/DEfaULT.asP good luck with your php ventures!
-
How to have a script run automaticly everyday at certain time
mikesta707 replied to DigitalGuard's topic in PHP Coding Help
taken from: http://www.webmasterworld.com/forum88/6102.htm If you don't have the php cgi installed you can use wget to run a php script via cron. The command is simply: wget -O /dev/null http://www.example.com/somescript.php The -O /dev/null part means send the output to the null device so that no disk space is taken up with the HTML (or whatever) output from your script. hope that helps! -
[SOLVED] Post data from PHP to .txt file...
mikesta707 replied to Huijari's topic in PHP Coding Help
what exactly happens when you run this? is the .txt file not overwritten? does the file become empty? does the file not even open? -
I have used session_unset() and session_destroy() with much success. maybe post your code? Edit: also make sure that on every member only page you have some sort of validation script running like if (!isset($_SESSION['user'])){ ##your not logged in message and maybe redirect }
-
How to have a script run automaticly everyday at certain time
mikesta707 replied to DigitalGuard's topic in PHP Coding Help
i believe you can accomplish this with cron jobs. here you go: http://www.google.com/search?q=cron+job+tutorial&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a take your pick from the tutorials listed there -
[SOLVED] i fly my white flag in surrender
mikesta707 replied to machiavelli1079's topic in PHP Coding Help
well first of all, you can set a header when you already have output on the page. I'm assuming this is why you could not set the header in the following code block else { $this->Reset(); echo 'attempting redirect'; header("Location: timeoutpage.php"); //we know this will fail but want to make sure code gets here } check if you have any output before this else statement. if you do, you cannot use the header, because it cannot execute a header command when there has been output. hope that helps! -
... read this basic tutorial on php functions. http://www.w3schools.com/PHP/php_functions.asp pay specific attention to the return values, and parameters section
-
no prob, make sure you set the topic as solved!
-
i don't quite understand your question, but try $total = 0; while ($list = mysql_fetch_array($result)) { if($ref_mem['ref_valid'] == 'yes') { $acookie = "10"; }else{ $acookie = "0"; } if($ref_mem['ref_login'] == 'yes') { $bcookie = "5"; }else{ $bcookie = "0"; } if($ref_mem['ref_topic'] == 'yes') { $ccookie = "10"; }else{ $ccookie = "0"; } if($ref_mem['ref_ncomment'] == 'yes') { $dcookie = "5"; }else{ $dcookie = "0"; } if($ref_mem['ref_profile'] == 'yes') { $ecookie = "5"; }else{ $ecookie = "0"; } if($ref_mem['ref_avatar'] == 'yes') { $fcookie = "5"; }else{ $fcookie = "0"; } if($ref_mem['ref_tencookies'] == 'yes') { $gcookie = "10"; }else{ $gcookie = "0"; } if($ref_mem['ref_ref'] == 'yes') { $hcookie = "20"; }else{ $hcookie = "0"; } $total_cookies = $acookie+$bcookie+$ccookie+$dcookie+$ecookie+$fcookie+$gcookie+$hcookie+10; $total += total_cookies; ...