-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
its basically concatenation, so, you could write <?php $data = "hello "; $data = $data."world"; ?> but a shortcut is <?php $data = "hello "; $data .= "world"; ?> if this makes sense, please close this topic (bottom left)
-
erm.. put the path you wish to save to in the fopen! ?
-
i don't understand what your asking for!
-
try this on the newserver, it should pull all the file from the old one <?php $RemoteHost = "123.123.123.123"; $RemotePort = 21; $RemoteUser = "root"; $RemotePass = "pass"; // this is the root path for the remote server $rootpath = "public_html"; // this is the physical path of the source directory. actually u can also use the relative path. $sourcepath = realpath("../")."/newsite"; // this directory name will only change the top most directory and not the inner one $destination_dir_name = "server_account_id/"; // make a FTP connection $con = ftp_connect($RemoteHost,$RemotePort); $login_result = ftp_login($con,$RemoteUser,$RemotePass); rec_copy ($sourcepath, $destination_dir_name, $con); if (function_exists("ftp_close")) { ftp_close($con); } function rec_copy ($source_path, $destination_path, $con) { ftp_mkdir($con, $destination_path); ftp_site($con, 'CHMOD 0777 '.$destination_path); ftp_chdir($con,$destination_path); if (is_dir($source_path)) { chdir($source_path); $handle=opendir('.'); while (($file = readdir($handle))!==false) { if (($file != ".") && ($file != "..")) { if (is_dir($file)) { // here i am restricting the folder name 'propertyimages' from being copied to remote server. if($file != "propertyimages") { rec_copy ($source_path."/".$file, $file, $con); chdir($source_path); ftp_cdup($con); } } if (is_file($file)) { $fp = fopen($file,"r"); // this will convert spaces to '_' so that it will not throw error. ftp_fput ($con, str_replace(" ", "_", $file), $fp,FTP_BINARY); ftp_site($con, 'CHMOD 0755 '.str_replace(" ", "_", $file)); } } } closedir($handle); } } ?>
-
ahhh HA #1 $src = imagecreatefromjpeg($uploadedfile);//Create from JPEG! should be #1 //$src = imagecreatefromjpeg($uploadedfile);//Create from JPEG!
-
I don't believe i missed that!!! your always attempting to close it.. just move it up, in the if block FIXED revised <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <?php import_request_variables('G', 'url_'); $ID = (int)$_GET['piece']; if ($ID > 0) { require("db/config.php"); require("db/opendb.php"); $query = "SELECT text, title, year FROM poems WHERE id=$ID"; $result = mysql_query($query); $content = mysql_fetch_assoc($result); $title = $content['title']; require("db/closedb.php"); } else { $title = ""; } ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title><?php echo $title; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="stylesheet" type="text/css" href="css.css" media="Screen,Projection,TV" /> </head>
-
move the code down //updated - MOVED! $username = mysql_real_escape_string($_POST['username']); $password = $_POST['password']; full code <? include('/home/fresnosa/public_html/includes/dbConfig.php'); if($_GET['do'] == 'check') { //added // incase you have magic quotes on if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $conn = mysql_connect($host, $user, $pass) or die('Could not connect: ' . mysql_error()); //select database mysql_select_db($db, $conn) or die('Could not select database'); //updated - MOVED! $username = mysql_real_escape_string($_POST['username']); $password = $_POST['password']; $result = mysql_query("SELECT * FROM users WHERE user='$username'") or die(mysql_error()); $row = mysql_fetch_array( $result ); if($row['user'] == '') { echo "<b>username or password is incorrect</b><br>"; } else { if($row['password'] == $password) { $_SESSION['logged'] = "true"; $_SESSION['user'] = $username; header("location: admin.php"); } else { echo "<b>username or password is incorrect</b><br>"; } } } ?>
-
ok you can remove those 2 lines.. can you post the code you have.. as it should be working!
-
can you post the opendb.php, (remove any passwords etc)
-
IF the one you posted is surposed to be a RFC 2822 Standard you could use if(eregi("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(??:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(??:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])",$email)) { //email found } else { # email failed } but this is NOT recommended! to use it, will it valid the email yes.. personally i think your just using up more processing power then needed and have more areas of problems.. the one i use is simple and, true is doesn't check for max 64 chars etc... but if someone was going to fake an email mail.. it would probably be formatted correcltly (on atleast their 3rd attempt)
-
revised <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <?php import_request_variables('G', 'url_'); $ID = (int)$_GET['piece']; if ($ID > 0) { require("db/config.php"); require("db/opendb.php"); $query = "SELECT text, title, year FROM poems WHERE id=$ID"; $result = mysql_query($query); $content = mysql_fetch_assoc($result); $title = $content['title']; } else { $title = ""; } require("db/closedb.php"); ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title><?php echo $title; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="stylesheet" type="text/css" href="css.css" media="Screen,Projection,TV" /> </head>
-
change from $title = "> $content[title]"; to $title = $content['title'];
-
what do you mean by isn't working ? error message?
-
sorry Aureole, but i have to disagree.. Simple check i use, you could check the domain exists but i hardly see the point! i use member email activation!! if (eregi('^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$', $email)) { # valid email } else { # invalid email }
-
ok thats weird.. add the following to the start var_dump($_FILES); die; and upload the gif, and post back the results the code above will kill the script but should highlight the problem
-
may help if you used the function!!! ie emailChecker($_POST[email]); if (!valid_email($_POST['email'])) { die("Bad email"); }
-
a do-while (required the so change to }while( $Check );
-
why not just move the text to the same place as the form! //snip... else { echo '-->HERE<---<form name="cf" method="post" action=""> <table width="283" border="0" cellpadding="2" cellspacing="1" class="content"> //snip...
-
na, many people have dynamic IP's,
-
well not really as with 2 buttons your need to choose one of them
-
the best route would be to change if (isset($_POST['Submit'])) to if (isset($_POST)) it will work but do you have more that one button on your final project ?
-
OK an idea of the top of myhead.. create an new table, with this when someone hit remember me, it create a new records, and give the user 2 cookies, 1 UID, 2 HASH, if the UID is used with the wrong HASH 5 times its deleted, other than that its kept for X day (or always), Now.. the table also stores a UserHASH = MD5(username.password) (the hashed password) and the userID, remember me is used (via login thing) it uses the cookie to get the userID it then check the MD5(username.password) (the hashed password) to the stored UserHASH, if this is correct then continue else message "please relogin as your details have changed", i think that quite nice:)
-
it basically filters, the input.. put it this way.. without the filter i could (without a user account) drop (remove) all your databases from your site.. Full code, <? include('/home/fresnosa/public_html/includes/dbConfig.php'); if($_GET['do'] == 'check') { //added // incase you have magic quotes on if (get_magic_quotes_gpc()) { $value = stripslashes($value); } //updated $username = mysql_real_escape_string($_POST['username']); $password = $_POST['password']; $conn = mysql_connect($host, $user, $pass) or die('Could not connect: ' . mysql_error()); //select database mysql_select_db($db, $conn) or die('Could not select database'); $result = mysql_query("SELECT * FROM users WHERE user='$username'") or die(mysql_error()); $row = mysql_fetch_array( $result ); if($row['user'] == '') { echo "<b>username or password is incorrect</b><br>"; } else { if($row['password'] == $password) { $_SESSION['logged'] = "true"; $_SESSION['user'] = $username; header("location: admin.php"); } else { echo "<b>username or password is incorrect</b><br>"; } } } ?>
-
holly hell.. filter the username for starter... // incase you have magic quotes on if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $username = mysql_real_escape_string($_POST['username']); EDIT: Updated (incase of magic quotes) ALSO, your password should be hashed (readup on MD5) basic idea, when they enter the password you use $newpass = MD5($pass); then do the same when you verify it, (also read up on MD5+SALT) i'm sure other here will give to the info as well
-
STEPs 1. remove the id="Submit" and it will work fine.. 2. then delete IE from your PC 3. and every PC you see from now on... or just do step 1