-
Posts
84 -
Joined
-
Last visited
Posts posted by PHPTOM
-
-
Hello, I haven't ran your code. However, I quickly saw that you have used single equals sign in your if statement:
if(($user_type = "user") && ($is_verified = "1")) {
What you should do is use double equals to create an 'is equal to' condition. For example:
if($user_type == 'user' && $is_verified == 1) {
-
Hey,
Looking to find a solution to something. I have been experimenting making a template engine for a website I am building. How can I search a variable for all occurrences of {VARIABLE} eg. {Username} {Title} {Content} so I can str_replace them.
Thank you
-
What are your motives for doing this? I don't get what you are trying to achieve by using output buffering. If you want to display the code just put:
<html> <body> <center> <br/> <h1>Apartment Reference #: <?php echo $_POST["reference"]; ?><br /></h1> <br/> <?php echo $_POST["application"]; ?>, <?php echo $_POST["deposit"]; ?><br /> <?php echo $_POST["pets"]; ?><br /> <br/> <?php echo $_POST["community"]; ?><br /> <?php echo $_POST["interior"]; ?><br /> <?php echo $_POST["amenities"]; ?><br /> <br/> <?php echo $_POST["contact"]; ?><br /> <a href="<?php echo $_POST['website'] ?>"><?php echo $_POST['website'];?></a><br/> <br/> <br/> <br/> </body> </html>
into a blank php file and it will display
-
<?php ob_start(); ?> <html> <body> <center> <br/> <h1>Apartment Reference #: <?php echo $_POST["reference"]; ?><br /></h1> <br/> <?php echo $_POST["application"]; ?>, <?php echo $_POST["deposit"]; ?><br /> <?php echo $_POST["pets"]; ?><br /> <br/> <?php echo $_POST["community"]; ?><br /> <?php echo $_POST["interior"]; ?><br /> <?php echo $_POST["amenities"]; ?><br /> <br/> <?php echo $_POST["contact"]; ?><br /> <a href="<?php echo $_POST['website'] ?>"><?php echo $_POST['website'];?></a><br/> <br/> <br/> <br/> </body> <?PHP $HtmlCode= ob_get_contents(); ob_end_flush(); ?>
-
Couple of ideas:
Use AJAX to submit the form to include both of them in a get statement
Or:
As the value put something like value="1&delete"
Then you can explode it to form an array
Eg:
<input name="delete[]" type="checkbox" value="1&delete" /> $array = explode("&", $val); echo $array[0]; //Value echo array[1]; //ID
Hope you get the jist
-
Id is not passed to PHP. It is used client side in JS/CSS.
-
It will most probably be the server's host name that has been blocked and not the IP
-
This might not be down to you personally, but the server been blacklisted. Are you on free shared hosting by any chance?
-
<?PHP function validFileName($text, $extension = 'jpg'){ return ereg_replace("[^A-Za-z0-9\-]", "", str_replace(' ', '-', strtolower(trim($text)))).'.'.$extension; } echo validFileName("CrazyDave's Upload!"); ?>
-
Where do I set the error reporting to E_ALL?
Top of the file
-
Well, presuming you are using Apache and virtual hosts for the different websites on your server.. you could just change the ini for your virtual host?
-
Security reasons. To the other server you could be a malicious hacker. Best way IMO is to do all the logic on server 1 as to whether to upload or not, then use PHP's FTP functions to upload it.
I've thought of that, the problem though is that files can be up to 5GB in size. If I change the php.ini to allow such big files I think all other (internet) 'friends' may abuse it, that's why I started the home server.
Well protect the page with some kind of username/password? Even htaccess would suffice if it is a small time thing.
-
Security reasons. To the other server you could be a malicious hacker. Best way IMO is to do all the logic on server 1 as to whether to upload or not, then use PHP's FTP functions to upload it to server 2.
-
Please give us the full picture, because so far you have only gave us bits.
-
phpBB is the most widely used forum with many updates and modifications to use at your leisure. I believe there is an arabic language pack too.
However, these aren't the only forum scripts. There are many paid ones such as vBulletin and Invision.
-
I think you should push towards using CSS3 more with less graphics. You can do perfectly rounded corners divs using it, and shadows for that fact. It looks too amateur currently, like a junior graphics class. Also, the 'my problem' value should be removed when you click on the input box.
-
Definitions of programming framework on the Web:
* Programming frameworks are application agnostic, algorithm agnostic and platform agnostic (they help you Program efficiently)
Take a look at CakePHP. Have a read on their website.
-
Where is the $row array coming from? Do you mean $_POST? Why do you have 2 inputs with the same name (hidden and radio)?
Also you should have "1" instead of 1 as it is a string.
A simpler way would be
$answer = ($_POST['electricity'] == "1") ? "YES" : "NO";
-
So you are wanting the form to be submitted using AJAX so there is no refresh involved? Seems to me you have the line
header( "Location: contact.php" );
which is refreshing the page aswell.
-
To put it bluntly anything using cookies is a security risk. This is just part and parcel of implementing a remember me. The only things I could think of is if the person logs in with the remember me checked:
1) Login with checked
2) Insert into a remember me table with the IP, ID of user, agent, random auth
3) Set a cookie with the random auth
4) check against it all and if it comes back true login to the user ID
Only thing I could think of in the early hours of the morning. I do think this is one of the better methods as you can be remembered on different computers.... eg work and home
-
in the showarticle.php I have:
$article_num = $_GET['cid']; //check if the article number exists, function call check_artnum ($makalah_num);
//the function declaration
function check_artnum ($article_num) { $query = mysql_query ("Select * FROM `articles_content` where `num` = '$article_num' "); $num_rows = mysql_num_rows($query); if ($num_rows == 0 || $num_rows < 0) { return $article_num = '101';} else {} }
is the logic and sytanx correct?
I tried ti write a wrong article number in the URL it gave me a blank page.
Thank you
This code doesn't actually output to the page, so hence the blank page. Personally I would do this, though I haven't checked that it works:
function check_artnum ($article_num) { $query = mysql_query("Select * FROM `articles_content` where `num` = '".$article_num."'"); $num_rows = mysql_num_rows($query); return ($num_rows == 0) ? '101' : $article_num; }
echo check_artnum($_GET['cid']);
-
And what does the page actually say when you try to upload a file?
-
$variable = " blah blah .. . . . index.php?X=".$_GET['x']."..........blah";
To include another variable inside a string just do "stringstringstring".variable."stringstringstring";
-
http://www.snow-report.us/somename/operations/error_log
Displays your server address & username
Also no index file in operations. Not a huge hole, but it is one.
Adding Paginatation to a script
in PHP Coding Help
Posted
When you mysql_connect did you give it the variable of $con? Or as long as it isn't a persistant connection you could just remove that line.