-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
If you're collecting a username by login, you're probably using cookies or sessions. Just store the username in either of those and do a mysql query when they download the file.
-
Worked for me.
-
Yep, it'll destroy the cookie.
http://us3.php.net/manual/en/function.unset.php -
[code=php:0]
unset($_COOKIE['value']);
//or give it a bad value
$_COOKIE['value'] = false;
[/code] -
Put it on the pages that require the user to be logged in to access.
Like, eg. editprofile.php
If the user is not logged in and tries to access that page it'll go to home.php -
It will call the function. Whichever pages require the user to be logged in.
-
On one of your pages just add checkLogin(); on the top.
-
Well put. Most of the time ob_ is used in rush or to a beginning programmr, but if you're careful you can pinpoint where you errors are.
-
You could easily stop errors like this from happening.
At the beginning of your code have:
[code=php:0]
<?php
ob_start();
[/code]
And at the end of your code have:
[code=php:0]
ob_end_flush();
?>
[/code] -
[quote author=taith link=topic=122835.msg507068#msg507068 date=1169057091]
assuming your are variable based, it wouldnt matter where you include() it...
if their not... you need to include() it exactly where you want the file to show.
[/quote]
What you're saying is
[code=php:0]
<?php
//have you top part here
//put your include filename here for content
//put your footer here
?>
[/code] -
What Jesirose said would work. But to make it much easier if you had more than one page and instead of including each page separately you could do something like:
[code=php:0]
$page = $_GET['go'];
if(isset($page)){
if(file_exists("$page.php")){
include("$page.php");
}else {
header("Location: index.php");
}
}else {
include("indexContent.php");
}
[/code]
Each file name would be $page.php, say $page was contact, it would include contact.php, etc... -
Upload a php script
[code]
<?php
show_source("filename.php");
?>
[/code] -
<select value="appt_for[]">
<select value="best_time">
change value to name
-
You should check if they're blank.
And don't put PHP tags around HTML unless you're echoing it.
[code=php:0]
if(!isset($varname)){
echo "not there";
}else {
//query
}
[/code]
Ted, if you're inserting into the database without supplying given table fields then the first field of that query would be $name in place of the id. It's best if you made the query with given values
[code=php:0]
$sql = "INSERT INTO table (name,email,etc) VALUES('$name','$email','$etc')";
[/code]
If no value is given for idea it won't go blank, but to keep that from even happening just make the id value NULL -
[code=php:0]
ini_set(max_execution_time,20000);
[/code] -
You can't echo $row without any parameters. $row[id] would produce, 1 2 3 4 5 6 7, etc... $row[name] could produce, Jim Joe Bob Helen Ralph... etc..
-
[quote author=chronister link=topic=121951.msg502296#msg502296 date=1168528712]
if(mysql_num_rows($result > 0)){
[/quote]
That wouldn't work. mysql_num_rows($result) > 0 -
If you're directly connecting to your database there is no need to include the $con in your mysql queries.
-
I'm going to ask why this mod is no longer available.
-
Perfect, lol. Didn't see that. Thanks.
-
$rowBB == mysql_fetch_array($resAA)
sure it is. -
[code=php:0]$result2 = mysql_query($sql,$con)[/code]
-
$result18 = mysql_query($query2) or die(mysql_error());
-
Make admin addon for a game I am making, hehe. Deleting news, the while statement is not spitting out the results.
[code=php:0]
//START...DELETE NEWS************
if($act == deletenews){
$nid = $_GET[nid];
if(!isset($nid)){
$sqlBB = "SELECT * FROM news ORDER BY id DESC";
$resAA = mysql_query($sqlBB) or die(mysql_error());
echo "<table border=0 cellspacing=3 cellpadding=2>\n";
echo "<tr><td class=boardB align=left>News Title<td class=boardB>Author<td class=boardB>Delete Link\n";
while($rowBB == mysql_fetch_array($resAA)){
echo "<tr><td class=boardB align=left>$rowBB[title]<td class=boardB>$rowBB[poster]<td class=boardB><a href='admin.php?act=deletenews&nid=$rowBB[id]'>Delete News ID #$rowBB[id]</a>\n";
}
echo "</table>";
}else {
$sql = "SELECT * FROM `news` WHERE `id` =$id";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) == 0){
error("This news article does not exist!");
}else {
$sql = "DELETE FROM `news` WHERE `id` =$id";
$res = mysql_query($sql) or die(mysql_error());
echo "This news article has been deleted!<br><a href='admin.php?act=deletenews'>Go Back</a>";
}
}
}
//END....DELETE NEWS*************
[/code]
Updating Fields in a Table
in PHP Coding Help
Posted
$sql = "UPDATE `tablename` SET `field1` ='$var1', `field2` ='$var2' WHERE `id` =$userid";
$res = mysql_query($sql) or die(mysql_error());
[/code]