Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
Well, I admit I made a mistake in my earlier code: <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']!='yes') { session_destroy(); $_SESSION['auth']=""; // you want to set this, not compare it } header("Location: /test/project12.php"); // always redirect to home ?> should be: <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']=='yes') { session_destroy(); $_SESSION['auth']=""; // you want to set this, not compare it } header("Location: /test/project12.php"); // always redirect to home ?> my apologies
-
Look at it with syntax highlighting: $delete_sql = "DELETE FROM jos_facileforms_subrecords WHERE name LIKE \'%'.$badword.'%\' "; $delete_sql = "DELETE FROM jos_facileforms_subrecords WHERE name LIKE '%".$badword."%' ";
-
Let's go back to the basic operators: Assignment operator: $a = 1 Assigns value 1 to variable a Equal operator: if($a==1) Check to see if variable a is equal to 1 Not equal operator (not and equal operator combined ): if($a!=1) Check to see if variable a is not equal to 1 So... <?php if (isset($_SESSION['auth']) && $_SESSION['auth']== "yes") { echo "signed in"; } else { echo "Log in please"; } ?> <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']!='yes') { session_destroy(); $_SESSION['auth']=""; // you want to set this, not compare it } header("Location: /test/project12.php"); // always redirect ?>
-
Again, you're using just 1 equal sign, instead of the comparison sign (==)
-
if (@$_SESSION['auth'] = "yes") should be if (@$_SESSION['auth'] == "yes") And really, the whole code should be this (IMO): <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']!='yes') session_destroy(); header("Location: home.php"); ?>
-
SEO board: http://www.phpfreaks.com/forums/index.php/board,102.0.html A topic that is pretty similar: http://www.phpfreaks.com/forums/index.php/topic,213847.0.html Hopefully that helps
-
what error ? Caused by the ticks around the 2 in the limit clause. They shouldnt be there
-
[SOLVED] Get variables not working correctly
Philip replied to sillysillysilly's topic in PHP Coding Help
The separator for GET vars is &, not ? foo.php?bar=something&other=5 -
while($row = mysql_fetch_assoc($result)) { echo $row['Title']; echo $row['SubTitle']; } you're calling for Title, when it should be title - same with subtitle
-
Or the modulus operator. Not tested, just thrown together quickly: <?php $i = 0; do { if($i%2==0) { ?> <tr> <td width="50%"><a href="http://<?php Echo $row_RS2['URL'] ?>" target="_blank" class="V12"> <?php Echo $row_RS2['employer'] ?> </a></td> <?php } else { ?> <td><a href="http://<?php Echo $row_RS2['URL'] ?>" target="_blank" class="V12"> <?php Echo $row_RS2['employer'] ?> </a></td> </tr> <?php } $i++; } while ($row_RS2 = mysql_fetch_assoc($RS2)); if($i%2>0) { echo '<td></td></tr>'; // in case of ending in an odd number of columns } ?>
-
travellingbuttons('Y','coords','1',50,50,'1'); $GetArray = travellingbuttons(); should be $GetArray = travellingbuttons('Y','coords','1',50,50,'1');
-
You'd use an array function someFunc( ) { $array = array('foo', 'bar'); return $array; } $myValue = someFunc(); // myValue now is an array with [0] => "foo" and [1] => "bar"
-
I don't think putting in tags automatically would be a good solution. A simple check to see if there are code tags (<?php, <html>, etc) outside of or [php] tags, then generate a warning (much like the one that says "Warning: someone has replied blah blah"). Something like the following would suffice I think.[color=red][b]Warning:[/b] you currently have code outside of [code] tags, this will disable any formatting of the code[/color] Even so, that could get annoying when you type a short 4 line reply like: <?php session_start(); // don't forget the line above! ?> And, it most likely wouldn't be able to detect snippits without opening tags: $foo = 'bar'; echo $foo; As mentioned before, it's up to the OP. But it is super annoying viewing posts with code not in or
-
I'll agree, prepared statements are pretty awesome
-
Mysqli is an improved class of mysql. It is more OOP style, and provides a few extra features (such as multi query and prepared statements)
-
I'd imagine this fits your needs: http://www.rwscripts.com/
-
I really like those stars, but it also depends on what the style of his website looks like and if there is any kind of theme or look to it. 100% agree with that statement (both liking + style and placement) -- colorful/energetic - use more vibrant colors instead of pastel colors. Heck you don't even have to use stars! here are some examples (just a quick google): http://wordpress.org/extend/plugins/gd-star-rating/screenshot-6.png http://www.econsultant.com/images/wordpress-plugin-post-star-rating.jpg http://www.webresourcesdepot.com/wp-content/uploads/image/mootools-star-rating.gif
-
That link won't allow me to see the content. I get this instead: You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. You don't have permission to access the requested object. It is either read-protected or not readable by the server. I have found this link on warm vs cool colours. Granted, I'm no colour expert. just click your address bar and hit enter (not refresh) - it's a hotlinking protection (sees where you referring from) Honestly, I'd stick with gold stars. Its tried and true, but if you want color do something more exciting and vibrant
-
Personally, I use mysqli object orientated style.... <?php session_start(); $postid = $_GET["id"]; if(!ctype_digit($postid)) { header("Location: http://www.mysite.com"); } include("caneck.inc"); $cxn = mysqli_connect($host,$user,$passwd,$dbname) or die ("Couldn't connect"); $quer = "SELECT * FROM test WHERE eventid = $postid LIMIT 1"; // Run query $rsult = $cxn->query($quer) or die ("Couldn't execute: ".$cxn->error); // cant recall if the following line is needed in this case. weird times that it is needed $rsult->store_result(); // check row count if($rsult->num_rows==0){header("Location: http://www.mysite.com");} // fetch the row $row = $rsult->fetch_assoc(); $rsult->free_result(); ?>
-
number_format()
-
echo '<input type="checkbox" name="featured['.$counter.']" checked="'.$value.'">'; edit: my bad
-
Yeah, add the or die on the query. The while loop is unneeded, as stated before, since you're just limiting to 1 row
-
Well, if that were the case - I'd have backups made, and charge by the hour to fix their mistakes. It'll teach them a lesson