-
Posts
783 -
Joined
-
Last visited
Everything posted by ZulfadlyAshBurn
-
I would like to create something like foursquare badges. When ppl upload files, the most downloaded files will have a new badge, how do i create that?
-
use str_replace
-
The code is working. Just realised that on my script i added ";" to the end of the alert. Im much of a php coder. teehee
-
Hmm, that might that sometime for me to code. Can you give me the code you have now or the images you have? Does your server supports Php & MySQL? It might need mySQL database.
-
What you mean replace the image map?
-
I don't get what you need. if you need to do image map, get your image coordination first.
-
I need help. I would like to have a script that would detect if the browser used is chrome. If browser is chrome then show div. This is the script i have now! <script> var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome'); if (is_chrome > 1) { alert('Best viewed in Google Chrome!') } else{ alert('Best viewed in Google Chrome') } </script>
-
How do I build a Content Management System
ZulfadlyAshBurn replied to KDM's topic in PHP Coding Help
HAHA. Joomla was the first CMS i used. I was curious about CMS then try making my own one. It works but is not really that secure. I also used my own extensions and parsed it as PHP so ppl would be confused -
look below <marquee behavior="scroll" direction="up" onmouseover="this.stop();" onmouseout="this.start();"> <h1> <?php require_once("connect.php"); $selectsqw = "SELECT name, quantity, price FROM inventory"; $resultqw = mysql_query($selectsqw); $countrowssaqw = mysql_num_rows($resultqw); if ($countrowssaqw > 1) { while ($resqw = mysql_fetch_array($resultqw)) { $resuqw[] = $resqw; } mysql_free_result($resultqw); foreach ($resuqw AS $rowqw) { ?> Latest Tenders: <?php echo "".$rowqw['name']." - ".$rowqw['quantity']." - ".$rowqw['price'].""; ?><br> <?php } } ?> </h1> </marquee> add a break line -.-
-
my friend said that class are cleaner and sometimes safer
-
Redirecting to a new page after mysql insert
ZulfadlyAshBurn replied to perky416's topic in PHP Coding Help
maybe this would come in handy register.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form name="registration_form" method="post"> First Name: <input value = "<?php print $_POST["first_name"]; ?>" type="text" name="first_name"><br /> Last Name: <input value = "<?php print $_POST["last_name"]; ?>" type="text" name="last_name"><br /> Email: <input value = "<?php print $_POST["email"]; ?>" type="text" name="email"><br /> Confirm Email: <input value = "<?php print $_POST["confirm_email"]; ?>" type="text" name="confirm_email"><br /> Username: <input value = "<?php print $_POST["username"]; ?>" type="text" name="username"><br /> Password: <input type="password" name="password"><br /> Confirm Password: <input type="password" name="confirm_password"><br /> <input type="submit" name="submit" value="Register"> </form> </body> </html> reguser.php <?php $connect=mysql_connect("localhost","leemp5_admin","p7031521"); mysql_select_db("leemp5_database",$connect) or die (mysql_errno().":<b> ".mysql_error()."</b>"); if (isset($_POST['submit'])) { if (empty($_POST['first_name'])){ echo ('Please enter your first name<br />'); header('Refresh: 3; url=register.php'); } if (empty($_POST['last_name'])){ echo ('Please enter your last name<br />'); header('Refresh: 3; url=register.php'); } if (empty($_POST['email'])){ echo ('Please enter your email address<br />'); header('Refresh: 3; url=register.php'); } if (!empty($_POST['email'])){ if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){ echo ('The email address you entered is not valid<br />'); header('Refresh: 3; url=register.php'); }} $email = $_POST["email"]; $emailquery = mysql_query("SELECT * FROM users WHERE email='$email'"); if(mysql_num_rows($emailquery) != 0){ echo ('The email you have entered is already in use<br />'); header('Refresh: 3; url=register.php'); } if (empty($_POST['confirm_email'])){ echo ('Please confirm your email address<br />'); header('Refresh: 3; url=register.php'); } if (!empty($_POST['email']) && !empty($_POST['confirm_email']) &&($_POST['email']) != ($_POST['confirm_email'])){ echo ('The emails you entered do not match<br />'); header('Refresh: 3; url=register.php'); } if (empty($_POST['username'])){ echo ('Please enter your username<br />'); header('Refresh: 3; url=register.php'); } if (empty($_POST['password'])){ echo ('Please enter your password<br />'); header('Refresh: 3; url=register.php'); } if (empty($_POST['confirm_password'])){ echo ('Please confirm your password<br />'); header('Refresh: 3; url=register.php'); } if ($_POST['password'] != $_POST['confirm_password']){ echo ('The passwords you entered do not match'); header('Refresh: 3; url=register.php'); } $username = $_POST["username"]; $usernamequery = mysql_query("SELECT * FROM users WHERE username='$username'"); if(mysql_num_rows($usernamequery) != 0){ echo ('The username you have entered is already in use<br />'); header('Refresh: 3; url=register.php'); } if (!empty($_POST['first_name']) && !empty($_POST['last_name']) && !empty($_POST['email']) && !empty($_POST['confirm_email']) && !empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['confirm_password']) && ($_POST['email']) == ($_POST['confirm_email']) && (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) && ($_POST['password'] == $_POST['confirm_password']) && (mysql_num_rows($emailquery) == 0) && (mysql_num_rows($usernamequery) == 0)) { $insert_query = 'insert into users (username,first_name,last_name,email,password) values ( "' . $_POST['username'] . '", "' . $_POST['first_name'] . '", "' . $_POST['last_name'] . '", "' . $_POST['email'] . '", "' . $_POST['password'] . '" )'; mysql_query($insert_query);} echo "<br><center>You have successfully registered!</center>"; header('Refresh: 3; url=index.php'); } ?> after all if {}, before the syntax } i have added header('Refresh: 3; url=register.php'); so that user will be redirected to the register page after it. two lines before the end of the reguser.php, it show that it will echo successful and redirect to index.php after 3 seconds -
I would to create my own php class for my website but i dunno the fundamentals of PHP CLASSES. Can anyone teach me how to create and use php class. best if you go into deeper explanations. My main subject is to create a social net site
-
thx alot paul. i will look into that
-
http://apps.facebook.com/andersonradio/ This facebook application is made by me using mostly php, mysql, html, js/jquery and xfbml. Try it out. login username: forum password: forum
-
thanks. it works.
-
where should i place the urlencode($file);
-
i have this code to show all the files in the users folder <?PHP session_start(); if(!isset($_SESSION['myusername'])){ header("location:index.php"); } else { $buildhtml = ""; $dirpath = "u/" . ($_SESSION['myusername']) . "/"; $dlist = opendir($dirpath); while ($file = readdir($dlist)) { if (!is_dir("$dirpath/$file")) { $buildhtml .= "<tr><td><a href=$dirpath$file>$file</a></td> <td> | <a href=edit.php?filepg=$file>Basic Editor</a> / <a href=edit1.php?filepg=$file>Advanced Editor</a> | </td> <td><a href=delete.php?fileitem=$file>*delete</a> | </td> <td><a href=rename.php?filepg=$file>*rename</a></td></tr>"; } } closedir($dlist); if (!empty($buildhtml)) { echo "Files in Storage</strong><table border='0'> <tr> <th>Filename</th> <th>Edit</th> <th>Delete</th> <th>Rename</th> </tr>" . $buildhtml . "</table>"; echo "Click on it to download<br>"; echo "Notice: Only html/txt files are editable"; } else { echo "The folder is <strong>empty</strong>! Please upload!."; } } ?> its shows everything correctly. but if the file have space, it will just link to the first word. how do i enable the spaces?
-
thanks micmania1. I totally forget and never realised it.
-
i coded this and it works previously but now its not working. its say: syntax error, unexpected $end. below in the code which rename the files <?php session_start(); if(!isset($_SESSION['myusername'])){ header("location:index.php"); } else { // get the new and prev file name $newn = $_POST[ 'filename' ]; $prevn = $_POST[ 'filepg' ]; // get user directory path $dirpath = "u/" . ($_SESSION['myusername']) . "/"; // new filename $newn = "$dirpath$newn"; //old filename $prevn = "$dirpath$prevn"; // rename to file rename("$prevn", "$newn"); echo "<center><br><br><h2>"; echo "The file $prevn has been renamed to $newn!</h2></center>"; header( 'refresh: 2; url=files.php' ); ?>
-
I used this script on my own website and its working. coded by myself though <?php session_start(); if(!isset($_SESSION['first_name'])){ echo "<form action='checkuser.php' method='post' name='login'> Username:<br><input class='login' name='username' type='text' value=''> Password:<br><input class='login' name='password' type='password' value=''><br><input name='Submit' type='submit' value='SUBMIT!'> </form>"; } else { echo "<center> Welcome, "; echo ($_SESSION['first_name']); } ?>
-
if you like to have your own forum on your website, you will have to code it yourself.
-
Sessions between websites I own on same server.
ZulfadlyAshBurn replied to brown2005's topic in PHP Coding Help
you may want to try get or post functions. index.php $user = $_SESSION['MembersId']; dirpath = "http://www.anotherwebsite.com/getuser.php?id="; echo"<a href=$dirpath/$user">Welcome, </a>"; http://www.anotherwebsite.com/getuser.php $userid = $_GET['id']; echo $userid; $_SESSION['MembersID'] = "$userid"; -
redirect after some time isnt that hard. add this to the "if user added" header('Refresh: 3; url=index.php');
-
MySQL and Microsoft Access Database are almost the same thing. MySQL is use mainly for Apache/Unix servers while MSSQL or Microsoft Access Database are used on Windows Servers. If you need any help, you can always pay people to do it for you
-
you have Magic quotes enabled. you to disable it. Create a .htaccess file on the folder and add this line: php_flag magic_quotes_gpc off